mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 07:35:38 +00:00
43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
|
#!/usr/bin/gmic
|
||
|
|
||
|
skip "${1=}"
|
||
|
|
||
|
# Retrieve relative path
|
||
|
x "pwd >/tmp/pwd.txt"
|
||
|
it /tmp/pwd.txt autocrop 10
|
||
|
pwd={`"
|
||
|
path = crop();
|
||
|
base = 'CImg/html';
|
||
|
p = find(path,base);
|
||
|
p>0?(
|
||
|
l = size(path) - p - size(base);
|
||
|
copy(path,path[p + size(base)],l);
|
||
|
path[l] = _'/'; path[l+1] = 0):(path[0] = 0);
|
||
|
path"`}
|
||
|
is_pwd={['$pwd']!=0}
|
||
|
|
||
|
# Upload file or directory.
|
||
|
if "s = ['$1']; "$is_pwd" && (s==0 || s=='.')" # Synchronize current directory
|
||
|
e[] "Synchronize current directory '"${pwd}"' with 'SERVER"${pwd}"'.\n"
|
||
|
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"mirror -RL . /www/CImg"${pwd}" ; quit\""
|
||
|
x $com
|
||
|
|
||
|
elif $is_pwd" && isdir(['"$1"'])" # Synchronize specified directory
|
||
|
e[] "Synchronize directory '$1' with 'SERVER"${pwd}"$1'.\n"
|
||
|
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"mirror -RL \\\"$1\\\" \\\"/www/CImg"${pwd}"$1\\\" ; quit\""
|
||
|
x $com
|
||
|
|
||
|
elif isfile(['"$1"']) # Upload single file
|
||
|
if !$is_pwd pwd="/" fi
|
||
|
e[] "Upload file '$1' to 'SERVER"${pwd}"'.\n"
|
||
|
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"put -O \\\"/www/CImg"${pwd}"\\\" \\\"$1\\\"; quit\""
|
||
|
x $com
|
||
|
|
||
|
fi
|
||
|
|
||
|
# Local Variables:
|
||
|
# mode: sh
|
||
|
# End:
|
||
|
#
|
||
|
# (End of G'MIC custom commands)
|