From 8d46d1adf9cd9920c403137e1fa93b27483cec72 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 9 Jan 2025 20:57:23 +0100 Subject: [PATCH 1/9] Bumped Alpine Version 3.20>3.21 All Alpine CT's using PHP: Bumped php from 8.3 to 8.4 --- CT-Build/Alpine.yaml | 2 +- CT-Files/freshrss/Configs/php.pkglist | 2 +- CT-Files/heimdall/Configs/php.pkglist | 2 +- CT-Files/nextcloud/Configs/php.pkglist | 2 +- Scripts/AlpinePHPTool.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 6dbae41..9402d72 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -1,6 +1,6 @@ image: distribution: "alpinelinux" - release: "3.20" + release: "3.21" source: downloader: alpinelinux-http diff --git a/CT-Files/freshrss/Configs/php.pkglist b/CT-Files/freshrss/Configs/php.pkglist index 0f504c2..5c438c4 100644 --- a/CT-Files/freshrss/Configs/php.pkglist +++ b/CT-Files/freshrss/Configs/php.pkglist @@ -1 +1 @@ -php83 php83-fpm php83-curl php83-gmp php83-intl php83-mbstring php83-xml php83-zip php83-ctype php83-dom php83-fileinfo php83-iconv php83-json php83-opcache php83-openssl php83-phar php83-session php83-simplexml php83-xmlreader php83-xmlwriter php83-xml php83-tokenizer php83-zlib php83-pdo_mysql \ No newline at end of file +php84 php84-fpm php84-curl php84-gmp php84-intl php84-mbstring php84-xml php84-zip php84-ctype php84-dom php84-fileinfo php84-iconv php84-json php84-opcache php84-openssl php84-phar php84-session php84-simplexml php84-xmlreader php84-xmlwriter php84-xml php84-tokenizer php84-zlib php84-pdo_mysql \ No newline at end of file diff --git a/CT-Files/heimdall/Configs/php.pkglist b/CT-Files/heimdall/Configs/php.pkglist index 0105a99..8f135e6 100644 --- a/CT-Files/heimdall/Configs/php.pkglist +++ b/CT-Files/heimdall/Configs/php.pkglist @@ -1 +1 @@ -php83 php83-ctype php83-curl php83-pdo_sqlite php83-mbstring php83-json php83-zip php83-xml php83-fpm php83-session php83-openssl php83-tokenizer php83-fileinfo php83-dom \ No newline at end of file +php84 php84-ctype php84-curl php84-pdo_sqlite php84-mbstring php84-json php84-zip php84-xml php84-fpm php84-session php84-openssl php84-tokenizer php84-fileinfo php84-dom \ No newline at end of file diff --git a/CT-Files/nextcloud/Configs/php.pkglist b/CT-Files/nextcloud/Configs/php.pkglist index 111edc3..185f088 100644 --- a/CT-Files/nextcloud/Configs/php.pkglist +++ b/CT-Files/nextcloud/Configs/php.pkglist @@ -1 +1 @@ -php83-pdo_mysql php83-pecl-imagick php83-cli php83-pecl-apcu php83-pecl-redis php83-fpm php83-cgi php83-common php83-mbstring php83-curl php83-gd php83-intl php83-soap php83-xml php83-zip php83-pear php83-session php83-posix php83-pdo php83-dom php83-simplexml php83-xmlreader php83-xmlwriter php83-opcache php83-pcntl php83-fileinfo php83-bcmath php83-gmp php83-sysvsem php83-exif php83-bz2 php83-sodium php83-ctype \ No newline at end of file +php84-pdo_mysql php84-pecl-imagick php84-cli php84-pecl-apcu php84-pecl-redis php84-fpm php84-cgi php84-common php84-mbstring php84-curl php84-gd php84-intl php84-soap php84-xml php84-zip php84-pear php84-session php84-posix php84-pdo php84-dom php84-simplexml php84-xmlreader php84-xmlwriter php84-opcache php84-pcntl php84-fileinfo php84-bcmath php84-gmp php84-sysvsem php84-exif php84-bz2 php84-sodium php84-ctype \ No newline at end of file diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index 1117eb2..7f7949f 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -13,7 +13,7 @@ self=$0 Configurations="nextcloud freshrss heimdall mailbackup" SupportedAlpineVersion=3.20 -NewPHPVer=83 +NewPHPVer=84 SkipAlpineRelCheck=false #Git configuration only used for Upgrades and Fresh mode -- 2.49.1 From b8859801acfc2f01a9ba3c7c6fe532955c2062e8 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 9 Jan 2025 21:58:15 +0100 Subject: [PATCH 2/9] Script AlpinePHPTool: Bumped supported Alpine version --- Scripts/AlpinePHPTool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index 7f7949f..fd9afa8 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -12,7 +12,7 @@ self=$0 Configurations="nextcloud freshrss heimdall mailbackup" -SupportedAlpineVersion=3.20 +SupportedAlpineVersion=3.21 NewPHPVer=84 SkipAlpineRelCheck=false -- 2.49.1 From bb07d31c83e7d9aa21491b024a6a515df85cb7f9 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 9 Jan 2025 23:12:18 +0100 Subject: [PATCH 3/9] Script: AlpinePHPTool.sh Refactored PHP packagelists to set the PHP version when running `AlpinePHPTool.sh` instead of having it set in the pkglist. This change will deprecate `AlpineUpdatePHPVer.sh` since only the `NewPHPVer` variable in `AlpinePHPTool.sh` needs to change the PHP version change --- CT-Files/freshrss/Configs/php.pkglist | 2 +- CT-Files/heimdall/Configs/php.pkglist | 2 +- CT-Files/nextcloud/Configs/php.pkglist | 2 +- Scripts/AlpinePHPTool.sh | 1 + Scripts/AlpineUpdatePHPVer.sh | 11 ----------- 5 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 Scripts/AlpineUpdatePHPVer.sh diff --git a/CT-Files/freshrss/Configs/php.pkglist b/CT-Files/freshrss/Configs/php.pkglist index 5c438c4..71c82da 100644 --- a/CT-Files/freshrss/Configs/php.pkglist +++ b/CT-Files/freshrss/Configs/php.pkglist @@ -1 +1 @@ -php84 php84-fpm php84-curl php84-gmp php84-intl php84-mbstring php84-xml php84-zip php84-ctype php84-dom php84-fileinfo php84-iconv php84-json php84-opcache php84-openssl php84-phar php84-session php84-simplexml php84-xmlreader php84-xmlwriter php84-xml php84-tokenizer php84-zlib php84-pdo_mysql \ No newline at end of file +phpPHPver phpPHPver-fpm phpPHPver-curl phpPHPver-gmp phpPHPver-intl phpPHPver-mbstring phpPHPver-xml phpPHPver-zip phpPHPver-ctype phpPHPver-dom phpPHPver-fileinfo phpPHPver-iconv phpPHPver-json phpPHPver-opcache phpPHPver-openssl phpPHPver-phar phpPHPver-session phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-xml phpPHPver-tokenizer phpPHPver-zlib phpPHPver-pdo_mysql \ No newline at end of file diff --git a/CT-Files/heimdall/Configs/php.pkglist b/CT-Files/heimdall/Configs/php.pkglist index 8f135e6..13e656d 100644 --- a/CT-Files/heimdall/Configs/php.pkglist +++ b/CT-Files/heimdall/Configs/php.pkglist @@ -1 +1 @@ -php84 php84-ctype php84-curl php84-pdo_sqlite php84-mbstring php84-json php84-zip php84-xml php84-fpm php84-session php84-openssl php84-tokenizer php84-fileinfo php84-dom \ No newline at end of file +phpPHPver phpPHPver-ctype phpPHPver-curl phpPHPver-pdo_sqlite phpPHPver-mbstring phpPHPver-json phpPHPver-zip phpPHPver-xml phpPHPver-fpm phpPHPver-session phpPHPver-openssl phpPHPver-tokenizer phpPHPver-fileinfo phpPHPver-dom \ No newline at end of file diff --git a/CT-Files/nextcloud/Configs/php.pkglist b/CT-Files/nextcloud/Configs/php.pkglist index 185f088..bdc493c 100644 --- a/CT-Files/nextcloud/Configs/php.pkglist +++ b/CT-Files/nextcloud/Configs/php.pkglist @@ -1 +1 @@ -php84-pdo_mysql php84-pecl-imagick php84-cli php84-pecl-apcu php84-pecl-redis php84-fpm php84-cgi php84-common php84-mbstring php84-curl php84-gd php84-intl php84-soap php84-xml php84-zip php84-pear php84-session php84-posix php84-pdo php84-dom php84-simplexml php84-xmlreader php84-xmlwriter php84-opcache php84-pcntl php84-fileinfo php84-bcmath php84-gmp php84-sysvsem php84-exif php84-bz2 php84-sodium php84-ctype \ No newline at end of file +phpPHPver-pdo_mysql phpPHPver-pecl-imagick phpPHPver-cli phpPHPver-pecl-apcu phpPHPver-pecl-redis phpPHPver-fpm phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-zip phpPHPver-pear phpPHPver-session phpPHPver-posix phpPHPver-pdo phpPHPver-dom phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-opcache phpPHPver-pcntl phpPHPver-fileinfo phpPHPver-bcmath phpPHPver-gmp phpPHPver-sysvsem phpPHPver-exif phpPHPver-bz2 phpPHPver-sodium phpPHPver-ctype \ No newline at end of file diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index fd9afa8..dd0fa3f 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -110,6 +110,7 @@ run_Purge() { #(re)install PHP packages run_Install() { + sed -i -e "s/phpPHPver/php$NewPHPVer/g" $configStore/php.pkglist cat $configStore/php.pkglist | xargs apk add #Configure Php-Fpm echo ";Placeholder" > /etc/php$NewPHPVer/php-fpm.d/www.conf diff --git a/Scripts/AlpineUpdatePHPVer.sh b/Scripts/AlpineUpdatePHPVer.sh deleted file mode 100644 index 17223e4..0000000 --- a/Scripts/AlpineUpdatePHPVer.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -#Vars - -#Goto ProjectRoot -cd "$( cd "$( dirname "$0" )" &> /dev/null && pwd )/.." - -read -p "Old PHP version (example 82 for 8.2): " OldPHPVer -read -p "New PHP version (example 83 for 8.3): " NewPHPVer - -sed -i -e "s/NewPHPVer=$OldPHPVer/NewPHPVer=$NewPHPVer/g" ./Scripts/AlpinePHPTool.sh -find ./CT-Files -name "php.pkglist" | xargs sed -i -e "s/php-fpm$OldPHPVer/php-fpm$NewPHPVer/g" -e "s/php$OldPHPVer/php$NewPHPVer/g" -- 2.49.1 From a647ab711bc7e065a71535feb53fc77f06adc60e Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 10 Jan 2025 19:30:45 +0100 Subject: [PATCH 4/9] Fixed CT's NodeRed (Missing setting) and Gitea (Broken updater) CT NodeRed: Fixed missing config file by adding 5sec wait time before ending pm2 on setup to generate it CT Gitea: moved from `gitea-auto-update` from to an basic sh script since it is broken on AlpineLinux --- CT-Build/Alpine.yaml | 3 ++- CT-Files/gitea/Configs/auto-update.ini | 10 ---------- CT-Files/gitea/Scripts/Init.sh | 20 ++++--------------- CT-Files/gitea/Scripts/PTKAppUpdate.sh | 2 +- CT-Files/gitea/Scripts/Update-Gitea.sh | 27 ++++++++++++++++++++++++++ CT-Files/nodered/Scripts/Init.sh | 1 + 6 files changed, 35 insertions(+), 28 deletions(-) delete mode 100644 CT-Files/gitea/Configs/auto-update.ini create mode 100644 CT-Files/gitea/Scripts/Update-Gitea.sh diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 9402d72..8586ca2 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -433,7 +433,8 @@ packages: #PKGS for Gitea - packages: - - py3-pip + - curl + - jq - xz - git - bash diff --git a/CT-Files/gitea/Configs/auto-update.ini b/CT-Files/gitea/Configs/auto-update.ini deleted file mode 100644 index ddf5e1c..0000000 --- a/CT-Files/gitea/Configs/auto-update.ini +++ /dev/null @@ -1,10 +0,0 @@ -[Gitea] -site=http://localhost:3000/api/v1/version -apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest -system=linux-amd64 -file=/usr/local/bin/gitea -tmpDir=/tmp/ -buildFromSource= -sourceDir= -logFile=/var/log/gitupdate.log - diff --git a/CT-Files/gitea/Scripts/Init.sh b/CT-Files/gitea/Scripts/Init.sh index ce913b6..e5f4756 100644 --- a/CT-Files/gitea/Scripts/Init.sh +++ b/CT-Files/gitea/Scripts/Init.sh @@ -1,12 +1,6 @@ #!/bin/ash -#Vars -apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest - -#install Update tool -pip install --break-system-packages gitea-auto-update - #Get latest gitea version info -giteaver=$(python3 -c "import requests; print (requests.get('$apiUrl').json()['tag_name'])") +giteaver=$(curl --retry 7 --retry-delay 5 -Ls https://api.github.com/repos/go-gitea/gitea/releases/latest |jq -r .tag_name) giteaver=${giteaver//v} @@ -23,12 +17,12 @@ mkdir -p /etc/gitea #Download Gitea binary echo "Downloading gitea binary..." -python3 -c "import requests; url = 'https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64'; r = requests.get(url, allow_redirects=True); open('/usr/local/bin/gitea', 'wb').write(r.content)" +curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64 -O /usr/local/bin/gitea #Moving configs in place mv /opt/Setup/Configs/app.ini /etc/gitea/app.ini -mv /opt/Setup/Configs/auto-update.ini /etc/gitea/auto-update.ini mv /opt/Setup/Configs/gitea.service /etc/init.d/gitea +mv /opt/Setup/Scripts/Update-Gitea.sh /opt/Update-Gitea.sh #Set folder permissions chown -R git:git /gitea-data @@ -39,10 +33,4 @@ chmod -R 750 /var/lib/gitea/ chmod +x /usr/local/bin/gitea chmod +x /etc/init.d/gitea chmod 750 /etc/gitea -chmod 640 /etc/gitea/app.ini - -#Fix Gitea-auto-updater to support OpenRC -sed -i -e 's/systemctl start gitea.service/service gitea start/' -e 's/systemctl stop gitea.service/service gitea stop/' /usr/lib/python3.*/site-packages/gitea_auto_update/update.py - -#Gitea update Sript -echo "gitea-auto-update --settings=/etc/gitea/auto-update.ini" > /opt/UpdateGitea.sh \ No newline at end of file +chmod 640 /etc/gitea/app.ini \ No newline at end of file diff --git a/CT-Files/gitea/Scripts/PTKAppUpdate.sh b/CT-Files/gitea/Scripts/PTKAppUpdate.sh index e7d1a20..46b746e 100644 --- a/CT-Files/gitea/Scripts/PTKAppUpdate.sh +++ b/CT-Files/gitea/Scripts/PTKAppUpdate.sh @@ -1,3 +1,3 @@ #!/bin/sh # Update script for updating apps with ProxmoxHelper/ProxMoxToolKit -ash /opt/UpdateGitea.sh \ No newline at end of file +ash /opt/Update-Gitea.sh \ No newline at end of file diff --git a/CT-Files/gitea/Scripts/Update-Gitea.sh b/CT-Files/gitea/Scripts/Update-Gitea.sh new file mode 100644 index 0000000..b59a96c --- /dev/null +++ b/CT-Files/gitea/Scripts/Update-Gitea.sh @@ -0,0 +1,27 @@ +#!/bin/ash +#Check if Gitea is running +case $(service gitea status) in + *started*);; + *) + echo "Gitea is not running, exiting" + exit ;; +esac + +#Check internet connection +if ! ping -c 2 api.github.com &> /dev/null; then echo "No internet connection detected, exiting";exit ;fi + +#Get latest vesion +NewGiteaVer=$(curl --retry 7 --retry-delay 5 -Ls https://api.github.com/repos/go-gitea/gitea/releases/latest |jq -r .tag_name) +CurGiteaVer=$(curl --retry 7 --retry-delay 5 -Ls http://localhost:3000/api/v1/version |jq -r .version) +#Compare versions to check for update +if [ "$NewGiteaVer" = "$CurGiteaVer" ] ; then + echo 'Gitea up-to-date' + exit +else +echo 'Updating Gitea' + service gitea stop + mv /usr/local/bin/gitea /usr/local/bin/gitea.old + curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"${NewGiteaVer//v}"/gitea-"${NewGiteaVer//v}"-linux-amd64 -o /usr/local/bin/gitea + chmod +x /usr/local/bin/gitea + service gitea start +fi \ No newline at end of file diff --git a/CT-Files/nodered/Scripts/Init.sh b/CT-Files/nodered/Scripts/Init.sh index 904f9d7..90a1f89 100644 --- a/CT-Files/nodered/Scripts/Init.sh +++ b/CT-Files/nodered/Scripts/Init.sh @@ -11,6 +11,7 @@ npm install --prefix /opt/node/node-red/app node-red @node-red-contrib-themes/th pm2 install pm2-logrotate pm2 start --name nodered --cwd /opt/node/node-red/app ./node_modules/node-red/red.js -- -u /opt/node/node-red/data pm2 save +sleep 5 pm2 kill #Enable node-red dark theme sed -i -e 's#//theme: "",#theme: "midnight-red",#g' /opt/node/node-red/data/settings.js -- 2.49.1 From 5c663faa0d4cdf14bbe0d88747574eb4910e94cd Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 16 Jan 2025 01:30:01 +0100 Subject: [PATCH 5/9] Fixed CTs: gitea,nextcloud,transfersh and updated the AlpinePHPTool CT: gitea Fixed broken curl command for downloading gitea CT: nextcloud Forced PHP Version to 8.3 using update AlpinePHPTool CT: transfersh Fixed custom theme by downloading the release tar.gz instead of cloneing the repo, it is now also added to the update script Script: AlpinePHPTool Added ability to specify a PHP Version --- .gitignore | 2 ++ .vscode/tasks.json | 10 ++++++++++ CT-Build/Alpine.yaml | 3 +-- CT-Files/gitea/Scripts/Init.sh | 2 +- CT-Files/nextcloud/Scripts/Init.sh | 2 +- CT-Files/transfersh/Scripts/Init.sh | 15 ++++++++++++--- CT-Files/transfersh/Scripts/update.sh | 24 ++++++++++++++++++++++-- Scripts/AlpinePHPTool.sh | 16 +++++++++------- 8 files changed, 58 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 8a29339..1c2dfaf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ *.tar *.zip *.sh.kate-swp +*.squashfs +*.qcow2 /distrobuilder /bin CT-Files/nginx/nginx_signing.rsa.pub diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 388533a..084fe59 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -14,6 +14,16 @@ "isDefault": true } }, + /* { + "label": "BuildVM", + "type": "shell", + "command": " export XZ_DEFAULTS='-T 0'; sudo ./distrobuilder build-incus CT-Build/${input:Distro}.yaml -o image.variant=${input:BuildVariant} --vm;sudo chown $SUDO_USER:$SUDO_USER -R *.tar.xz disk.qcow2 ;rm -f incus.tar.xz; mv -f disk.qcow2 bin/${input:Distro}-${input:BuildVariant}.qcow2", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + },*/ { "label": "SetupImgBuilder", "type": "shell", diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index 8586ca2..c1bc5e4 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -275,7 +275,6 @@ files: To setup this container run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh` variants: - nginx - - heimdall #PHP SetupScript - path: /opt/Setup/Scripts/PHPTool.sh @@ -453,7 +452,7 @@ packages: #PKGS for Transfersh - packages: - curl - - git + - jq action: install variants: - transfersh diff --git a/CT-Files/gitea/Scripts/Init.sh b/CT-Files/gitea/Scripts/Init.sh index e5f4756..a0d6701 100644 --- a/CT-Files/gitea/Scripts/Init.sh +++ b/CT-Files/gitea/Scripts/Init.sh @@ -17,7 +17,7 @@ mkdir -p /etc/gitea #Download Gitea binary echo "Downloading gitea binary..." -curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64 -O /usr/local/bin/gitea +curl --retry 7 --retry-delay 5 -L https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64 -o /usr/local/bin/gitea || exit 1 #Moving configs in place mv /opt/Setup/Configs/app.ini /etc/gitea/app.ini diff --git a/CT-Files/nextcloud/Scripts/Init.sh b/CT-Files/nextcloud/Scripts/Init.sh index 4ce65e0..778deff 100644 --- a/CT-Files/nextcloud/Scripts/Init.sh +++ b/CT-Files/nextcloud/Scripts/Init.sh @@ -7,7 +7,7 @@ rm -rf /etc/nginx/conf.d mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf #Setup PHP -ash /opt/Setup/Scripts/PHPTool.sh -d nextcloud || exit 1 +ash /opt/Setup/Scripts/PHPTool.sh -dv 83 nextcloud || exit 1 rm /opt/Setup/Scripts/PHPTool.sh diff --git a/CT-Files/transfersh/Scripts/Init.sh b/CT-Files/transfersh/Scripts/Init.sh index 6a9da8a..48a7dea 100644 --- a/CT-Files/transfersh/Scripts/Init.sh +++ b/CT-Files/transfersh/Scripts/Init.sh @@ -4,11 +4,15 @@ addgroup transfersh adduser -S -s /bin/ash -h /home/transfersh -D -G transfersh transfersh mkdir -p /opt/transfer.sh/CustomTheme #Get Resources -CurrentVersion=$(curl -s https://api.github.com/repos/dutchcoders/transfer.sh/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : ) +CurrentVersion=$(curl -s https://api.github.com/repos/dutchcoders/transfer.sh/releases/latest | jq -r .tag_name) +CurrentThemeVersion=$(curl -s https://git.bprieshof.nl/api/v1/repos/DarkTheme/brammp_transfer.sh-web/releases/latest |jq -r .tag_name) echo $CurrentVersion > /opt/transfer.sh/Version +echo $CurrentThemeVersion > /opt/transfer.sh/ThemeVersion curl -L --retry 7 --retry-delay 5 https://github.com/dutchcoders/transfer.sh/releases/download/"$CurrentVersion"/transfersh-"$CurrentVersion"-linux-amd64 -o /opt/transfer.sh/transfersh-linux-amd64 || exit 1 +curl -L --retry 7 --retry-delay 5 https://git.bprieshof.nl/DarkTheme/brammp_transfer.sh-web/releases/download/"$CurrentThemeVersion"/brammp_transfer.sh-web-"$CurrentThemeVersion".tar.gz -o /tmp/brammp_transfer.sh-web.tar.gz || exit 1 #Install transfer.sh custom theme -git clone https://git.bprieshof.nl/DarkTheme/brammp_transfer.sh-web.git /opt/transfer.sh/CustomTheme +tar -zxf /tmp/brammp_transfer.sh-web.tar.gz -C /opt/transfer.sh/CustomTheme +rm /tmp/brammp_transfer.sh-web.tar.gz #Configure transfer.sh mv /opt/Setup/Configs/transfersh.conf /opt/transfer.sh/transfersh.conf mv /opt/Setup/Configs/transfersh.service /etc/init.d/transfersh @@ -17,4 +21,9 @@ chmod +x /etc/init.d/transfersh chmod +x /opt/transfer.sh/transfersh-linux-amd64 chown -R transfersh:transfersh /opt/transfer.sh #Enable service -rc-update add transfersh \ No newline at end of file +rc-update add transfersh + + + + + diff --git a/CT-Files/transfersh/Scripts/update.sh b/CT-Files/transfersh/Scripts/update.sh index 219b0a3..8f37c44 100644 --- a/CT-Files/transfersh/Scripts/update.sh +++ b/CT-Files/transfersh/Scripts/update.sh @@ -1,5 +1,6 @@ #!/bin/ash -CurtransfershVersion=$(curl -s https://api.github.com/repos/dutchcoders/transfer.sh/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |tr -d : ) +CurtransfershVersion=$(curl -s https://api.github.com/repos/dutchcoders/transfer.sh/releases/latest | jq -r .tag_name) +CurtransfershThemeVersion=$(curl -s https://git.bprieshof.nl/api/v1/repos/DarkTheme/brammp_transfer.sh-web/releases/latest |jq -r .tag_name) if test "$CurtransfershVersion" = "$(cat /opt/transfer.sh/Version)" ; then echo 'Transfer.sh up-to-date' @@ -7,10 +8,29 @@ if test "$CurtransfershVersion" = "$(cat /opt/transfer.sh/Version)" ; then else echo 'Updating Transfer.sh' service transfersh stop + if [ -f "/opt/transfer.sh/transfersh-linux-amd64.old" ]; then rm /opt/transfer.sh/transfersh-linux-amd64.old ;fi mv /opt/transfer.sh/transfersh-linux-amd64 /opt/transfer.sh/transfersh-linux-amd64.old curl -L -o /opt/transfer.sh/transfersh-linux-amd64 https://github.com/dutchcoders/transfer.sh/releases/download/"$CurtransfershVersion"/transfersh-"$CurtransfershVersion"-linux-amd64 chmod +x /opt/transfer.sh/transfersh-linux-amd64 chown transfersh:transfersh /opt/transfer.sh/transfersh-linux-amd64 echo "$CurtransfershVersion" > /opt/transfer.sh/Version service transfersh start -fi \ No newline at end of file +fi + +if test "$CurtransfershThemeVersion" = "$(cat /opt/transfer.sh/ThemeVersion)" ; then + echo 'Custom theme for Transfer.sh up-to-date' + exit +else + echo 'Updating Custom theme for Transfer.sh' + service transfersh stop + if [ -d "/opt/transfer.sh/CustomTheme.old" ]; then rm -rf /opt/transfer.sh/CustomTheme.old ;fi + mv /opt/transfer.sh/CustomTheme /opt/transfer.sh/CustomTheme.old + curl -L --retry 7 --retry-delay 5 https://git.bprieshof.nl/DarkTheme/brammp_transfer.sh-web/releases/download/"$CurtransfershThemeVersion"/brammp_transfer.sh-web-"$CurtransfershThemeVersion".tar.gz -o /tmp/brammp_transfer.sh-web.tar.gz || exit 1 + tar -zxf /tmp/brammp_transfer.sh-web.tar.gz -C /opt/transfer.sh/CustomTheme + chown -R transfersh:transfersh /opt/transfer.sh/CustomTheme + rm /tmp/brammp_transfer.sh-web.tar.gz + echo "$CurtransfershThemeVersion" > /opt/transfer.sh/ThemeVersion + service transfersh start +fi + + diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index dd0fa3f..998ff6c 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -34,10 +34,11 @@ show_help () { Usage: $self [-dfpuh] Options: - -d, Distrobuilder: Install everything and use Local configs (non interactive) - -f, Fresh: Install everything and fetch config - -p, Purge: Remove all PHP packlages and back configuration (handy for distro release upgrades) - -u, Upgrade: Run both Purge and Install steps + -d, Distrobuilder: Install everything and use Local configs (non interactive) + -f, Fresh: Install everything and fetch config + -p, Purge: Remove all PHP packlages and back configuration (handy for distro release upgrades) + -u, Upgrade: Run both Purge and Install steps + -v , Set PHPVersion: specify the PHP version version (example 84 for 8.4) Cnfigurations: $Configurations @@ -55,13 +56,14 @@ echo_exit (){ exit 1 } -#Arugment/optin handeling -while getopts 'dfpuh' opt; do +#Arugment/option handeling +while getopts 'dfpuhv:' opt; do case $opt in d) set_mode distrobuilder;; f) set_mode fresh ;; p) set_mode purge ;; u) set_mode upgrade ;; + v) NewPHPVer="${OPTARG}" ;; h) show_help exit ;; *) show_help @@ -167,7 +169,7 @@ case $mode in ;; upgrade) #Set config location - configStore=/opt/Setup/Configs + configStore=/tmp fetch_Config service nginx stop run_Purge -- 2.49.1 From 1d661b3287efd3973dcff79e958afb2b774ba85d Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 16 Jan 2025 23:54:55 +0100 Subject: [PATCH 6/9] Fixes for AlpinePHPTool: *Added crontab configuration to the script for FreshRSS and Nextcloud CT's *Added ProxmoxUpdateScript configuration to the script for Nextcloud CT --- CT-Files/freshrss/Configs/crontab | 2 +- CT-Files/freshrss/Scripts/Init.sh | 3 -- CT-Files/nextcloud/Configs/crontab | 1 + CT-Files/nextcloud/Scripts/FirstRun.sh | 36 ++++++++++++---------- CT-Files/nextcloud/Scripts/Init.sh | 1 - CT-Files/nextcloud/Scripts/PTKAppUpdate.sh | 3 +- Scripts/AlpinePHPTool.sh | 28 ++++++++++++++++- 7 files changed, 50 insertions(+), 24 deletions(-) create mode 100644 CT-Files/nextcloud/Configs/crontab diff --git a/CT-Files/freshrss/Configs/crontab b/CT-Files/freshrss/Configs/crontab index 82536bf..054c013 100644 --- a/CT-Files/freshrss/Configs/crontab +++ b/CT-Files/freshrss/Configs/crontab @@ -1 +1 @@ -27,57 * * * * php83 /opt/freshrss/app/actualize_script.php 2>> /proc/1/fd/2 > /tmp/FreshRSS.log \ No newline at end of file +27,57 * * * * phpPHPver /opt/freshrss/app/actualize_script.php 2>> /proc/1/fd/2 > /tmp/FreshRSS.log \ No newline at end of file diff --git a/CT-Files/freshrss/Scripts/Init.sh b/CT-Files/freshrss/Scripts/Init.sh index b514855..313a74e 100644 --- a/CT-Files/freshrss/Scripts/Init.sh +++ b/CT-Files/freshrss/Scripts/Init.sh @@ -8,9 +8,6 @@ mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf ash /opt/Setup/Scripts/PHPTool.sh -d freshrss || exit 1 rm /opt/Setup/Scripts/PHPTool.sh -#Configure Cron -mv /opt/Setup/Configs/crontab /etc/crontabs/nginx - #Install freshrss mkdir -p /opt/freshrss wget https://github.com/FreshRSS/FreshRSS/tarball/latest -O /tmp/freshrss.tar.gz diff --git a/CT-Files/nextcloud/Configs/crontab b/CT-Files/nextcloud/Configs/crontab new file mode 100644 index 0000000..0edf28c --- /dev/null +++ b/CT-Files/nextcloud/Configs/crontab @@ -0,0 +1 @@ +*/5 * * * * phpPHPver -f /opt/nextcloud/cron.php > /dev/null 2>&1 \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/FirstRun.sh b/CT-Files/nextcloud/Scripts/FirstRun.sh index 1e069da..e290592 100644 --- a/CT-Files/nextcloud/Scripts/FirstRun.sh +++ b/CT-Files/nextcloud/Scripts/FirstRun.sh @@ -18,24 +18,26 @@ if [ $ThisScriptConfigured = no ]; then echo "Script is not configured" exit fi -sudo -u nginx php83 /opt/nextcloud/occ maintenance:install --database mysql --database-name "$MysqlDatabase" --database-host "$MysqlIP" --database-port "$MysqlPort" --database-user "$MysqlUsername" --database-pass "$MysqlPassword" --database-table-space "" --admin-user "$NextcloudUsername" --admin-pass "$NexcloudPassword" --data-dir /var/nextcloud +sudo -u nginx phpPHPver /opt/nextcloud/occ maintenance:install --database mysql --database-name "$MysqlDatabase" --database-host "$MysqlIP" --database-port "$MysqlPort" --database-user "$MysqlUsername" --database-pass "$MysqlPassword" --database-table-space "" --admin-user "$NextcloudUsername" --admin-pass "$NexcloudPassword" --data-dir /var/nextcloud sed -n -i '/#SetupBlockStart/{:a;N;/#SetupBlockEnd/!ba;N;s/.*//};p' /etc/nginx/nginx.conf service nginx reload -sudo -u nginx php83 /opt/nextcloud/occ db:convert-filecache-bigint -sudo -u nginx php83 /opt/nextcloud/occ db:add-missing-indices -#sudo -u nginx php83 /opt/nextcloud/occ app:disable firstrunwizard -sudo -u nginx php83 /opt/nextcloud/occ config:system:set default_language --value=nl -sudo -u nginx php83 /opt/nextcloud/occ config:system:set default_locale --value=nl -sudo -u nginx php83 /opt/nextcloud/occ config:system:set default_phone_region --value=nl -sudo -u nginx php83 /opt/nextcloud/occ config:system:set skeletondirectory --value= -sudo -u nginx php83 /opt/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\APCu' -sudo -u nginx php83 /opt/nextcloud/occ config:system:set trashbin_retention_obligation --value=30,30 -sudo -u nginx php83 /opt/nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis' -sudo -u nginx php83 /opt/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' -sudo -u nginx php83 /opt/nextcloud/occ config:system:set redis host --value=localhost -sudo -u nginx php83 /opt/nextcloud/occ config:system:set redis port --value=6379 -sudo -u nginx php83 /opt/nextcloud/occ config:system:set trusted_domains 1 --value="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" -sudo -u nginx php83 /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" -sudo -u nginx php83 /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto" \ No newline at end of file +sudo -u nginx phpPHPver /opt/nextcloud/occ db:convert-filecache-bigint +sudo -u nginx phpPHPver /opt/nextcloud/occ db:add-missing-indices +#sudo -u nginx phpPHPver /opt/nextcloud/occ app:disable firstrunwizard +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set default_language --value=nl +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set default_locale --value=nl +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set default_phone_region --value=nl +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set skeletondirectory --value= +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\APCu' +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set trashbin_retention_obligation --value=30,30 +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis' +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set redis host --value=localhost +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set redis port --value=6379 +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set trusted_domains 1 --value="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto" +sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set maintenance_window_start --type=integer --value=2 +sudo -u nginx phpPHPver /opt/nextcloud/occ occ maintenance:repair --include-expensive \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/Init.sh b/CT-Files/nextcloud/Scripts/Init.sh index 778deff..81de277 100644 --- a/CT-Files/nextcloud/Scripts/Init.sh +++ b/CT-Files/nextcloud/Scripts/Init.sh @@ -17,7 +17,6 @@ tar jxf /opt/Setup/nextcloud.tar.bz2 -C /opt/nextcloud --strip 1 rm -rf /opt/Setup/nextcloud.tar.bz2 chown -R nginx:nginx /opt/nextcloud chown -R nginx:nginx /var/nextcloud -echo "*/5 * * * * php83 -f /opt/nextcloud/cron.php > /dev/null 2>&1" >> /etc/crontabs/nginx #Enable services on boot rc-update add nginx rc-update add valkey \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/PTKAppUpdate.sh b/CT-Files/nextcloud/Scripts/PTKAppUpdate.sh index 34ba2b4..f829839 100644 --- a/CT-Files/nextcloud/Scripts/PTKAppUpdate.sh +++ b/CT-Files/nextcloud/Scripts/PTKAppUpdate.sh @@ -1,3 +1,4 @@ #!/bin/sh # Update script for updating apps with ProxmoxHelper/ProxMoxToolKit -sudo -u nginx php83 /opt/nextcloud/updater/updater.phar --no-interaction \ No newline at end of file +CurPHP=phpPHPver +sudo -u nginx $CurPHP /opt/nextcloud/updater/updater.phar --no-interaction \ No newline at end of file diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index 998ff6c..25a1951 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -101,6 +101,7 @@ run_Purge() { OldPHPVer=$(grep php /etc/apk/world -m 1|sed -e "s/\-.*//" -e "s/php//") #Create Backup an its location if [[ ! -d "/opt/PHPCfgBackup/" ]];then mkdir -p "/opt/PHPCfgBackup"; fi + if [[ -f /etc/crontabs/nginx ]]; then cp /etc/crontabs/nginx /opt/PHPCfgBackup/crontabs-nginx; fi tar -czf "/opt/PHPCfgBackup/PHP$OldPHPVer-Config.tar.gz" -C "/etc/php$OldPHPVer" ./ rm -rf "/etc/php$OldPHPVer" @@ -126,17 +127,36 @@ run_Install() { #Unique settings for configuration case $config in nextcloud) - echo runnig distrobuilder #Configure Php-Cli sed -i '/memory_limit =/c\memory_limit = 512M' /etc/php$NewPHPVer/php.ini echo "apc.enable_cli=1" >> /etc/php$NewPHPVer/php.ini + if [[ -f /opt/ProxMoxToolKitAppUpdate.sh ]]; then + sed -i "/CurPHP=/c\CurPHP=php$NewPHPVer" /opt/ProxMoxToolKitAppUpdate.sh + fi ;; esac + #Configure Cron + if test -f $configStore/crontab; then + sed -i -e 's/PHPver/'$NewPHPVer'/g' $configStore/crontab + mv $configStore/crontab /etc/crontabs/nginx + fi + #Enable service(s) on boot rc-update add php-fpm$NewPHPVer } +run_DistrobuilderOnly() { + #Do things only required when setting up using distrobuilder + ##Unique settings for configuration + case $config in + nextcloud) + sed -i -e "s/phpPHPver/php$NewPHPVer/g" /opt/Setup/Scripts/FirstRun.sh #Update FirstRun setup + sed -i -e "s/phpPHPver/php$NewPHPVer/g" /opt/Setup/Scripts/PTKAppUpdate.sh #Update nextcloud update script + ;; + esac +} + fetch_Config() { #Unique settings for configuration case $config in @@ -147,6 +167,11 @@ fetch_Config() { *) wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/$config/Configs/php.conf -O /tmp/php.conf || echo_exit "ERROR: Config download failed" wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/"$config"/Configs/php.pkglist -O /tmp/php.pkglist || echo_exit "ERROR: Config download failed" + #Check if crontab conf exists,if so get it + if wget -q --method=HEAD "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/$config/Configs/crontab; + then + wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/"$config"/Configs/crontab -O /tmp/crontab || echo_exit "ERROR: Config download failed" + fi ;; esac @@ -156,6 +181,7 @@ case $mode in distrobuilder) #Set config location configStore=/opt/Setup/Configs + run_DistrobuilderOnly run_Install ;; fresh) -- 2.49.1 From 41dea36a0bf8ba786fee4789172db288c0e038ad Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 17 Jan 2025 01:16:00 +0100 Subject: [PATCH 7/9] More fixes for AlpinePHPTool: * Fixed wget check if cronjob config exists * Enhanced check for current php installation * Changed way nginx config is updated, it wil now always overwrite the entire line --- Scripts/AlpinePHPTool.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index 25a1951..1f382ec 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -95,10 +95,10 @@ fi #Backup PHP config and purge PHP packages run_Purge() { - #Check if PHP is installed - if ! command -v php &> /dev/null; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi #Get current PHP Version OldPHPVer=$(grep php /etc/apk/world -m 1|sed -e "s/\-.*//" -e "s/php//") + #Check if PHP is installed + if ! command -v php$OldPHPVer &> /dev/null; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi #Create Backup an its location if [[ ! -d "/opt/PHPCfgBackup/" ]];then mkdir -p "/opt/PHPCfgBackup"; fi if [[ -f /etc/crontabs/nginx ]]; then cp /etc/crontabs/nginx /opt/PHPCfgBackup/crontabs-nginx; fi @@ -106,7 +106,7 @@ run_Purge() { rm -rf "/etc/php$OldPHPVer" #Set placeholder in Nginx for PHP Socket - sed -i -e 's/'$OldPHPVer'/PHPver/g' /etc/nginx/nginx.conf + sed -i "/fastcgi_pass unix:\/run\/php-/c\ \ fastcgi_pass unix:\/run\/php-fpmPHPver\/php-fpm.sock;" /etc/nginx/nginx.conf #Purge PHP packages apk del php* } @@ -122,7 +122,7 @@ run_Install() { printf "[Date]\ndate.timezone = Europe/Amsterdam" >/etc/php$NewPHPVer/conf.d/04_date_timezone.ini #Configure Nginx PHP Socket - sed -i -e 's/PHPver/'$NewPHPVer'/g' /etc/nginx/nginx.conf + sed -i "/fastcgi_pass unix:\/run\/php-/c\ \ fastcgi_pass unix:\/run\/php-fpm$NewPHPVer\/php-fpm.sock;" /etc/nginx/nginx.conf #Unique settings for configuration case $config in @@ -168,7 +168,7 @@ fetch_Config() { wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/$config/Configs/php.conf -O /tmp/php.conf || echo_exit "ERROR: Config download failed" wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/"$config"/Configs/php.pkglist -O /tmp/php.pkglist || echo_exit "ERROR: Config download failed" #Check if crontab conf exists,if so get it - if wget -q --method=HEAD "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/$config/Configs/crontab; + if wget -q --spider "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/$config/Configs/crontab 2>/dev/null; then wget "$gitRepo"/raw/branch/"$gitBranch"/CT-Files/"$config"/Configs/crontab -O /tmp/crontab || echo_exit "ERROR: Config download failed" fi -- 2.49.1 From 584d4e6ad354c4d73211d01a2061bbd9ee58538e Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 17 Jan 2025 19:10:37 +0100 Subject: [PATCH 8/9] More fixes for AlpinePHPTool, Fixes for CT Nextcloud: * Fixed not Stoping/Starting php-fpm services on upgrade and install * Fixed PHP detection by checking if php or php-fpm exists CT Nextcloud: added missing php-Phar package, fixed typo in FirstRun.sh --- CT-Files/nextcloud/Configs/php.pkglist | 2 +- CT-Files/nextcloud/Scripts/FirstRun.sh | 2 +- Scripts/AlpinePHPTool.sh | 23 +++++++++++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CT-Files/nextcloud/Configs/php.pkglist b/CT-Files/nextcloud/Configs/php.pkglist index bdc493c..0196a3c 100644 --- a/CT-Files/nextcloud/Configs/php.pkglist +++ b/CT-Files/nextcloud/Configs/php.pkglist @@ -1 +1 @@ -phpPHPver-pdo_mysql phpPHPver-pecl-imagick phpPHPver-cli phpPHPver-pecl-apcu phpPHPver-pecl-redis phpPHPver-fpm phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-zip phpPHPver-pear phpPHPver-session phpPHPver-posix phpPHPver-pdo phpPHPver-dom phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-opcache phpPHPver-pcntl phpPHPver-fileinfo phpPHPver-bcmath phpPHPver-gmp phpPHPver-sysvsem phpPHPver-exif phpPHPver-bz2 phpPHPver-sodium phpPHPver-ctype \ No newline at end of file +phpPHPver-pdo_mysql phpPHPver-pecl-imagick phpPHPver-cli phpPHPver-pecl-apcu phpPHPver-pecl-redis phpPHPver-fpm phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-zip phpPHPver-pear phpPHPver-session phpPHPver-posix phpPHPver-pdo phpPHPver-dom phpPHPver-simplexml phpPHPver-xmlreader phpPHPver-xmlwriter phpPHPver-opcache phpPHPver-pcntl phpPHPver-fileinfo phpPHPver-bcmath phpPHPver-gmp phpPHPver-sysvsem phpPHPver-exif phpPHPver-bz2 phpPHPver-sodium phpPHPver-ctype phpPHPver-phar \ No newline at end of file diff --git a/CT-Files/nextcloud/Scripts/FirstRun.sh b/CT-Files/nextcloud/Scripts/FirstRun.sh index e290592..52fddbc 100644 --- a/CT-Files/nextcloud/Scripts/FirstRun.sh +++ b/CT-Files/nextcloud/Scripts/FirstRun.sh @@ -40,4 +40,4 @@ sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set trusted_domains 1 - sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto" sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set maintenance_window_start --type=integer --value=2 -sudo -u nginx phpPHPver /opt/nextcloud/occ occ maintenance:repair --include-expensive \ No newline at end of file +sudo -u nginx phpPHPver /opt/nextcloud/occ maintenance:repair --include-expensive \ No newline at end of file diff --git a/Scripts/AlpinePHPTool.sh b/Scripts/AlpinePHPTool.sh index 1f382ec..b4903d8 100644 --- a/Scripts/AlpinePHPTool.sh +++ b/Scripts/AlpinePHPTool.sh @@ -98,17 +98,22 @@ run_Purge() { #Get current PHP Version OldPHPVer=$(grep php /etc/apk/world -m 1|sed -e "s/\-.*//" -e "s/php//") #Check if PHP is installed - if ! command -v php$OldPHPVer &> /dev/null; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi + PHPInstalled=false + if command -v php$OldPHPVer &> /dev/null; then PHPInstalled=true;fi + if command -v php-fpm$OldPHPVer &> /dev/null; then PHPInstalled=true;fi + if ! $PHPInstalled; then printf "ERROR: PHP is not installed\n\n"; exit 1;fi #Create Backup an its location if [[ ! -d "/opt/PHPCfgBackup/" ]];then mkdir -p "/opt/PHPCfgBackup"; fi if [[ -f /etc/crontabs/nginx ]]; then cp /etc/crontabs/nginx /opt/PHPCfgBackup/crontabs-nginx; fi + service php-fpm$OldPHPVer stop + rc-update del php-fpm$OldPHPVer tar -czf "/opt/PHPCfgBackup/PHP$OldPHPVer-Config.tar.gz" -C "/etc/php$OldPHPVer" ./ rm -rf "/etc/php$OldPHPVer" #Set placeholder in Nginx for PHP Socket sed -i "/fastcgi_pass unix:\/run\/php-/c\ \ fastcgi_pass unix:\/run\/php-fpmPHPver\/php-fpm.sock;" /etc/nginx/nginx.conf #Purge PHP packages - apk del php* + apk del "php*" } #(re)install PHP packages @@ -177,6 +182,11 @@ fetch_Config() { esac } +start_Services(){ + service php-fpm$NewPHPVer start + service nginx restart +} + case $mode in distrobuilder) #Set config location @@ -184,11 +194,12 @@ case $mode in run_DistrobuilderOnly run_Install ;; - fresh) - fetch_Config + fresh) #Set config location - configStore=/tmp + configStore=/tmp + fetch_Config run_Install + start_Services ;; purge) run_Purge @@ -200,6 +211,6 @@ case $mode in service nginx stop run_Purge run_Install - service nginx start + start_Services ;; esac \ No newline at end of file -- 2.49.1 From ea801f672f41eae7dfc3d1d9b9b8661079a5256f Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 17 Jan 2025 22:04:56 +0100 Subject: [PATCH 9/9] CT Nextcloud: tuning configuration --- CT-Files/nextcloud/Scripts/FirstRun.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CT-Files/nextcloud/Scripts/FirstRun.sh b/CT-Files/nextcloud/Scripts/FirstRun.sh index 52fddbc..6bbb175 100644 --- a/CT-Files/nextcloud/Scripts/FirstRun.sh +++ b/CT-Files/nextcloud/Scripts/FirstRun.sh @@ -40,4 +40,6 @@ sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set trusted_domains 1 - sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)" sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto" sudo -u nginx phpPHPver /opt/nextcloud/occ config:system:set maintenance_window_start --type=integer --value=2 +sudo -u nginx phpPHPver /opt/nextcloud/occ config:app:set settings profile_enabled_by_default --value="0" +sudo -u nginx phpPHPver /opt/nextcloud/occ background:cron sudo -u nginx phpPHPver /opt/nextcloud/occ maintenance:repair --include-expensive \ No newline at end of file -- 2.49.1