mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-09 14:42:01 -03:30
Merge pull request #1961 from nextcloud/fix/nc-update-allow-custom-version-request
allow custom version request in ncp-update-nc && php 8.3 support
This commit is contained in:
commit
41a0af623f
49
.github/workflows/build-lxd.yml
vendored
49
.github/workflows/build-lxd.yml
vendored
@ -348,8 +348,8 @@ jobs:
|
||||
VERSION: "${{ inputs.git_ref || github.ref }}"
|
||||
LXC: "${{ needs.determine-runner.outputs.lxc_cmd }}"
|
||||
LXD_EXTRA_PROFILE: "${{ needs.determine-runner.outputs.lxd_extra_profile }}"
|
||||
PREVIOUS_IMAGE_URL_ARM64: "https://github.com/nextcloud/nextcloudpi/releases/download/v1.53.2/NextcloudPi_LXD_arm64_v1.53.2.tar.gz"
|
||||
PREVIOUS_IMAGE_URL_AMD64: "https://github.com/nextcloud/nextcloudpi/releases/download/v1.53.2/NextcloudPi_LXD_x86_v1.53.2.tar.gz"
|
||||
PREVIOUS_IMAGE_URL_ARM64: "https://github.com/nextcloud/nextcloudpi/releases/download/v1.53.0/NextcloudPi_LXD_arm64_v1.53.0.tar.gz"
|
||||
PREVIOUS_IMAGE_URL_AMD64: "https://github.com/nextcloud/nextcloudpi/releases/download/v1.53.0/NextCloudPi_LXD_x86_v1.53.0.tar.gz"
|
||||
USE_INCUS: "${{ needs.determine-runner.outputs.lxc_cmd == 'incus' && 'yes' || 'no' }}"
|
||||
steps:
|
||||
- name: Setup incus
|
||||
@ -362,7 +362,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "${{ env.VERSION }}"
|
||||
ref: "v1.54.3"
|
||||
- name: Setup Firefox
|
||||
continue-on-error: true
|
||||
id: setup-firefox-browser-action
|
||||
@ -422,7 +422,7 @@ jobs:
|
||||
sudo "$LXC" exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
exit 1
|
||||
}
|
||||
python nextcloud_tests.py --no-gui --skip-release-check "nextcloudpi.local" 443 4443 || {
|
||||
python nextcloud_tests.py --skip-release-check --no-gui "nextcloudpi.local" 443 4443 || {
|
||||
echo "Nextcloud test failed!"
|
||||
echo "Geckodriver logs:"
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
@ -457,7 +457,11 @@ jobs:
|
||||
echo "Running update to ${VERSION}"
|
||||
|
||||
current_nc_version="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
|
||||
latest_nc_version="$(cat etc/ncp.cfg | jq -r '.nextcloud_version')"
|
||||
latest_nc_version="27.1.6"
|
||||
|
||||
sudo "$LXC" exec ncp -- apt-get update ||:
|
||||
sudo "$LXC" exec ncp -- apt-get install --no-install-recommends -y gnupg2
|
||||
sudo "$LXC" exec ncp -- apt-key adv --fetch-keys https://packages.sury.org/php/apt.gpg
|
||||
|
||||
sudo "$LXC" exec ncp -- bash -c "DBG=x ncp-update ${UPDATE_ARGS[*]}"
|
||||
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
|
||||
@ -467,6 +471,7 @@ jobs:
|
||||
echo "Nextcloud is up to date - skipping NC update test."
|
||||
else
|
||||
sudo "$LXC" exec ncp -- bash -c "DBG=x ncp-update-nc ${latest_nc_version?}"
|
||||
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
|
||||
fi
|
||||
|
||||
sudo "$LXC" exec ncp -- rm -f /opt/ncdata/data/nextcloud.log
|
||||
@ -506,6 +511,10 @@ jobs:
|
||||
echo "System test failed!"
|
||||
exit 1
|
||||
}
|
||||
- name: Checkout current version
|
||||
run: |
|
||||
git fetch origin
|
||||
git checkout "${{ env.VERSION }}"
|
||||
- name: NCP distupgrade
|
||||
id: distupgrade
|
||||
run: |
|
||||
@ -514,10 +523,38 @@ jobs:
|
||||
echo "can't upgrade from Debian $(sudo "$LXC" exec ncp -- cat /etc/os-release | grep VERSION_ID=)"
|
||||
exit 1
|
||||
}
|
||||
current_nc_version="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
|
||||
latest_nc_version="$(cat etc/ncp.cfg | jq -r '.nextcloud_version')"
|
||||
|
||||
sudo "$LXC" exec ncp -- bash -c "DEBIAN_FRONTEND=noninteractive ncp-dist-upgrade"
|
||||
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
|
||||
|
||||
if [[ "$current_nc_version" =~ "$latest_nc_version".* ]]
|
||||
then
|
||||
echo "Nextcloud is up to date - skipping NC update test."
|
||||
else
|
||||
|
||||
for i in {1..10};
|
||||
do
|
||||
echo "running nc update ($i/10)..."
|
||||
sudo "$LXC" exec ncp -- bash -c "DBG=x ncp-update-nc ${latest_nc_version?}"
|
||||
|
||||
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
|
||||
current_nc_version_new="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
|
||||
if [[ "$current_nc_version" =~ "$latest_nc_version".* ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
if [[ "$current_nc_version" == "$current_nc_version_new" ]]
|
||||
then
|
||||
echo "failed to update to $latest_nc_version"
|
||||
exit 1
|
||||
fi
|
||||
current_nc_version="$current_nc_version_new"
|
||||
done
|
||||
fi
|
||||
|
||||
sudo "$LXC" exec ncp -- rm -f /opt/ncdata/data/nextcloud.log
|
||||
|
||||
sudo "$LXC" stop ncp
|
||||
- name: Relaunch container
|
||||
run: |
|
||||
|
||||
6
.github/workflows/build-sd-images.yml
vendored
6
.github/workflows/build-sd-images.yml
vendored
@ -191,9 +191,9 @@ jobs:
|
||||
echo '[Service]' | sudo tee raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
|
||||
echo 'PrivateUsers=false' | sudo tee -a raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
|
||||
|
||||
sudo mkdir -p raspbian_root/etc/systemd/system/php8.1-fpm.service.d
|
||||
echo '[Service]' | sudo tee raspbian_root/etc/systemd/system/php8.1-fpm.service.d/ncp.conf
|
||||
echo 'ExecStartPre=mkdir -p /var/run/php' | sudo tee -a raspbian_root/etc/systemd/system/php8.1-fpm.service.d/ncp.conf
|
||||
sudo mkdir -p raspbian_root/etc/systemd/system/php8.2-fpm.service.d
|
||||
echo '[Service]' | sudo tee raspbian_root/etc/systemd/system/php8.2-fpm.service.d/ncp.conf
|
||||
echo 'ExecStartPre=mkdir -p /var/run/php' | sudo tee -a raspbian_root/etc/systemd/system/php8.2-fpm.service.d/ncp.conf
|
||||
- name: Test image
|
||||
id: test
|
||||
run: |
|
||||
|
||||
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@ -324,6 +324,12 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
|
||||
NC_VERSION="$(jq -r '.nextcloud_version' < etc/ncp.cfg)"
|
||||
PHP_VERSION="$(jq -r '.php_version' < etc/ncp.cfg)"
|
||||
DEBIAN_VERSION="$(jq -r '.release' < etc/ncp.cfg)"
|
||||
ARMBIAN_VERSIOn="$(cat build/armbian/armbian_version)"
|
||||
|
||||
subject="$(git tag -n10 --format="%(contents:subject)" "${{ env.VERSION }}")"
|
||||
body="$(git tag -n30 --format="%(contents:body)" "${{ env.VERSION }}")"
|
||||
separator="
|
||||
@ -334,6 +340,12 @@ jobs:
|
||||
|
||||
gh release create --draft -F - "${{ env.VERSION }}" <<EOF
|
||||
${subject:-No message found}
|
||||
|
||||
### Included Software
|
||||
Nextcloud ${NC_VERSION} (can be automatically updated to latest minor version)
|
||||
PHP ${PHP_VERSION}
|
||||
Debian ${DEBIAN_VERSION}
|
||||
Armbian ${ARMBIAN_VERSION}
|
||||
|
||||
${body:+${body}${separator}}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Please reach out in the [Matrix][chat-matrix-wiki] or [Telegram][chat-telegram-w
|
||||
|
||||
## Features
|
||||
|
||||
* Raspberry Pi OS/Debian 11 _(Bullseye)_
|
||||
* Raspberry Pi OS/Debian 12 _(Bookworm)_
|
||||
* Nextcloud
|
||||
* Apache, with HTTP2 enabled
|
||||
* PHP 8.1
|
||||
|
||||
@ -7,7 +7,7 @@ set -e
|
||||
source /usr/local/etc/library.sh # sets NCLATESTVER
|
||||
|
||||
CURRENT="$(nc_version)"
|
||||
NEXT_VERSION="$(determine_nc_upgrade_version "${CURRENT}" "${NCLATESTVER?}")"
|
||||
NEXT_VERSION="$(determine_nc_update_version "${CURRENT}" "${NCLATESTVER?}")"
|
||||
[[ -n "$NEXT_VERSION" ]] || exit 0
|
||||
|
||||
NOTIFIED=/var/run/.nc-version-notified
|
||||
|
||||
@ -19,303 +19,48 @@
|
||||
|
||||
set -eE${DBG}
|
||||
|
||||
VER="$1"
|
||||
BIN="${0##*/}"
|
||||
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
# pre-checks
|
||||
####################
|
||||
VER="$1"
|
||||
[[ "$VER" == "" ]] && { echo "Usage ${BIN} <version>"; exit 1; }
|
||||
[[ -f /.docker-image ]] && BASEDIR=/data || BASEDIR=/var/www
|
||||
cd "$BASEDIR"
|
||||
DATADIR="$( get_nc_config_value datadirectory )"
|
||||
ncc status &>/dev/null || { [[ "$DBG" == x ]] && ncc status; echo "Nextcloud is currently down"; exit 1; }
|
||||
[[ -d "${BASEDIR}/nextcloud-old" ]] && { echo "Nextcloud backup directory found. Interrupted or already running installation?"; exit 1; }
|
||||
[[ -d "${BASEDIR}/nextcloud" ]] || { echo "Nextcloud directory not found" ; exit 1; }
|
||||
[[ -d "$DATADIR" ]] || { echo "Nextcloud data directory not found" ; exit 1; }
|
||||
|
||||
# check version
|
||||
####################
|
||||
connect_to_nc_update() {
|
||||
tail -n 100 -f "/var/log/ncp-update-nc.log" &
|
||||
tail_pid=$!
|
||||
while [[ "$(systemctl is-active ncp-update-nc ||:)" =~ ^(active|activating|deactivating)$ ]]
|
||||
do
|
||||
sleep 3
|
||||
done
|
||||
|
||||
[[ ${EUID} -eq 0 ]] && SUDO="sudo -u www-data"
|
||||
CURRENT="$(nc_version)"
|
||||
TARGET_VERSION="$(determine_nc_upgrade_version "${CURRENT?}" "${VER?}")"
|
||||
[[ "$TARGET_VERSION" == "$CURRENT" ]] && {
|
||||
echo "Nextcloud version ${CURRENT} is already installed. Nothing to do."
|
||||
exit 0
|
||||
}
|
||||
[[ -n "$TARGET_VERSION" ]] || {
|
||||
echo "Could not find a valid upgrade path from '${CURRENT}' to '${TARGET_VERSION}'. Nothing to update."
|
||||
exit 1
|
||||
}
|
||||
|
||||
MAJOR_NEW="${TARGET_VERSION%%.*}"
|
||||
|
||||
if [[ "$MAJOR_NEW" -ge 24 ]] && [[ "$(lsb_release -r)" =~ .*10 ]]
|
||||
then
|
||||
echo -e "NCP doesn't support Nextcloud versions greater than 23 with Debian 10 (Buster). Please run ncp-dist-upgrade."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$MAJOR_NEW" -ge 29 ]] && [[ "$(lsb_release -r)" =~ .*12 ]]
|
||||
then
|
||||
echo -e "NCP doesn't support Nextcloud versions greater than 28 with Debian 11 (Bullseye). Please run ncp-dist-upgrade."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -qP "\d+\.\d+\.\d+" <<<"$CURRENT" || { echo "Malformed version $CURRENT"; exit 1; }
|
||||
grep -qP "\d+\.\d+\.\d+" <<<"$TARGET_VERSION" || { echo "Malformed version $TARGET_VERSION" ; exit 1; }
|
||||
|
||||
echo "Current Nextcloud version $CURRENT"
|
||||
echo "Available Nextcloud version $TARGET_VERSION"
|
||||
if [[ "$TARGET_VERSION" != "$VER" ]]
|
||||
then
|
||||
echo "INFO: You have requested an update to '$VER', but a direct update to '$VER' cannot be performed, so the latest available version that can be updated to has been selected automatically."
|
||||
fi
|
||||
|
||||
# make sure that cron.php is not running and there are no pending jobs
|
||||
# https://github.com/nextcloud/server/issues/10949
|
||||
pgrep -cf cron.php &>/dev/null && { pkill -f cron.php; sleep 3; }
|
||||
pgrep -cf cron.php &>/dev/null && { echo "cron.php running. Abort"; exit 1; }
|
||||
mysql nextcloud <<<"UPDATE ${DB_PREFIX}jobs SET reserved_at=0;"
|
||||
|
||||
# cleanup
|
||||
####################
|
||||
cleanup() {
|
||||
local RET=$?
|
||||
set +eE
|
||||
echo "Clean up..."
|
||||
rm -rf "$BASEDIR"/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old
|
||||
trap "" EXIT
|
||||
exit $RET
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# get new code
|
||||
####################
|
||||
URL="https://download.nextcloud.com/server/releases/nextcloud-$TARGET_VERSION.tar.bz2"
|
||||
echo "Download Nextcloud $TARGET_VERSION..."
|
||||
wget -q "$URL" -O nextcloud.tar.bz2 || { echo "Error downloading"; exit 1; }
|
||||
|
||||
# backup
|
||||
####################
|
||||
BKPDIR="$BASEDIR"
|
||||
WITH_DATA=no
|
||||
COMPRESSED=yes
|
||||
LIMIT=0
|
||||
|
||||
echo "Back up current instance..."
|
||||
set +eE
|
||||
ncp-backup "$BKPDIR" "$WITH_DATA" "$COMPRESSED" "$LIMIT" # && false # test point
|
||||
RET=$?
|
||||
sync
|
||||
set -eE
|
||||
|
||||
BKP_="$( ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -1 )"
|
||||
[[ -f "$BKP_" ]] || { set +eE; echo "Error backing up"; false || cleanup; }
|
||||
[[ $RET -ne 0 ]] && { rm -f "$BKP_"; set +eE; echo "Error backing up"; false || cleanup; }
|
||||
BKP="$( dirname "$BKP_" )/$( basename "$BKP_" .tar.gz )-${CURRENT}.tar.gz"
|
||||
echo "Storing backup at '$BKP'..."
|
||||
mv "$BKP_" "$BKP"
|
||||
|
||||
# simple restore if anything fails from here
|
||||
####################
|
||||
rollback_simple() {
|
||||
set +eE
|
||||
trap "" INT TERM HUP ERR
|
||||
echo -e "Abort\nSimple roll back..."
|
||||
rm -rf "$BASEDIR"/nextcloud
|
||||
mv "$BASEDIR"/nextcloud-old "$BASEDIR"/nextcloud
|
||||
false || cleanup # so cleanup exits with 1
|
||||
}
|
||||
trap rollback_simple INT TERM HUP ERR
|
||||
|
||||
# replace code
|
||||
####################
|
||||
echo "Install Nextcloud $TARGET_VERSION..."
|
||||
mv -T nextcloud nextcloud-old
|
||||
tar -xf nextcloud.tar.bz2 # && false # test point
|
||||
rm -rf /var/www/nextcloud.tar.bz2
|
||||
|
||||
# copy old config
|
||||
####################
|
||||
cp nextcloud-old/config/config.php nextcloud/config/
|
||||
|
||||
# copy old themes
|
||||
####################
|
||||
cp -raT nextcloud-old/themes/ nextcloud/themes/
|
||||
|
||||
# copy old NCP apps
|
||||
####################
|
||||
for app in nextcloudpi previewgenerator; do
|
||||
if [[ -d nextcloud-old/apps/"${app}" ]]; then
|
||||
cp -r -L nextcloud-old/apps/"${app}" /var/www/nextcloud/apps/
|
||||
kill "$tail_pid"
|
||||
if [[ "$(systemctl is-active ncp-update-nc ||:)" == "inactive" ]]
|
||||
then
|
||||
echo "Nextcloud update finished successfully."
|
||||
return 0
|
||||
elif [[ "$(systemctl is-active ncp-update-nc ||:)" == "failed" ]]
|
||||
then
|
||||
echo "Nextcloud update failed."
|
||||
return 1
|
||||
else
|
||||
echo "Nextcloud update was not found or failed (unexpected status: '$(systemctl is-active ncp-update-nc ||:)')"
|
||||
fi
|
||||
done
|
||||
|
||||
#false # test point
|
||||
|
||||
# copy data if it was at the default location
|
||||
####################
|
||||
if [[ "$DATADIR" == "/var/www/nextcloud/data" ]] || [[ "$DATADIR" == "/data/nextcloud/data" ]]; then
|
||||
echo "Restore data..."
|
||||
mv -T nextcloud-old/data nextcloud/data
|
||||
fi
|
||||
|
||||
# nc-restore if anything fails from here
|
||||
####################
|
||||
rollback() {
|
||||
set +eE
|
||||
trap "" INT TERM HUP ERR EXIT
|
||||
echo -e "Abort\nClean up..."
|
||||
rm -rf /var/www/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old
|
||||
echo "Rolling back to backup $BKP..."
|
||||
local TMPDATA
|
||||
mkdir -p "$BASEDIR/recovery/"
|
||||
TMPDATA="$( mktemp -d "$BASEDIR/recovery/ncp-data.XXXXXX" )" || { echo "Failed to create temp dir" >&2; exit 1; }
|
||||
[[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && mv -T "$DATADIR" "$TMPDATA"
|
||||
ncp-restore "$BKP" || { echo "Rollback failed! Data left at $TMPDATA"; exit 1; }
|
||||
[[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && { rm -rf "$DATADIR"; mv -T "$TMPDATA" "$DATADIR"; }
|
||||
rm "$BKP"
|
||||
echo "Rollback successful. Nothing was updated"
|
||||
exit 1
|
||||
}
|
||||
trap rollback INT TERM HUP ERR
|
||||
|
||||
# fix permissions
|
||||
####################
|
||||
echo "Fix permissions..."
|
||||
chown -R www-data:www-data nextcloud
|
||||
find nextcloud/ -type d -exec chmod 750 {} \;
|
||||
find nextcloud/ -type f -exec chmod 640 {} \;
|
||||
|
||||
# upgrade
|
||||
####################
|
||||
echo "Upgrade..."
|
||||
ncc='sudo -u www-data php nextcloud/occ'
|
||||
$ncc upgrade # && false # test point
|
||||
$ncc | grep -q db:add-missing-indices && $ncc db:add-missing-indices -n
|
||||
$ncc | grep -q db:add-missing-columns && $ncc db:add-missing-columns -n
|
||||
$ncc | grep -q db:add-missing-primary-keys && $ncc db:add-missing-primary-keys -n
|
||||
$ncc | grep -q db:convert-filecache-bigint && $ncc db:convert-filecache-bigint -n
|
||||
|
||||
# use the correct version for custom apps
|
||||
NCVER="$(nc_version)"
|
||||
if is_more_recent_than "21.0.0" "${NCVER}"; then
|
||||
NCPREV=/var/www/ncp-previewgenerator/ncp-previewgenerator-nc20
|
||||
else
|
||||
# Install notify_push if not installed
|
||||
if ! is_app_enabled notify_push; then
|
||||
ncc app:install notify_push
|
||||
ncc app:enable notify_push
|
||||
install_template nextcloud.conf.sh /etc/apache2/sites-available/nextcloud.conf
|
||||
a2enmod proxy proxy_http proxy_wstunnel
|
||||
apachectl -k graceful
|
||||
## make sure the notify_push daemon is runnnig
|
||||
|
||||
install_template systemd/notify_push.service.sh /etc/systemd/system/notify_push.service
|
||||
start_notify_push
|
||||
nc_domain="$(ncc config:system:get overwrite.cli.url)"
|
||||
set-nc-domain "${nc_domain}" || {
|
||||
echo "notify_push setup failed. You are probably behind a proxy"
|
||||
echo "Run 'ncc config:system:set trusted_proxies 15 --value=<proxy_IP>' and then 'ncc notify_push:setup https://<domain>/push to enable"
|
||||
echo "Check https://help.nextcloud.com/tags/ncp for support"
|
||||
}
|
||||
|
||||
fi
|
||||
NCPREV=/var/www/ncp-previewgenerator/ncp-previewgenerator-nc21
|
||||
fi
|
||||
rm -rf /var/www/nextcloud/apps/previewgenerator
|
||||
ln -snf "${NCPREV}" /var/www/nextcloud/apps/previewgenerator
|
||||
|
||||
if ! is_docker && ! is_more_recent_than "24.0.0" "${NCVER}" && is_more_recent_than "8.1.0" "${PHPVER}.0"
|
||||
if [[ "$(systemctl is-active ncp-update-nc ||:)" =~ ^(active|activating|deactivating)$ ]]
|
||||
then
|
||||
(
|
||||
echo "Upgrading PHP..."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
PHPVER_OLD="$PHPVER"
|
||||
PHPVER_NEW="8.1"
|
||||
PHP_PACKAGES_OLD=(php-{common,igbinary,redis,json} "php${PHPVER_OLD}" \
|
||||
"php${PHPVER_OLD}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,json,common,readline,mysql,bcmath,gmp})
|
||||
PHP_PACKAGES_NEW=("php${PHPVER_NEW}" \
|
||||
"php${PHPVER_NEW}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
|
||||
|
||||
php_restore() {
|
||||
trap "" INT TERM HUP ERR
|
||||
echo "Something went wrong while upgrading PHP. Rolling back to version ${PHPVER_OLD}..."
|
||||
set +e
|
||||
service "php${PHPVER_NEW}-fpm" stop
|
||||
a2disconf php${PHPVER_NEW}-fpm
|
||||
rm /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_NEW[@]}"
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_OLD[@]}"
|
||||
set_ncpcfg "php_version" "${PHPVER_OLD}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
run_app nc-limits
|
||||
a2enconf "php${PHPVER_OLD}-fpm"
|
||||
service "php${PHPVER_OLD}-fpm" start
|
||||
service apache2 restart
|
||||
echo "PHP upgrade has been successfully reverted"
|
||||
set -e
|
||||
}
|
||||
|
||||
trap php_restore INT TERM HUP ERR
|
||||
|
||||
# Setup apt repository for php 8
|
||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
echo "deb https://packages.sury.org/php/ ${RELEASE%-security} main" > /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
|
||||
clear_opcache
|
||||
|
||||
echo "Stopping apache and php-fpm..."
|
||||
service "php${PHPVER_OLD}-fpm" stop
|
||||
service apache2 stop
|
||||
|
||||
echo "Remove old PHP (${PHPVER_OLD})..."
|
||||
a2disconf "php${PHPVER_OLD}-fpm"
|
||||
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_OLD[@]}"
|
||||
|
||||
echo "Install PHP ${PHPVER_NEW}..."
|
||||
install_with_shadow_workaround --no-install-recommends systemd
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}"
|
||||
|
||||
set_ncpcfg "php_version" "${PHPVER_NEW}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
( set -e; export PHPVER="${PHPVER_NEW}"; run_app nc-limits )
|
||||
|
||||
a2enconf "php${PHPVER_NEW}-fpm"
|
||||
|
||||
echo "Starting apache and php-fpm..."
|
||||
service "php${PHPVER_NEW}-fpm" start
|
||||
service apache2 start
|
||||
ncc status
|
||||
)
|
||||
|
||||
# Reload library.sh to reset PHPVER
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
echo "Existing ncp-update-nc process detected. Connecting..."
|
||||
connect_to_nc_update
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# refresh completions
|
||||
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
|
||||
systemctl reset-failed ncp-encrypt ||:
|
||||
systemd-run -u 'ncp-update-nc' bash -c "DBG='${DBG:-}' /usr/local/bin/ncp-update-nc.d/update-nc.sh '${VER}' |& tee /var/log/ncp-update-nc.log"
|
||||
sleep 5
|
||||
|
||||
is_docker && {
|
||||
killall notify_push
|
||||
sleep 1
|
||||
start_notify_push
|
||||
}
|
||||
if ! [[ "$(systemctl is-active ncp-update-nc ||:)" =~ ^(active|inactive|activating|deactivating)$ ]]
|
||||
then
|
||||
echo "Failed to start ncp-update-nc"
|
||||
[[ -f /var/log/ncp-update-nc.log ]] && cat /var/log/ncp-update-nc.log
|
||||
systemctl status --no-pager ncp-update-nc ||:
|
||||
fi
|
||||
|
||||
echo "Update completed successfully."
|
||||
# done
|
||||
####################
|
||||
mkdir -p "$DATADIR"/ncp-update-backups
|
||||
mv "$BKP" "$DATADIR"/ncp-update-backups
|
||||
chown -R www-data:www-data "$DATADIR"/ncp-update-backups
|
||||
BKP="$DATADIR"/ncp-update-backups/"$( basename "$BKP" )"
|
||||
echo "Backup stored at $BKP"
|
||||
|
||||
bash -c "sleep 5; source /usr/local/etc/library.sh; clear_opcache;" &>/dev/null &
|
||||
connect_to_nc_update
|
||||
|
||||
248
bin/ncp-update-nc.d/update-nc.sh
Executable file
248
bin/ncp-update-nc.d/update-nc.sh
Executable file
@ -0,0 +1,248 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eE${DBG}
|
||||
|
||||
VER="$1"
|
||||
source /usr/local/etc/library.sh
|
||||
export RELEASE
|
||||
export PHPVER
|
||||
|
||||
# pre-checks
|
||||
####################
|
||||
BASEDIR=/var/www
|
||||
cd "$BASEDIR"
|
||||
DATADIR="$( get_nc_config_value datadirectory )"
|
||||
ncc status &>/dev/null || { [[ "$DBG" == x ]] && ncc status; echo "Nextcloud is currently down"; exit 1; }
|
||||
[[ -d "${BASEDIR}/nextcloud-old" ]] && { echo "Nextcloud backup directory found. Interrupted or already running installation?"; exit 1; }
|
||||
[[ -d "${BASEDIR}/nextcloud" ]] || { echo "Nextcloud directory not found" ; exit 1; }
|
||||
[[ -d "$DATADIR" ]] || { echo "Nextcloud data directory not found" ; exit 1; }
|
||||
|
||||
# check version
|
||||
####################
|
||||
|
||||
[[ ${EUID} -eq 0 ]] && SUDO="sudo -u www-data"
|
||||
CURRENT="$(nc_version)"
|
||||
if [[ "$VER" == "0" ]] || [[ "$VER" == "" ]]
|
||||
then
|
||||
REQUESTED_VERSION="${NCLATESTVER?}"
|
||||
else
|
||||
REQUESTED_VERSION="$VER"
|
||||
fi
|
||||
TARGET_VERSION="$(determine_nc_update_version "${CURRENT?}" "${NCLATESTVER}" "${REQUESTED_VERSION}")"
|
||||
[[ "$TARGET_VERSION" == "$CURRENT" ]] && {
|
||||
echo "Nextcloud version ${CURRENT} is already installed. Nothing to do."
|
||||
exit 0
|
||||
}
|
||||
[[ -n "$TARGET_VERSION" ]] || {
|
||||
echo "Could not find a valid upgrade path from '${CURRENT}' to '${TARGET_VERSION}'. Nothing to update."
|
||||
exit 1
|
||||
}
|
||||
|
||||
MAJOR_NEW="${TARGET_VERSION%%.*}"
|
||||
DEBIAN_VERSION="$(. /etc/os-release; echo "$VERSION_ID")"
|
||||
|
||||
if [[ "$MAJOR_NEW" -ge 24 ]] && [[ $DEBIAN_VERSION -le 10 ]]
|
||||
then
|
||||
echo -e "NCP doesn't support Nextcloud versions greater than 23 with Debian 10 (Buster). Please run ncp-dist-upgrade."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$MAJOR_NEW" -ge 29 ]] && [[ $DEBIAN_VERSION -le 11 ]]
|
||||
then
|
||||
echo -e "NCP doesn't support Nextcloud versions greater than 28 with Debian 11 (Bullseye). Please run ncp-dist-upgrade."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -qP "\d+\.\d+\.\d+" <<<"$CURRENT" || { echo "Malformed version $CURRENT"; exit 1; }
|
||||
grep -qP "\d+\.\d+\.\d+" <<<"$TARGET_VERSION" || { echo "Malformed version $TARGET_VERSION" ; exit 1; }
|
||||
|
||||
echo "Current Nextcloud version $CURRENT"
|
||||
echo "Available Nextcloud version $TARGET_VERSION"
|
||||
if [[ "$TARGET_VERSION" != "$REQUESTED_VERSION" ]]
|
||||
then
|
||||
echo "INFO: You have requested an update to '${REQUESTED_VERSION}', but a direct update to '${REQUESTED_VERSION}' cannot be performed, so the latest available version that can be updated to has been selected automatically."
|
||||
fi
|
||||
|
||||
# make sure that cron.php is not running and there are no pending jobs
|
||||
# https://github.com/nextcloud/server/issues/10949
|
||||
pgrep -cf cron.php &>/dev/null && { pkill -f cron.php; sleep 3; }
|
||||
pgrep -cf cron.php &>/dev/null && { echo "cron.php running. Abort"; exit 1; }
|
||||
mysql nextcloud <<<"UPDATE ${DB_PREFIX}jobs SET reserved_at=0;"
|
||||
|
||||
# cleanup
|
||||
####################
|
||||
cleanup() {
|
||||
local RET=$?
|
||||
set +eE
|
||||
echo "Clean up..."
|
||||
rm -rf "$BASEDIR"/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old
|
||||
trap "" EXIT
|
||||
exit $RET
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# get new code
|
||||
####################
|
||||
URL="https://download.nextcloud.com/server/releases/nextcloud-$TARGET_VERSION.tar.bz2"
|
||||
echo "Download Nextcloud $TARGET_VERSION..."
|
||||
wget -q "$URL" -O nextcloud.tar.bz2 || { echo "Error downloading"; exit 1; }
|
||||
|
||||
# backup
|
||||
####################
|
||||
BKPDIR="$BASEDIR"
|
||||
WITH_DATA=no
|
||||
COMPRESSED=yes
|
||||
LIMIT=0
|
||||
|
||||
echo "Back up current instance..."
|
||||
set +eE
|
||||
ncp-backup "$BKPDIR" "$WITH_DATA" "$COMPRESSED" "$LIMIT" # && false # test point
|
||||
RET=$?
|
||||
sync
|
||||
set -eE
|
||||
|
||||
BKP_="$( ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -1 )"
|
||||
[[ -f "$BKP_" ]] || { set +eE; echo "Error backing up"; false || cleanup; }
|
||||
[[ $RET -ne 0 ]] && { rm -f "$BKP_"; set +eE; echo "Error backing up"; false || cleanup; }
|
||||
BKP="$( dirname "$BKP_" )/$( basename "$BKP_" .tar.gz )-${CURRENT}.tar.gz"
|
||||
echo "Storing backup at '$BKP'..."
|
||||
mv "$BKP_" "$BKP"
|
||||
|
||||
# simple restore if anything fails from here
|
||||
####################
|
||||
rollback_simple() {
|
||||
set +eE
|
||||
trap "" INT TERM HUP ERR
|
||||
echo -e "Abort\nSimple roll back..."
|
||||
rm -rf "$BASEDIR"/nextcloud
|
||||
mv "$BASEDIR"/nextcloud-old "$BASEDIR"/nextcloud
|
||||
false || cleanup # so cleanup exits with 1
|
||||
}
|
||||
trap rollback_simple INT TERM HUP ERR
|
||||
|
||||
# replace code
|
||||
####################
|
||||
echo "Install Nextcloud $TARGET_VERSION..."
|
||||
mv -T nextcloud nextcloud-old
|
||||
tar -xf nextcloud.tar.bz2 # && false # test point
|
||||
rm -rf /var/www/nextcloud.tar.bz2
|
||||
|
||||
# copy old config
|
||||
####################
|
||||
cp nextcloud-old/config/config.php nextcloud/config/
|
||||
|
||||
# copy old themes
|
||||
####################
|
||||
cp -raT nextcloud-old/themes/ nextcloud/themes/
|
||||
|
||||
# copy old NCP apps
|
||||
####################
|
||||
for app in nextcloudpi previewgenerator; do
|
||||
if [[ -d nextcloud-old/apps/"${app}" ]]; then
|
||||
cp -r -L nextcloud-old/apps/"${app}" /var/www/nextcloud/apps/
|
||||
fi
|
||||
done
|
||||
|
||||
#false # test point
|
||||
|
||||
# copy data if it was at the default location
|
||||
####################
|
||||
if [[ "$DATADIR" == "/var/www/nextcloud/data" ]] || [[ "$DATADIR" == "/data/nextcloud/data" ]]; then
|
||||
echo "Restore data..."
|
||||
mv -T nextcloud-old/data nextcloud/data
|
||||
fi
|
||||
|
||||
# nc-restore if anything fails from here
|
||||
####################
|
||||
rollback() {
|
||||
set +eE
|
||||
trap "" INT TERM HUP ERR EXIT
|
||||
echo -e "Abort\nClean up..."
|
||||
rm -rf /var/www/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old
|
||||
echo "Rolling back to backup $BKP..."
|
||||
local TMPDATA
|
||||
mkdir -p "$BASEDIR/recovery/"
|
||||
TMPDATA="$( mktemp -d "$BASEDIR/recovery/ncp-data.XXXXXX" )" || { echo "Failed to create temp dir" >&2; exit 1; }
|
||||
[[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && mv -T "$DATADIR" "$TMPDATA"
|
||||
ncp-restore "$BKP" || { echo "Rollback failed! Data left at $TMPDATA"; exit 1; }
|
||||
[[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && { rm -rf "$DATADIR"; mv -T "$TMPDATA" "$DATADIR"; }
|
||||
rm "$BKP"
|
||||
echo "Rollback successful. Nothing was updated"
|
||||
exit 1
|
||||
}
|
||||
trap rollback INT TERM HUP ERR
|
||||
|
||||
# fix permissions
|
||||
####################
|
||||
echo "Fix permissions..."
|
||||
chown -R www-data:www-data nextcloud
|
||||
find nextcloud/ -type d -exec chmod 750 {} \;
|
||||
find nextcloud/ -type f -exec chmod 640 {} \;
|
||||
|
||||
# upgrade
|
||||
####################
|
||||
echo "Upgrade..."
|
||||
ncc='sudo -u www-data php nextcloud/occ'
|
||||
$ncc upgrade # && false # test point
|
||||
$ncc | grep -q db:add-missing-indices && $ncc db:add-missing-indices -n
|
||||
$ncc | grep -q db:add-missing-columns && $ncc db:add-missing-columns -n
|
||||
$ncc | grep -q db:add-missing-primary-keys && $ncc db:add-missing-primary-keys -n
|
||||
$ncc | grep -q db:convert-filecache-bigint && $ncc db:convert-filecache-bigint -n
|
||||
$ncc maintenance:repair --help | grep -q -e '--include-expensive' && $ncc maintenance:repair --include-expensive
|
||||
|
||||
# use the correct version for custom apps
|
||||
NCVER="$(nc_version)"
|
||||
if is_more_recent_than "21.0.0" "${NCVER}"; then
|
||||
NCPREV=/var/www/ncp-previewgenerator/ncp-previewgenerator-nc20
|
||||
else
|
||||
# Install notify_push if not installed
|
||||
if ! is_app_enabled notify_push; then
|
||||
ncc app:install notify_push
|
||||
ncc app:enable notify_push
|
||||
install_template nextcloud.conf.sh /etc/apache2/sites-available/nextcloud.conf
|
||||
a2enmod proxy proxy_http proxy_wstunnel
|
||||
apachectl -k graceful
|
||||
## make sure the notify_push daemon is runnnig
|
||||
|
||||
install_template systemd/notify_push.service.sh /etc/systemd/system/notify_push.service
|
||||
start_notify_push
|
||||
nc_domain="$(ncc config:system:get overwrite.cli.url)"
|
||||
set-nc-domain "${nc_domain}" || {
|
||||
echo "notify_push setup failed. You are probably behind a proxy"
|
||||
echo "Run 'ncc config:system:set trusted_proxies 15 --value=<proxy_IP>' and then 'ncc notify_push:setup https://<domain>/push to enable"
|
||||
echo "Check https://help.nextcloud.com/tags/ncp for support"
|
||||
}
|
||||
|
||||
fi
|
||||
NCPREV=/var/www/ncp-previewgenerator/ncp-previewgenerator-nc21
|
||||
fi
|
||||
rm -rf /var/www/nextcloud/apps/previewgenerator
|
||||
ln -snf "${NCPREV}" /var/www/nextcloud/apps/previewgenerator
|
||||
|
||||
if ! is_more_recent_than "24.0.0" "${NCVER}" && is_more_recent_than "8.1.0" "${PHPVER}.0"
|
||||
then
|
||||
/usr/local/bin/ncp-update-nc.d/upgrade-php-bullseye-8.1.sh
|
||||
|
||||
# Reload library.sh to reset PHPVER
|
||||
source /usr/local/etc/library.sh
|
||||
elif ! is_more_recent_than "29.0.0" "${NCVER}" && is_more_recent_than "8.3.0" "${PHPVER}.0" && [[ "$DEBIAN_VERSION" -ge 12 ]]
|
||||
then
|
||||
/usr/local/bin/ncp-update-nc.d/upgrade-php-bookworm-8.3.sh
|
||||
|
||||
# Reload library.sh to reset PHPVER
|
||||
source /usr/local/etc/library.sh
|
||||
fi
|
||||
|
||||
# refresh completions
|
||||
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
|
||||
|
||||
echo "Update completed successfully."
|
||||
# done
|
||||
####################
|
||||
mkdir -p "$DATADIR"/ncp-update-backups
|
||||
mv "$BKP" "$DATADIR"/ncp-update-backups
|
||||
chown -R www-data:www-data "$DATADIR"/ncp-update-backups
|
||||
BKP="$DATADIR"/ncp-update-backups/"$( basename "$BKP" )"
|
||||
echo "Backup stored at $BKP"
|
||||
|
||||
bash -c "sleep 5; source /usr/local/etc/library.sh; clear_opcache;" &>/dev/null &
|
||||
68
bin/ncp-update-nc.d/upgrade-php-bookworm-8.3.sh
Executable file
68
bin/ncp-update-nc.d/upgrade-php-bookworm-8.3.sh
Executable file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
echo "Upgrading PHP..."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
PHPVER_OLD="$PHPVER"
|
||||
PHPVER_NEW="8.3"
|
||||
PHP_PACKAGES_OLD=("php${PHPVER_OLD}" \
|
||||
"php${PHPVER_OLD}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
|
||||
PHP_PACKAGES_NEW=("php${PHPVER_NEW}" \
|
||||
"php${PHPVER_NEW}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
|
||||
|
||||
php_restore() {
|
||||
trap "" INT TERM HUP ERR
|
||||
echo "Something went wrong while upgrading PHP. Rolling back to version ${PHPVER_OLD}..."
|
||||
set +e
|
||||
service "php${PHPVER_NEW}-fpm" stop
|
||||
a2disconf php${PHPVER_NEW}-fpm
|
||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
echo "deb https://packages.sury.org/php/ ${RELEASE%-security} main" > /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_NEW[@]}"
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_OLD[@]}"
|
||||
set_ncpcfg "php_version" "${PHPVER_OLD}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
run_app nc-limits
|
||||
a2enconf "php${PHPVER_OLD}-fpm"
|
||||
service "php${PHPVER_OLD}-fpm" start
|
||||
service apache2 restart
|
||||
echo "PHP upgrade has been successfully reverted"
|
||||
set -e
|
||||
}
|
||||
|
||||
trap php_restore INT TERM HUP ERR
|
||||
|
||||
apt-get update
|
||||
|
||||
clear_opcache
|
||||
|
||||
echo "Stopping apache and php-fpm..."
|
||||
service "php${PHPVER_OLD}-fpm" stop
|
||||
service apache2 stop
|
||||
|
||||
echo "Remove old PHP (${PHPVER_OLD})..."
|
||||
a2disconf "php${PHPVER_OLD}-fpm"
|
||||
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_OLD[@]}"
|
||||
|
||||
echo "Install PHP ${PHPVER_NEW}..."
|
||||
install_with_shadow_workaround --no-install-recommends systemd
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}"
|
||||
|
||||
set_ncpcfg "php_version" "${PHPVER_NEW}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
( set -e; export PHPVER="${PHPVER_NEW}"; run_app nc-limits )
|
||||
|
||||
a2enconf "php${PHPVER_NEW}-fpm"
|
||||
|
||||
[[ -f "/etc/systemd/system/php${PHPVER_OLD}-fpm.service.d/ncp.conf" ]] && {
|
||||
mkdir -p "/etc/systemd/system/php${PHPVER_NEW}-fpm.service.d"
|
||||
cp "/etc/systemd/system/php${PHPVER_OLD}-fpm.service.d/ncp.conf" "/etc/systemd/system/php${PHPVER_NEW}-fpm.service.d/ncp.conf"
|
||||
}
|
||||
|
||||
echo "Starting apache and php-fpm..."
|
||||
service "php${PHPVER_NEW}-fpm" start
|
||||
service apache2 start
|
||||
ncc status
|
||||
65
bin/ncp-update-nc.d/upgrade-php-bullseye-8.1.sh
Executable file
65
bin/ncp-update-nc.d/upgrade-php-bullseye-8.1.sh
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
echo "Upgrading PHP..."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
PHPVER_OLD="$PHPVER"
|
||||
PHPVER_NEW="8.1"
|
||||
PHP_PACKAGES_OLD=(php-{common,igbinary,redis,json} "php${PHPVER_OLD}" \
|
||||
"php${PHPVER_OLD}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,json,common,readline,mysql,bcmath,gmp})
|
||||
PHP_PACKAGES_NEW=("php${PHPVER_NEW}" \
|
||||
"php${PHPVER_NEW}"-{curl,gd,fpm,cli,opcache,mbstring,xml,zip,fileinfo,ldap,intl,bz2,mysql,bcmath,gmp,redis,common})
|
||||
|
||||
php_restore() {
|
||||
trap "" INT TERM HUP ERR
|
||||
echo "Something went wrong while upgrading PHP. Rolling back to version ${PHPVER_OLD}..."
|
||||
set +e
|
||||
service "php${PHPVER_NEW}-fpm" stop
|
||||
a2disconf php${PHPVER_NEW}-fpm
|
||||
rm /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_NEW[@]}"
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_OLD[@]}"
|
||||
set_ncpcfg "php_version" "${PHPVER_OLD}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
run_app nc-limits
|
||||
a2enconf "php${PHPVER_OLD}-fpm"
|
||||
service "php${PHPVER_OLD}-fpm" start
|
||||
service apache2 restart
|
||||
echo "PHP upgrade has been successfully reverted"
|
||||
set -e
|
||||
}
|
||||
|
||||
trap php_restore INT TERM HUP ERR
|
||||
|
||||
# Setup apt repository for php 8
|
||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||
echo "deb https://packages.sury.org/php/ ${RELEASE%-security} main" > /etc/apt/sources.list.d/php.list
|
||||
apt-get update
|
||||
|
||||
clear_opcache
|
||||
|
||||
echo "Stopping apache and php-fpm..."
|
||||
service "php${PHPVER_OLD}-fpm" stop
|
||||
service apache2 stop
|
||||
|
||||
echo "Remove old PHP (${PHPVER_OLD})..."
|
||||
a2disconf "php${PHPVER_OLD}-fpm"
|
||||
|
||||
apt-get remove --purge -y "${PHP_PACKAGES_OLD[@]}"
|
||||
|
||||
echo "Install PHP ${PHPVER_NEW}..."
|
||||
install_with_shadow_workaround --no-install-recommends systemd
|
||||
apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}"
|
||||
|
||||
set_ncpcfg "php_version" "${PHPVER_NEW}"
|
||||
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER_NEW}/mods-available/opcache.ini"
|
||||
( set -e; export PHPVER="${PHPVER_NEW}"; run_app nc-limits )
|
||||
|
||||
a2enconf "php${PHPVER_NEW}-fpm"
|
||||
|
||||
echo "Starting apache and php-fpm..."
|
||||
service "php${PHPVER_NEW}-fpm" start
|
||||
service apache2 start
|
||||
ncc status
|
||||
@ -127,11 +127,11 @@ EOF
|
||||
}
|
||||
|
||||
mysql nextcloud <<EOF
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'name' , "NextCloudPi" , 2, null);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'slogan' , "keep your data close" , 2, null);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'url' , "https://nextcloudpi.com" , 2, null);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'logoMime' , "image/svg+xml" , 2, null);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'backgroundMime', "image/png" , 2, null);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'name' , "NextCloudPi" , 2, 0);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'slogan' , "keep your data close" , 2, 0);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'url' , "https://nextcloudpi.com" , 2, 0);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'logoMime' , "image/svg+xml" , 2, 0);
|
||||
replace into ${DB_PREFIX}appconfig values ( 'theming', 'backgroundMime', "image/png" , 2, 0);
|
||||
EOF
|
||||
|
||||
# NCP app
|
||||
|
||||
@ -55,9 +55,11 @@ configure()
|
||||
return
|
||||
fi
|
||||
|
||||
export PASSWORD
|
||||
# Just mount already encrypted data
|
||||
if [[ -f "${encdir?}"/gocryptfs.conf ]]; then
|
||||
echo "${PASSWORD?}" | gocryptfs -allow_other -q "${encdir}" "${datadir}" 2>&1 | sed /^Switch/d
|
||||
systemctl reset-failed ncp-encrypt ||:
|
||||
systemd-run -u ncp-encrypt -E PASSWORD bash -c "gocryptfs -allow_other -q '${encdir}' '${datadir}' <<<\"\${PASSWORD}\" 2>&1 | sed /^Switch/d |& tee /var/log/ncp-encrypt.log"
|
||||
|
||||
# switch to the regular virtual hosts after we decrypt, so we can access NC and ncp-web
|
||||
a2ensite ncp 001-nextcloud
|
||||
@ -75,7 +77,8 @@ configure()
|
||||
mv "${datadir?}" "${tmpdir?}"
|
||||
|
||||
mkdir "${datadir}"
|
||||
echo "${PASSWORD}" | gocryptfs -allow_other -q "${encdir}" "${datadir}" 2>&1 | sed /^Switch/d
|
||||
systemctl reset-failed ncp-encrypt ||:
|
||||
systemd-run -u ncp-encrypt -E PASSWORD bash -c "gocryptfs -allow_other -q '${encdir}' '${datadir}' <<<\"\${PASSWORD}\" 2>&1 | sed /^Switch/d |& tee /var/log/ncp-encrypt.log"
|
||||
|
||||
echo "Encrypting data..."
|
||||
mv "${tmpdir}"/* "${tmpdir}"/.[!.]* "${datadir}"
|
||||
|
||||
@ -12,12 +12,6 @@ LATEST="$NCLATESTVER"
|
||||
|
||||
configure()
|
||||
{
|
||||
[[ "$VERSION" == "0" ]] && VERSION="$LATEST"
|
||||
if ! is_docker && ! is_more_recent_than "24.0.0" "${VERSION}" && is_more_recent_than "8.1.0" "${PHPVER}.0" && [[ " ${BASH_SOURCE[*]} " =~ .*" /home/www/ncp-launcher.sh ".* ]]
|
||||
then
|
||||
echo "We need to upgrade PHP. This process cannot be performed from the web UI. Please use 'ncp-config' from the terminal (via SSH or direct access) to update Nextcloud instead. Future updates can again be run from the web UI"
|
||||
exit 1
|
||||
fi
|
||||
bash /usr/local/bin/ncp-update-nc "$VERSION"
|
||||
}
|
||||
|
||||
|
||||
1
build/armbian/armbian_version
Normal file
1
build/armbian/armbian_version
Normal file
@ -0,0 +1 @@
|
||||
v24.08
|
||||
@ -31,7 +31,7 @@ prepare_dirs # tmp cache output
|
||||
|
||||
# get latest armbian
|
||||
[[ -d armbian ]] || {
|
||||
git clone --depth 1 --branch v24.08 https://github.com/armbian/build armbian
|
||||
git clone --depth 1 --branch "$(cat "${0}/../armbian/armbian_version")" https://github.com/armbian/build armbian
|
||||
}
|
||||
#( cd armbian && git pull --ff-only --tags && git checkout v23.02 )
|
||||
#sed -i -e '/export rootfs_size=/s/du -sm/du --apparent-size -sm/' armbian/lib/functions/image/partitioning.sh
|
||||
|
||||
@ -519,16 +519,30 @@ function nc_version()
|
||||
ncc status | grep "versionstring:" | awk '{ print $3 }'
|
||||
}
|
||||
|
||||
function determine_nc_upgrade_version() {
|
||||
function determine_nc_update_version() {
|
||||
local current supported current_maj supported_maj versions next_version
|
||||
current="${1?}"
|
||||
supported="${2?}"
|
||||
requested="${3:-latest}"
|
||||
|
||||
#CURRENT="$(ncc status | grep "versionstring:" | awk '{ print $3 }')"
|
||||
current_maj="${current%%.*}"
|
||||
requested_maj="${requested%%.*}"
|
||||
supported_maj="${supported%%.*}"
|
||||
versions="$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/nextcloud/server/releases?per_page=100 | jq -r '.[].tag_name' | grep -v -e 'rc.$' -e 'beta.$' | sort -V)"
|
||||
|
||||
# If valid version is requested -> direct update, don't consider anything else
|
||||
if [[ "$requested" =~ ^[0-9.]*$ ]] && [[ "$requested_maj" -le "$((current_maj + 1))" ]]
|
||||
then
|
||||
echo "$requested"
|
||||
return 0
|
||||
fi
|
||||
|
||||
versions="$(curl -q -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/nextcloud/server/releases?per_page=100 | jq -r '.[].tag_name' | grep -v -e 'rc.$' -e 'beta.$' | sort -V)"
|
||||
next_version="$(grep "v${current_maj}." <<<"${versions}" | tail -n 1 | tr -d 'v')"
|
||||
next_version_maj="${next_version%%.*}"
|
||||
next_version_min="${next_version#*.}"
|
||||
next_version_min="${next_version_min%%.*}"
|
||||
|
||||
if [[ "${next_version}" == "${current}" ]]
|
||||
then
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
{
|
||||
"id": "VER",
|
||||
"name": "Version",
|
||||
"value": "28.0.7"
|
||||
"value": "29.0.4"
|
||||
},
|
||||
{
|
||||
"id": "MAXFILESIZE",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"nextcloud_version": "28.0.7",
|
||||
"php_version": "8.1",
|
||||
"nextcloud_version": "29.0.4",
|
||||
"php_version": "8.3",
|
||||
"release": "bookworm"
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<category>tools</category>
|
||||
<bugs>https://github.com/nextcloud/nextcloudpi/issues</bugs>
|
||||
<dependencies>
|
||||
<nextcloud min-version="22" max-version="28"/>
|
||||
<nextcloud min-version="22" max-version="29"/>
|
||||
</dependencies>
|
||||
<navigations>
|
||||
<navigation>
|
||||
|
||||
@ -132,7 +132,7 @@ class SettingsService {
|
||||
2 => ["pipe", "w"]
|
||||
];
|
||||
|
||||
$proc = proc_open($cmd, $descriptorSpec, $pipes, "/home/www-data", null);
|
||||
$proc = proc_open($cmd, $descriptorSpec, $pipes, "/var/www", null);
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
$stderr = stream_get_contents($pipes[2]);
|
||||
|
||||
@ -25,7 +25,7 @@ The first time you install this app, before using a cron job, you properly want
|
||||
</types>
|
||||
<dependencies>
|
||||
<php min-version="7.2"/>
|
||||
<nextcloud min-version="20" max-version="28" />
|
||||
<nextcloud min-version="20" max-version="29" />
|
||||
</dependencies>
|
||||
|
||||
<commands>
|
||||
|
||||
3
ncp.sh
3
ncp.sh
@ -22,7 +22,8 @@ install()
|
||||
{
|
||||
# NCP-CONFIG
|
||||
apt-get update
|
||||
$APTINSTALL git dialog whiptail jq file lsb-release tmux
|
||||
$APTINSTALL git dialog whiptail jq file lsb-release tmux logrotate
|
||||
|
||||
mkdir -p "$CONFDIR" "$BINDIR"
|
||||
|
||||
# This has changed, pi user no longer exists by default, the user needs to create it with Raspberry Pi imager
|
||||
|
||||
@ -27,7 +27,8 @@ from selenium.webdriver.firefox.webdriver import WebDriver
|
||||
from selenium.webdriver.remote.webelement import WebElement
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
from selenium.common.exceptions import NoSuchElementException, WebDriverException, TimeoutException
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.common.exceptions import NoSuchElementException, WebDriverException, TimeoutException, ElementNotInteractableException
|
||||
from typing import List, Tuple
|
||||
import traceback
|
||||
|
||||
@ -122,21 +123,32 @@ def is_admin_notifications_checkbox(item: WebElement):
|
||||
|
||||
|
||||
def close_first_run_wizard(driver: WebDriver):
|
||||
wait = WebDriverWait(driver, 60)
|
||||
wait = WebDriverWait(driver, 20)
|
||||
first_run_wizard = None
|
||||
try:
|
||||
first_run_wizard = driver.find_element(By.CSS_SELECTOR, "#firstrunwizard")
|
||||
except NoSuchElementException:
|
||||
pass
|
||||
if first_run_wizard is not None and first_run_wizard.is_displayed():
|
||||
wait.until(VisibilityOfElementLocatedByAnyLocator([(By.CLASS_NAME, "modal-container__close"),
|
||||
(By.CLASS_NAME, "first-run-wizard__close-button")]))
|
||||
for i in range(3):
|
||||
try:
|
||||
wait.until(VisibilityOfElementLocatedByAnyLocator([(By.CSS_SELECTOR, '.modal-container__content button[aria-label=Close]'),
|
||||
(By.CLASS_NAME, "modal-container__close"),
|
||||
(By.CLASS_NAME, "first-run-wizard__close-button")]))
|
||||
except TimeoutException as e:
|
||||
if i == 3:
|
||||
raise e
|
||||
try:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "first-run-wizard__close-button")
|
||||
overlay_close_btn.click()
|
||||
except NoSuchElementException:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close")
|
||||
overlay_close_btn = driver.find_element(By.CSS_SELECTOR, '.modal-container__content button[aria-label=Close]')
|
||||
overlay_close_btn.click()
|
||||
except (NoSuchElementException, ElementNotInteractableException):
|
||||
try:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close")
|
||||
overlay_close_btn.click()
|
||||
except (NoSuchElementException, ElementNotInteractableException):
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "first-run-wizard__close-button")
|
||||
overlay_close_btn.click()
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ done
|
||||
echo "done."
|
||||
|
||||
echo "Updating PHP package signing key..."
|
||||
apt-get update
|
||||
apt-get update ||:
|
||||
apt-get install --no-install-recommends -y gnupg2
|
||||
|
||||
apt-key adv --fetch-keys https://packages.sury.org/php/apt.gpg
|
||||
|
||||
4
updates/1.55.0.sh
Normal file
4
updates/1.55.0.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends logrotate
|
||||
Loading…
x
Reference in New Issue
Block a user