diff options
Diffstat (limited to 'home/bin')
| -rwxr-xr-x | home/bin/config-update.sh | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/home/bin/config-update.sh b/home/bin/config-update.sh index a0dc1bb..1c644a0 100755 --- a/home/bin/config-update.sh +++ b/home/bin/config-update.sh @@ -7,19 +7,23 @@ cd ${HOME} # fetch file from server TMP=`mktemp -u --suffix=".tar.gz" "config-updater-XXXXXX"` -curl -s "${URL}${FILE}" > $TMP +curl -s "${URL}${FILE}" -o $TMP -# check if file is empty -if [ -s $TMP ]; then - if [ -r ${HOME}/var/system/config-updater/pre-update ]; then - source ${HOME}/var/system/config-updater/pre-update - fi - tar -xzf $TMP --strip-components=1 - if [ -r ${HOME}/var/system/config-updater/pre-update ]; then - source ${HOME}/var/system/config-updater/pre-update +# check if file exists and is not empty +if [ -e $TMP ]; then + if [ -s $TMP ]; then + if [ -r ${HOME}/var/system/config-updater/pre-update ]; then + source ${HOME}/var/system/config-updater/pre-update + fi + tar -xzf $TMP --strip-components=1 + if [ -r ${HOME}/var/system/config-updater/pre-update ]; then + source ${HOME}/var/system/config-updater/pre-update + fi + else + echo "Could not fetch updated config, $TMP is empty" fi else - echo "Could not fetch updated config, $TMP is empty" + echo "Could not fetch updated config, $TMP is missing" fi rm -f $TMP |
