Avoid abc user

This commit is contained in:
Alexandre
2023-03-31 22:05:08 +02:00
parent 0afbaa8163
commit 669bf55835
6 changed files with 35 additions and 25 deletions

View File

@@ -1,20 +1,20 @@
### 26.0.0-6_updater (31-03-2023)
- Minor bugs fixed
### 26.0.0-5 (31-03-2023)
- ⚠ WARNING : PLEASE BACKUP NEXTCLOUD & MARIADB ADDONS BEFORE UPDATING !
- ⚠ WARNING : Enables by default updater ; you can disable it with the option "disable_updates"
- Improved updater code
- Autocorrection of permission errors in data directory
### 26.0.0-4 (26-03-2023)
- Minor bugs fixed
- Fix : solve AGAIN spam of healthcheck in logs
### 26.0.0-3 (26-03-2023)
- Minor bugs fixed
- Fix : bug in launcher script status detector if data is in a mounted directory
### 26.0.0-2 (26-03-2023)
- Minor bugs fixed
- Fix : connection with desktop client https://github.com/alexbelgium/hassio-addons/issues/771
- Improve : status check code https://github.com/alexbelgium/hassio-addons/issues/768

View File

@@ -106,6 +106,6 @@
"slug": "nextcloud_ocr",
"uart": true,
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/nextcloud",
"version": "26.0.0-6_updater",
"version": "26.0.0-7_updater",
"webui": "https://[HOST]:[PORT:443]"
}

View File

@@ -33,8 +33,10 @@ if [ -f /notinstalled ]; then
rm /notinstalled
fi
# Get launcher
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ"
# Specify launcher
PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID")
LAUNCHER="sudo -u \#"$PUID" php /data/config/www/nextcloud/occ"
# Inform if new version available
function nextcloud_download {
@@ -66,10 +68,10 @@ elif [[ $($LAUNCHER -V 2>&1) == *"Composer autoloader not found"* ]]; then
bashio::log.red " Missing files detected, Nextcloud will reinstall "
bashio::log.red "--------------------------------------------------"
touch /reinstall
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
elif [[ $($LAUNCHER -V 2>&1) == *"Nextcloud"* ]] || grep -q "/mnt/" /data/config/www/nextcloud/config/config.php &>/dev/null; then
# Log
bashio::log.green "----------------------------------------"
@@ -83,10 +85,10 @@ else
bashio::log.red "$($LAUNCHER -V 2>&1)"
bashio::log.red "------------------------------------------------------------------"
bashio::exit.nok
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
fi
echo " "
@@ -117,8 +119,8 @@ if [ -f /reinstall ]; then
/./etc/s6-overlay/s6-rc.d/init-nextcloud-config/run
# RESET PERMISSIONS
/./etc/cont-init.d/01-folders.sh
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:repair-share-owner"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ maintenance:mode --off"
fi

View File

@@ -4,6 +4,10 @@
# Only execute if installed
if [ -f /notinstalled ]; then exit 0; fi
# Specify launcher
PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID")
# Check current version
if [ -f /data/config/www/nextcloud/version.php ]; then
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
@@ -21,15 +25,15 @@ function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4
if ! bashio::config.true "disable_updates"; then
bashio::log.green "Auto_updater set, checking for updates"
# Install new version
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/updater/updater.phar --no-interaction"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/updater/updater.phar --no-interaction"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
# Install additional versions
while [[ $(occ update:check 2>&1) == *"update available"* ]]; do
bashio::log.yellow "-----------------------------------------------------------------------"
bashio::log.yellow " new version available, updating. Please do not turn off your addon! "
bashio::log.yellow "-----------------------------------------------------------------------"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/updater/updater.phar --no-interaction"
sudo -u abc -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/updater/updater.phar --no-interaction"
sudo -u \#"$PUID" -s /bin/bash -c "php /data/config/www/nextcloud/occ upgrade"
done
# Reset permissions
/./etc/cont-init.d/01-folders.sh

View File

@@ -6,7 +6,9 @@
if [ -f /notinstalled ]; then exit 0; fi
# Specify launcher
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ"
PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID")
LAUNCHER="sudo -u \#"$PUID" php /data/config/www/nextcloud/occ"
if $LAUNCHER fulltextsearch:test &>/dev/null; then
echo "Full Text Search is already working"
@@ -28,7 +30,7 @@ if $LAUNCHER fulltextsearch:test &>/dev/null; then
$LAUNCHER app:install $app >/dev/null
$LAUNCHER app:enable $app >/dev/null
done
chown -R abc:abc $NEXTCLOUD_PATH/apps
chown -R "$PUID":"$PGID" $NEXTCLOUD_PATH/apps
if bashio::config.has_value 'elasticsearch_server'; then
HOST=$(bashio::config 'elasticsearch_server')

View File

@@ -5,7 +5,9 @@
if [ -f /notinstalled ]; then exit 0; fi
# Specify launcher
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ"
PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID")
LAUNCHER="sudo -u \#"$PUID" php /data/config/www/nextcloud/occ"
####################
# Initialization #