File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,28 @@ if [ -z "$targeturl" ] || [[ "$targeturl" = "q" ]] || [[ "$targeturl" = "Q" ]];
3434 then
3535exit
3636 else
37-
3837echo " "
3938wget $targeturl -O $owncloud_dir /owncloud-latest.zip
39+ if [ $? -ne 0 ]; then
40+ echo " "
41+ echo " Error while fetching file."
42+ exit 1
43+ fi
44+ fi
45+
46+ read -p " Proceed update ? [Y/N]" -n 1 -r
47+ echo # (optional) move to a new line
48+ if [[ $REPLY =~ ^[Nn]$ ]]
49+ then
50+ exit 1
4051fi
4152
4253mv $owncloud_dir /owncloud $owncloud_dir /owncloud-bck
4354
4455unzip $owncloud_dir /owncloud-latest.zip -d $owncloud_dir
4556
57+ rm $owncloud_dir /owncloud-latest.zip
58+
4659cp $owncloud_dir /owncloud-bck/config/config.php $owncloud_dir /owncloud/config/config.php
4760cp -r $owncloud_dir /owncloud-bck/data $owncloud_dir /owncloud/data
4861chown -R www-data:www-data $owncloud_dir /owncloud
@@ -52,6 +65,10 @@ read -p "Is Owncloud successfully updated ? (I can wait...) [Y/N]" -n 1 -r
5265echo # (optional) move to a new line
5366if [[ $REPLY =~ ^[Yy]$ ]]
5467then
55- rm $owncloud_dir /owncloud-latest.zip
5668 rm -rf $owncloud_dir /owncloud-bck/
69+ else
70+ echo " Reverting to previous version."
71+ mv $owncloud_dir /owncloud/ $owncloud_dir /owncloud-update_pending/
72+ mv $owncloud_dir /owncloud-bck/ $owncloud_dir /owncloud/
73+ echo " Files are kept in $owncloud_dir /owncloud-update_pending/"
5774fi
You can’t perform that action at this time.
0 commit comments