diff options
author | Daniel Hansson <github@hanssonit.se> | 2019-01-04 13:08:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 13:08:30 +0300 |
commit | 540d91899b44b944e7bed73d1a1dd57dd09d2e3a (patch) | |
tree | 95838a782016ee2e837e484329cf0245ce5f59f2 /nextcloud_update.sh | |
parent | ee8208ee7edd693b9961a671fd57fd4f480e6649 (diff) |
fix issue for old installs as well (#754)
Diffstat (limited to 'nextcloud_update.sh')
-rw-r--r-- | nextcloud_update.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/nextcloud_update.sh b/nextcloud_update.sh index 2be8f357..a5786233 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -123,12 +123,26 @@ rm /var/lib/apt/lists/* -r lowest_compatible_nc 13 # Fix bug in nextcloud.sh -if grep -q "6.ifcfg.me" $SCRIPTS/nextcloud.sh +CURRUSR="$(getent group sudo | cut -d: -f4 | cut -d, -f1)" +if grep -q "6.ifcfg.me" $SCRIPTS/nextcloud.sh &>/dev/null then rm -f "$SCRIPTS/nextcloud.sh" download_static_script nextcloud - chown "$(getent group sudo | cut -d: -f4 | cut -d, -f1)":"$(getent group sudo | cut -d: -f4 | cut -d, -f1)" "$SCRIPTS/nextcloud.sh" + chown "$CURRUSR":"$CURRUSR" "$SCRIPTS/nextcloud.sh" chmod +x "$SCRIPTS/nextcloud.sh" +elif [ -f $SCRIPTS/techandme.sh ] +then + rm -f "$SCRIPTS/techandme.sh" + download_static_script nextcloud + chown "$CURRUSR":"$CURRUSR" "$SCRIPTS/nextcloud.sh" + chmod +x "$SCRIPTS/nextcloud.sh" + if [ -f /home/"$CURRUSR"/.bash_profile ] + then + sed -i "s|techandme|nextcloud|g" /home/"$CURRUSR"/.bash_profile + elif [ -f /home/"$CURRUSR"/.profile ] + then + sed -i "s|techandme|nextcloud|g" /home/"$CURRUSR"/.profile + fi fi # Set secure permissions |