mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
upload.sh: Fix group and ownership of targets
- Go back to CVS revision 1.8 - Fix group and ownership of targets (experimental)
This commit is contained in:
parent
b85b93ffd5
commit
c4683e7d71
1 changed files with 27 additions and 10 deletions
|
|
@ -93,6 +93,8 @@ cat << EOT
|
||||||
-c variable : show contents of variable
|
-c variable : show contents of variable
|
||||||
valid variables are login, method, passwd, file_owner, file_group, file_mode, dir_mode,
|
valid variables are login, method, passwd, file_owner, file_group, file_mode, dir_mode,
|
||||||
source, target_file
|
source, target_file
|
||||||
|
-p : parse command line into variables, show results and exit if -x switch is active
|
||||||
|
-x : exit after informational commands
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
[ -n "$1" ] && exit $1
|
[ -n "$1" ] && exit $1
|
||||||
|
|
@ -146,9 +148,9 @@ parse_target()
|
||||||
test -n "$FILE_GROUP" && echo file_group="\"$FILE_GROUP\";"
|
test -n "$FILE_GROUP" && echo file_group="\"$FILE_GROUP\";"
|
||||||
|
|
||||||
if is_dir "$target_file" ; then
|
if is_dir "$target_file" ; then
|
||||||
echo target_path=\"$TARGET_FILE\" # TODO: this is bullshit
|
|
||||||
else
|
|
||||||
echo target_path=\"$TARGET_FILE/`basename $source`\" # TODO: this is bullshit
|
echo target_path=\"$TARGET_FILE/`basename $source`\" # TODO: this is bullshit
|
||||||
|
else
|
||||||
|
echo target_path=\"$TARGET_FILE\" # TODO: this is bullshit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "PARSE_TARGET=\"OK\";"
|
echo "PARSE_TARGET=\"OK\";"
|
||||||
|
|
@ -211,16 +213,20 @@ EOT
|
||||||
|
|
||||||
# -- here we go
|
# -- here we go
|
||||||
# -- command line arguments
|
# -- command line arguments
|
||||||
set -- `getopt 'hvc:' $*`
|
set -- `getopt 'hvc:px' $*`
|
||||||
while [ "$1" != -- ]; do
|
while [ "$1" != -- ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
h)
|
-h)
|
||||||
usage 0;;
|
usage 0;;
|
||||||
v)
|
-v)
|
||||||
VERBOSE=1;;
|
VERBOSE=1;;
|
||||||
c)
|
-c)
|
||||||
VARIABLE=$2
|
VARIABLE=$2
|
||||||
shift;;
|
shift;;
|
||||||
|
-p)
|
||||||
|
PARSE=1;;
|
||||||
|
-x)
|
||||||
|
EXIT=1;;
|
||||||
*)
|
*)
|
||||||
usage 1;;
|
usage 1;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -264,7 +270,7 @@ done
|
||||||
# -- real run
|
# -- real run
|
||||||
if [ -n "$VARIABLE" ]; then
|
if [ -n "$VARIABLE" ]; then
|
||||||
eval `parse_target`
|
eval `parse_target`
|
||||||
case "$VARABLE" in
|
case "$VARIABLE" in
|
||||||
login) echo $login;;
|
login) echo $login;;
|
||||||
method) echo $method;;
|
method) echo $method;;
|
||||||
passwd) echo $passwd;;
|
passwd) echo $passwd;;
|
||||||
|
|
@ -278,7 +284,18 @@ if [ -n "$VARIABLE" ]; then
|
||||||
echo Unknown variable \"$VARIABLE\". Exiting. >&2
|
echo Unknown variable \"$VARIABLE\". Exiting. >&2
|
||||||
exit 1;
|
exit 1;
|
||||||
esac
|
esac
|
||||||
exit 0
|
test "$EXIT" = 1 && exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PARSE" = 1 ]; then
|
||||||
|
|
||||||
|
eval `parse_target`
|
||||||
|
|
||||||
|
for var in login method passwd file_owner file_group file_mode dir_mode source target_file ; do
|
||||||
|
|
||||||
|
eval echo $var = \$$var
|
||||||
|
done
|
||||||
|
test "$EXIT" = 1 && exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for t in $*; do
|
for t in $*; do
|
||||||
|
|
@ -287,8 +304,8 @@ for t in $*; do
|
||||||
rsync_ssh)
|
rsync_ssh)
|
||||||
ssh_mkdir $target_file $file_owner $file_group $dir_mode || break
|
ssh_mkdir $target_file $file_owner $file_group $dir_mode || break
|
||||||
/usr/bin/rsync -az --links -e "/usr/bin/ssh -l $login $IDENTITY" $source $login@$host:$target_file
|
/usr/bin/rsync -az --links -e "/usr/bin/ssh -l $login $IDENTITY" $source $login@$host:$target_file
|
||||||
ssh_chown $target_file $file_owner $file_group
|
ssh_chown $target_path $file_owner $file_group
|
||||||
ssh_chmod $target_file $file_mode $dir_mode
|
ssh_chmod $target_path $file_mode $dir_mode
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Internal error: \"$method\" is not implemented." >&2
|
echo "Internal error: \"$method\" is not implemented." >&2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue