Tweak backup scripts to ensure sudo -H
is effectively in use
This commit is contained in:
parent
63b86593f1
commit
faefb60cd6
|
@ -14,19 +14,28 @@ fi
|
||||||
|
|
||||||
|
|
||||||
RATTAIL="/srv/envs/${envname}/bin/rattail --config=$CONFIG $PROGRESS $VERBOSE"
|
RATTAIL="/srv/envs/${envname}/bin/rattail --config=$CONFIG $PROGRESS $VERBOSE"
|
||||||
PIP="sudo -u ${user} PIP_CONFIG_FILE=/srv/envs/${envname}/pip.conf /srv/envs/${envname}/bin/pip"
|
PIP="sudo -H -u ${user} PIP_CONFIG_FILE=/srv/envs/${envname}/pip.conf /srv/envs/${envname}/bin/pip"
|
||||||
|
|
||||||
|
# sanity check
|
||||||
|
if [ "$HOME" != '/root' ]; then
|
||||||
|
echo ''
|
||||||
|
echo '$HOME is not /root - please run this as e.g.:'
|
||||||
|
echo ''
|
||||||
|
echo ' sudo -H backup-everything [--verbose]'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# upgrade pip
|
# upgrade pip
|
||||||
$PIP install $QUIET --upgrade pip
|
$PIP install $QUIET --upgrade pip
|
||||||
|
|
||||||
# upgrade rattail
|
# upgrade rattail
|
||||||
cd /srv/envs/${envname}/src/rattail
|
cd /srv/envs/${envname}/src/rattail
|
||||||
if [ "$(sudo -u ${user} git status --porcelain)" != '' ]; then
|
if [ "$(sudo -H -u ${user} git status --porcelain)" != '' ]; then
|
||||||
sudo -u ${user} git status
|
sudo -H -u ${user} git status
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sudo -u ${user} git pull $QUIET
|
sudo -H -u ${user} git pull $QUIET
|
||||||
sudo find . -name '*.pyc' -delete
|
find . -name '*.pyc' -delete
|
||||||
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
|
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
|
||||||
|
|
||||||
# run backup
|
# run backup
|
||||||
|
|
|
@ -8,6 +8,15 @@ else
|
||||||
CONFIG='/srv/envs/${envname}/app/silent.conf'
|
CONFIG='/srv/envs/${envname}/app/silent.conf'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# sanity check
|
||||||
|
if [ "$HOME" != '/root' ]; then
|
||||||
|
echo ''
|
||||||
|
echo '$HOME is not /root - please run this as e.g.:'
|
||||||
|
echo ''
|
||||||
|
echo ' sudo -H rattail-backup [--verbose]'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cd /srv/envs/${envname}
|
cd /srv/envs/${envname}
|
||||||
|
|
||||||
bin/rattail -c $CONFIG $VERBOSE backup $*
|
bin/rattail -c $CONFIG $VERBOSE backup $*
|
||||||
|
|
Loading…
Reference in a new issue