2019-01-06 14:14:47 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
|
|
|
|
VERBOSE='--verbose'
|
|
|
|
QUIET=
|
|
|
|
PROGRESS='--progress'
|
|
|
|
CONFIG='/srv/envs/${envname}/app/rattail.conf'
|
|
|
|
else
|
|
|
|
VERBOSE=
|
|
|
|
QUIET='--quiet'
|
|
|
|
PROGRESS=
|
|
|
|
CONFIG='/srv/envs/${envname}/app/silent.conf'
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
RATTAIL="/srv/envs/${envname}/bin/rattail --config=$CONFIG $PROGRESS $VERBOSE"
|
2019-09-11 19:28:58 -05:00
|
|
|
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
|
2019-01-06 14:14:47 -06:00
|
|
|
|
|
|
|
# upgrade pip
|
|
|
|
$PIP install $QUIET --upgrade pip
|
|
|
|
|
|
|
|
# upgrade rattail
|
|
|
|
cd /srv/envs/${envname}/src/rattail
|
2019-09-11 19:28:58 -05:00
|
|
|
if [ "$(sudo -H -u ${user} git status --porcelain)" != '' ]; then
|
|
|
|
sudo -H -u ${user} git status
|
2019-01-06 14:14:47 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-09-11 19:28:58 -05:00
|
|
|
sudo -H -u ${user} git pull $QUIET
|
|
|
|
find . -name '*.pyc' -delete
|
2019-01-06 14:14:47 -06:00
|
|
|
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
|
|
|
|
|
|
|
|
# run backup
|
|
|
|
cd /srv/envs/${envname}
|
|
|
|
$RATTAIL backup
|