Compare commits

..

No commits in common. "c9a200d42effb2d0080c933048c1d7fad54c1b1a" and "5689ef211c46a411a55e92fd4fa9aa44b335af98" have entirely different histories.

8 changed files with 29 additions and 87 deletions

View File

@ -128,14 +128,29 @@ hostname2ct(){
#---------------------------------------------------------------------- #----------------------------------------------------------------------
normpath(){ pct-push-r(){
echo $1 \ local id=$1
| sed \ local from=$2
-e 's/\/\+/\//g' \ local to=$3
-e 's/\/.\//\//g' \
-e 's/[^\/]\+\/\.\.//g' \ local IFS=$'\n'
-e 's/\/\+/\//g' \
-e 's/\/\.$/\//g' local dirs=($(find "$from" -type d))
for dir in "${dirs[@]}" ; do
if [[ "$dir" == "${to}" ]] ; then
continue
fi
dir=${dir#${from}}
lxc-attach $id -- mkdir -p "${to}/${dir}"
done
local files=($(find "$from" -type f))
for file in "${files[@]}" ; do
file=${file#${from}}
[ $QUIET ] \
|| echo "copy: \"${from}/${file}\" -> $id:\"${to}/${file}\""
pct push $id "${from}/${file}" "${to}/${file}"
done
} }

0
check-status Executable file → Normal file
View File

2
gate-traefik/make.sh Executable file → Normal file
View File

@ -3,8 +3,6 @@
source ../.pct-helpers source ../.pct-helpers
PATH=$PATH:$(dirname "$(pwd)")
#---------------------------------------------------------------------- #----------------------------------------------------------------------

0
make-shares Executable file → Normal file
View File

0
ns/make.sh Executable file → Normal file
View File

12
pct-mclone Executable file → Normal file
View File

@ -49,24 +49,24 @@ running=$(pct list | grep "running\s*$host\s*$")
# error checking... # error checking...
if [ -z $id ] || [ -z $to ] ; then if [ -z $id ] || [ -z $to ] ; then
echo ERR need both id and target id 1>&2 echo ERR need both id and target id
exit 1 exit 1
fi fi
if [ $id = $to ] ; then if [ $id = $to ] ; then
echo ERR need id and target id must be different 1>&2 echo ERR need id and target id must be different
exit 1 exit 1
fi fi
if ! [ -e $ct ] ; then if ! [ -e $ct ] ; then
echo ERR $ct does not exist. 1>&2 echo ERR $ct does not exist.
exit 1 exit 1
fi fi
if [ -e ${CT_DIR}/${to}.conf ] ; then if [ -e ${CT_DIR}/${to}.conf ] ; then
echo ERR $to already exists. 1>&2 echo ERR $to already exists.
exit 1 exit 1
fi fi
if ! [ -z $tpl ] && [ -e ${CT_DIR}/${tpl}.conf ] ; then if ! [ -z $tpl ] && [ -e ${CT_DIR}/${tpl}.conf ] ; then
echo ERR $to already exists. 1>&2 echo ERR $to already exists.
exit 1 exit 1
fi fi
@ -75,7 +75,7 @@ IFS=$'\n' mounts=($(cat $ct | grep 'mp[0-9]*:'))
# check... # check...
for mp in ${mounts[@]} ; do for mp in ${mounts[@]} ; do
if ! [ $(grep ": $SHARE_ROOT" <<< $mp) ] ; then if ! [ $(grep ": $SHARE_ROOT" <<< $mp) ] ; then
echo "ERR mountpoint: \"$mp\" heeds to handled manually." 1>&2 echo "ERR mountpoint: \"$mp\" heeds to handled manually."
exit 1 exit 1
fi fi
done done

View File

@ -1,71 +0,0 @@
#!/usr/bin/bash
#----------------------------------------------------------------------
#
#----------------------------------------------------------------------
# XXX
source $(dirname "$0")/.pct-helpers
#----------------------------------------------------------------------
case $1 in
-h|--help)
echo "Recursively push a directory to a CT creating the necessary paths"
echo
echo "Usage:"
echo " `basename $0` ID FROM TO"
echo
exit
;;
-*)
echo "Unknown option: $1"
exit
;;
esac
if [[ $# < 3 ]] ; then
echo ERR need both id and target id 1>&2
exit 1
fi
IFS=$'\n'
#----------------------------------------------------------------------
id=$1
from=$2
to=$3
#----------------------------------------------------------------------
wd=$(pwd)
# get from path relative to working directory...
if [[ ${from:0:1} != '/' ]] ; then
from="$(normpath "${wd}/${from}")"
fi
dirs=($(find "$from" -type d))
for dir in "${dirs[@]}" ; do
if [[ "$dir" == "${to}" ]] ; then
continue
fi
dir=${dir#${from}}
lxc-attach $id -- mkdir -p "${to}/${dir}"
done
files=($(find "$from" -type f))
for file in "${files[@]}" ; do
file=${file#${from}}
f=$(normpath "${from}/${file}")
t=$(normpath "${to}/${file}")
[ $QUIET ] \
|| echo "copy: \"${f#${wd}/}\" -> $id:\"$t\""
pct push $id "$f" "$t"
done
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 nowrap :

0
update-status Executable file → Normal file
View File