Transfert de fichiers par commit interposés

This commit is contained in:
Geoffrey Frogeye 2018-01-30 19:16:17 +01:00
parent b9f05ee89f
commit 628233969d

View file

@ -52,7 +52,7 @@ function _machines-api {
wget $MACHINES_API/$route --content-on-error --quiet --output-document=- "$@"
result=$?
if [ $result != 0 ]; then
echo "[ERROR] wget returned $result..."
echo "[ERROR] wget returned $result..." > /dev/stderr
exit 2
fi
}
@ -77,7 +77,7 @@ function _machines-pubFromCrt {
function _machines-verifyCertificate {
return
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error 18' | grep 'error' --quiet; then
echo "[ERROR] Invalid certificate"
echo "[ERROR] Invalid certificate" > /dev/stderr
exit 1
fi
}
@ -92,7 +92,7 @@ function _machines-ensurePub {
if [ $? == 1 ]; then
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
else
echo "[ERROR] Certificate rejected."
echo "[ERROR] Certificate rejected." > /dev/stderr
exit 1
fi
fi
@ -105,7 +105,7 @@ function _machines-ensurePub {
function _machines-ensureAdmin {
if [ ! -f $MACHINES_CONFIG/machines.key ]; then
echo "[ERROR] You need have to have the private key to do that"
echo "[ERROR] You need have to have the private key to do that" > /dev/stderr
exit 1
fi
}
@ -147,7 +147,7 @@ function _machines-updateAkey {
return 0
else
cat $MYKEY_FILE
echo "[ERROR] Authorized keys are not properly signed"
echo "[ERROR] Authorized keys are not properly signed" > /dev/stderr
rm $MYKEY_FILE
exit 1
fi
@ -368,12 +368,13 @@ function machines_update-all {
machines_machine_list | while read machine; do
echo "Updating $machine..."
ssh $machine 'machines update' &
ssh $machine 'cd .dotfiles && git pull' &
done
}
function machines_regen-keys {
if [[ -e $MACHINES_CONFIG/machines.key || -e $MACHINES_CONFIG/machines.pub || -e $MACHINES_CONFIG/machines.crt ]]; then
echo "[ERROR] Please delete the pem files manually to prove you know what you're doing."
echo "[ERROR] Please delete the pem files manually to prove you know what you're doing." > /dev/stderr
exit 1
else
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
@ -389,7 +390,7 @@ function machines_regen-keys {
function machines_setup {
if [ -e $MACHINES_CONFIG/this.name ]; then
echo "[ERROR] This machine is already set up"
echo "[ERROR] This machine is already set up" > /dev/stderr
exit 1
fi