Z.B. mit 3 oder 5 versuchen oder unendlich (Dann müsste man halt Ctrl-C drücken)
Code: Alles auswählen
read -p "Please enter SFTP server: " -i server.tld -e REMOTE_SERVER;
REMOTE_PORT=22;
read -p "Please enter SFTP username: " -i root -e REMOTE_USERNAME;
unset REMOTE_PASSWORD;
prompt="Please enter SFTP password: ";
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]; then
break;
fi;
prompt='*';
REMOTE_PASSWORD+="$char";
done;
if [ "$(dpkg --print-architecture)" == "armhf" ]; then
#lftp -p $REMOTE_PORT -u $REMOTE_USERNAME,$REMOTE_PASSWORD sftp://$REMOTE_SERVER << EOF
lftp -p $REMOTE_PORT -u $REMOTE_USERNAME,$REMOTE_PASSWORD sftp://$REMOTE_SERVER > /dev/null 2>&1 << EOF
set sftp:auto-confirm yes
set ssl:verify-certificate no
set net:timeout 5
set ftp:passive-mode true
set ftp:use-mode-z true
set ftp:mode-z-level 9
set ftp:use-allo true
rm -rf /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages
mkdir -p /var/www/html/~download
mkdir -p /var/www/html/~download/repository
mkdir -p /var/www/html/~download/repository/v120
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages/pool
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages/Dists
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages/db
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages/conf
mirror -R ./ /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/packages
quit
EOF
else
lftp -p $REMOTE_PORT -u $REMOTE_USERNAME,$REMOTE_PASSWORD sftp://$REMOTE_SERVER > /dev/null 2>&1 << EOF
set sftp:auto-confirm yes
set ssl:verify-certificate no
set net:timeout 5
set ftp:passive-mode true
set ftp:use-mode-z true
set ftp:mode-z-level 9
set ftp:use-allo true
rm -rf /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages
mkdir -p /var/www/html/~download
mkdir -p /var/www/html/~download/repository
mkdir -p /var/www/html/~download/repository/v120
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages/pool
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages/Dists
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages/db
mkdir -p /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages/conf
mirror -R ./ /var/www/html/~download/repository/v120/d94aec9a9defb2e7c18afca39fbd2e276d566a86/amd64/packages
quit
EOF
fi;