update to Debian 11 Bullseye

Signed-off-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
nachoparker 2021-11-09 10:54:18 -07:00
parent dd8fc3dd7d
commit 9bf5ff032c
32 changed files with 79 additions and 145 deletions

View File

@ -18,7 +18,7 @@ Find the full documentation at [docs.nextcloudpi.com](http://docs.nextcloudpi.co
* Debian/Raspbian 10 Buster
* Nextcloud 22.2.2
* Apache 2.4.25, with HTTP2 enabled
* PHP 7.3
* PHP 7.4
* MariaDB 10
* Redis memory cache
* ncp-config for easy setup ( RAM logs, USB drive and more )

View File

@ -56,7 +56,7 @@ fi
# Services
echo "HTTPD service|$( pgrep -c apache2 &>/dev/null && echo up || echo down )"
echo "PHP service|$( pgrep -c php-fpm &>/dev/null && echo up || echo down )"
echo "MariaDB service|$( pgrep -c mysqld &>/dev/null && echo up || echo down )"
echo "MariaDB service|$( (pgrep -c mysqld || pgrep -c mariadb) &>/dev/null && echo up || echo down )"
echo "Redis service|$( pgrep -c redis-server &>/dev/null && echo up || echo down )"
echo "HPB service|$( ncc notify_push:self-test &>/dev/null && echo up || echo down )"
echo "Postfix service|$( pgrep -fc postfix &>/dev/null && echo up || echo down )"

View File

@ -42,12 +42,15 @@ apt-get purge -y php${PHPVER} php${PHPVER}-curl php${PHPVER}-gd php${PHPVER}-fpm
apt-get purge -y php${PHPVER}-mysql
apt-get purge -y php${PHPVER}-redis
apt-get purge -y php${PHPVER}-exif
apt-get purge -y php${PHPVER}-bcmath
apt-get purge -y php${PHPVER}-gmp
apt-get purge -y php${PHPVER}-imagick
set -e
# update sources
sed -i 's/stretch/buster/g' /etc/apt/sources.list
sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/* || true
sed -i 's/bullseye\/updates/bullseye-security/g' /etc/apt/sources.list
rm -f /etc/apt/sources.list.d/php.list
# install latest distro
@ -56,6 +59,8 @@ apt-get dist-upgrade -y
# install latest PHP version
release_new=$(jq -r '.release' < "${new_cfg}")
# the default repo in bullseye is bullseye-security
release_new="${release_new}-security"
php_ver_new=$(jq -r '.php_version' < "${new_cfg}")
$APTINSTALL -t ${release_new} php${php_ver_new} php${php_ver_new}-curl php${php_ver_new}-gd php${php_ver_new}-fpm php${php_ver_new}-cli php${php_ver_new}-opcache \
@ -65,8 +70,13 @@ $APTINSTALL -t ${release_new} php${php_ver_new} php${php_ver_new}-curl php${php_
$APTINSTALL php${php_ver_new}-mysql
$APTINSTALL -t ${release_new} php${php_ver_new}-redis
$APTINSTALL -t ${release_new} php-smbclient exfat-fuse exfat-utils
$APTINSTALL -t ${release_new} smbclient exfat-fuse exfat-utils
sleep 2 # avoid systemd thinking that PHP is in a crash/restart loop
$APTINSTALL -t ${release_new} php${php_ver_new}-exif
sleep 2 # avoid systemd thinking that PHP is in a crash/restart loop
$APTINSTALL -t ${release_new} php${php_ver_new}-bcmath
sleep 2 # avoid systemd thinking that PHP is in a crash/restart loop
$APTINSTALL -t ${release_new} php${php_ver_new}-gmp
#$APTINSTALL -t ${release_new} imagemagick php${php_ver_new}-imagick ghostscript
apt-get autoremove -y
@ -114,6 +124,7 @@ is_active_app unattended-upgrades && run_app unattended-upgrades || true
# mark as successful
mv "${new_cfg}" "${old_cfg}"
source /usr/local/etc/library.sh # refresh NCPCFG RELEASE PHPVER
run_app nc-limits
restore_maintenance_mode

View File

@ -17,12 +17,11 @@ is_active()
install()
{
apt_install btrfs-tools
apt_install btrfs-progs
}
configure()
{
source /usr/local/etc/library.sh # sets PHPVER
set -eu -o pipefail
## CHECKS

View File

@ -12,8 +12,6 @@ DBADMIN=ncadmin
configure()
{
source /usr/local/etc/library.sh # sets PHPVER NCVER
echo "Setting up a clean Nextcloud instance... wait until message 'NC init done'"
# checks
@ -25,7 +23,7 @@ configure()
echo "Setting up database..."
# launch mariadb if not already running
if ! pgrep -c mysqld &>/dev/null; then
if ! [[ -f /run/mysqld/mysqld.pid ]]; then
echo "Starting mariaDB"
mysqld &
local db_pid=$!
@ -160,7 +158,9 @@ EOF
fi
# ncp-previewgenerator
if is_more_recent_than "21.0.0" "$NCVER"; then
local ncver
ncver="$(ncc status 2>/dev/null | grep "version:" | awk '{ print $3 }')"
if is_more_recent_than "21.0.0" "${ncver}"; then
local ncprev=/var/www/ncp-previewgenerator/ncp-previewgenerator-nc20
else
ncc app:install notify_push
@ -202,6 +202,7 @@ EOF
# dettach mysql during the build
if [[ "${db_pid}" != "" ]]; then
echo "Shutting down mariaDB (${db_pid})"
mysqladmin -u root shutdown
wait "${db_pid}"
fi

View File

@ -10,8 +10,6 @@
configure()
{
source /usr/local/etc/library.sh # sets PHPVER
# Set auto memory limit to 75% of the total memory
local TOTAL_MEM="$( free -b | sed -n 2p | awk '{ print $2 }' )"
AUTOMEM=$(( TOTAL_MEM * 75 / 100 ))
@ -48,7 +46,7 @@ configure()
echo "Using $AUTOMEM memory for the database"
[[ "$CURRENT_DB_MEM" != "$AUTOMEM" ]] && {
sed -i "s|^innodb_buffer_pool_size =.*|innodb_buffer_pool_size = $AUTOMEM|" "$CONF"
service mysql restart
service mariadb restart
}
# RESTART PHP

View File

@ -22,10 +22,13 @@ install()
# Optional packets for Nextcloud and Apps
apt-get update
$APTINSTALL lbzip2 iputils-ping jq wget
$APTINSTALL -t $RELEASE php-smbclient exfat-fuse exfat-utils # for external storage
# NOTE: php-smbclient in sury but not in Debian sources, we'll use the binary version
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage/smb.html
$APTINSTALL -t $RELEASE smbclient exfat-fuse exfat-utils # for external storage
$APTINSTALL -t $RELEASE exfat-fuse exfat-utils # for external storage
$APTINSTALL -t $RELEASE php${PHPVER}-exif # for gallery
$APTINSTALL -t $RELEASE php${PHPVER}-bcmath # for LDAP
$APTINSTALL -t $RELEASE php${PHPVER}-gmp # for bookmarks
$APTINSTALL -t $RELEASE php-bcmath # for LDAP
#$APTINSTALL -t imagemagick php${PHPVER}-imagick ghostscript # for gallery
@ -149,15 +152,12 @@ configure()
## RE-CREATE DATABASE TABLE
# launch mariadb if not already running (for docker build)
if ! pgrep -c mysqld &>/dev/null; then
if ! [[ -f /run/mysqld/mysqld.pid ]]; then
echo "Starting mariaDB"
mysqld &
local db_pid=$!
fi
# wait for mariadb
pgrep -x mysqld &>/dev/null || echo "mariaDB process not found"
while :; do
[[ -S /var/run/mysqld/mysqld.sock ]] && break
sleep 0.5
@ -260,6 +260,7 @@ EOF
# dettach mysql during the build
if [[ "${db_pid}" != "" ]]; then
echo "Shutting down mariaDB (${db_pid})"
mysqladmin -u root shutdown
wait "${db_pid}"
fi

View File

@ -8,8 +8,6 @@
# More at: https://ownyourbits.com
#
source /usr/local/etc/library.sh
configure()
{
local GW="$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )"

View File

@ -24,8 +24,7 @@ configure()
}
[[ "$ACTIVE" != yes ]] && {
systemctl disable smartd
service smartd stop
systemctl disable --now smartd
echo "HDD monitor disabled"
return 0
}
@ -70,8 +69,7 @@ EOF
done
systemctl enable smartd
service smartd start
systemctl enable --now smartd
echo "HDD monitor enabled"
}

View File

@ -12,12 +12,8 @@
install()
{
apt-get update
apt-get install --no-install-recommends -y smartmontools
[[ "$DOCKERBUILD" == 1 ]] || {
systemctl disable smartd
systemctl stop smartd
}
apt_install smartmontools
systemctl disable smartd
return
}

View File

@ -1,59 +0,0 @@
#!/bin/bash
# Data dir configuration script for NextCloudPi
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
#
# More at https://ownyourbits.com/
#
install()
{
apt-get update
apt install -y --no-install-recommends wicd-curses
systemctl disable wicd
}
configure()
{
[[ $ACTIVE != "yes" ]] && {
systemctl stop wicd
systemctl disable wicd
systemctl start dhcpcd
systemctl enable dhcpcd
ip link set down dev wlan0
systemctl start nextcloud-domain
return;
}
ip link set up dev wlan0
systemctl stop dhcpcd
systemctl disable dhcpcd
systemctl enable wicd
systemctl start wicd
wicd-curses
clear
systemctl start nextcloud-domain
}
# License
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA

View File

@ -9,7 +9,6 @@
#
# just change NCLATESTVER and re-activate in update.sh to upgrade users
source /usr/local/etc/library.sh # sets NCLATESTVER
configure()
{

View File

@ -8,7 +8,6 @@
# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
#
source /usr/local/etc/library.sh # sets NCLATESTVER
LATEST="$NCLATESTVER"
configure()

View File

@ -18,8 +18,6 @@ install()
configure()
{
source /usr/local/etc/library.sh # sets RELEASE
[[ $ACTIVE == "yes" ]] && local AUTOUPGRADE=1 || local AUTOUPGRADE=0
[[ $AUTOREBOOT == "yes" ]] && local AUTOREBOOT=true || local AUTOREBOOT=false

View File

@ -21,8 +21,6 @@ cd /tmp/overlay
NCPCFG=etc/ncp.cfg
source etc/library.sh # sets RELEASE
[[ "$ARMBIAN_RELEASE" != "$RELEASE" ]] && { echo "Only $RELEASE is supported by NextCloudPi" >&2; exit 1; }
# need sudo access that does not expire during build
chage -d -1 root

View File

@ -55,6 +55,7 @@ IMG="$(ls -1t tmp/*.img | head -1)"
build/build-SD-berryboot.sh "$IMG"
# Armbian
export LIB_TAG=master # if we want to pin down a specific armbian version
build/build-SD-armbian.sh odroidxu4 OdroidHC2
build/build-SD-armbian.sh rockpro64 RockPro64
build/build-SD-armbian.sh rock64 Rock64

View File

@ -32,7 +32,7 @@ prepare_dirs # tmp cache output
## BUILD NCP
lxc delete -f ncp 2>/dev/null || true
systemd-run --user --scope -p "Delegate=yes" lxc launch images:debian/buster ncp
systemd-run --user --scope -p "Delegate=yes" lxc launch images:debian/bullseye ncp
lxc config device add ncp buildcode disk source="$(pwd)" path=/build
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
lxc exec ncp -- bash -c 'CODE_DIR=/build bash /build/install.sh'

View File

@ -46,10 +46,10 @@ CONF=armbian/userpatches/config-ncp.conf
# default parameters
cat > "$CONF" <<EOF
BOARD="$BOARD"
BRANCH=legacy
RELEASE=$RELEASE
BRANCH=current
RELEASE=${RELEASE%%-security}
KERNEL_ONLY=no
KERNEL_CONFIGURE=no
KERNEL_CONFIGURE=prebuilt
BUILD_DESKTOP=no
BUILD_MINIMAL=yes
USE_CCACHE=yes

View File

@ -13,7 +13,7 @@ source build/buildlib.sh
echo -e "\e[1m\n[ Build NCP Raspberry Pi ]\e[0m"
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2021-11-08/2021-10-30-raspios-bullseye-arm64-lite.zip"
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-01-28/2022-01-28-raspios-bullseye-arm64-lite.zip"
SIZE=4G # Raspbian image size
#CLEAN=0 # Pass this envvar to skip cleaning download cache
IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img"
@ -61,6 +61,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
#$APTINSTALL rpi-update
#echo -e "y\n" | PRUNE_MODULES=1 rpi-update
# this image comes without resolv.conf ??
echo 'nameserver 1.1.1.1' >> /etc/resolv.conf
# install NCP
cd /tmp/ncp-build || exit 1
CODE_DIR="$(pwd)" bash install.sh
@ -82,8 +85,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
cfg="$(jq '.params[3].value = "raspberry"' <<<"$cfg")"
echo "$cfg" > /usr/local/etc/ncp-config.d/SSH.cfg
$ cleanup
# cleanup
source etc/library.sh && run_app_unsafe post-inst.sh
rm /etc/resolv.conf
rm -rf /tmp/ncp-build
EOFCHROOT

View File

@ -20,10 +20,10 @@ function build_arch()
echo -e "\e[1m\n[ Build NCP Docker ${arch} ]\e[0m"
docker_build -f build/docker/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-${ncp_tag}:latest --pull --build-arg release=${release} --build-arg arch=${arch} --build-arg arch_qemu=${arch_qemu}
docker_build -f build/docker/lamp/Dockerfile -t ownyourbits/lamp-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag}
docker_build -f build/docker/nextcloud/Dockerfile -t ownyourbits/nextcloud-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag}
docker_build -f build/docker/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag} --build-arg ncp_ver=${version}
docker_build -f build/docker/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-${ncp_tag}:latest --pull --build-arg release=${release} --build-arg arch=${arch} --build-arg arch_qemu=${arch_qemu}
docker_build -f build/docker/lamp/Dockerfile -t ownyourbits/lamp-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag} --build-arg arch_qemu=${arch_qemu}
docker_build -f build/docker/nextcloud/Dockerfile -t ownyourbits/nextcloud-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag} --build-arg arch_qemu=${arch_qemu}
docker_build -f build/docker/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag} --build-arg arch_qemu=${arch_qemu} --build-arg ncp_ver=${version}
docker tag ownyourbits/debian-ncp-${ncp_tag}:latest ownyourbits/debian-ncp-${ncp_tag}:"${version}"
docker tag ownyourbits/lamp-${ncp_tag}:latest ownyourbits/lamp-${ncp_tag}:"${version}"

View File

@ -1,12 +1,10 @@
ARG arch=armhf
ARG arch_qemu=arm
ARG release=buster
ARG release=bullseye
FROM debian:${release}-slim AS qemu
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends qemu-user-static
ARG release
ARG arch_qemu
FROM ${arch}/debian:${release}-slim
ARG arch_qemu

View File

@ -1,8 +1,9 @@
# syntax=docker/dockerfile:experimental
ARG arch=armhf
ARG arch_qemu=arm
FROM ownyourbits/debian-ncp-${arch}
FROM --platform=linux/${arch_qemu} ownyourbits/debian-ncp-${arch}
LABEL maintainer="Ignacio Núñez Hernanz <nacho@ownyourbits.com>"

View File

@ -1,8 +1,9 @@
# syntax=docker/dockerfile:experimental
ARG arch=armhf
ARG arch_qemu=arm
FROM ownyourbits/lamp-${arch}
FROM --platform=linux/${arch_qemu} ownyourbits/lamp-${arch}
LABEL maintainer="Ignacio Núñez Hernanz <nacho@ownyourbits.com>"

View File

@ -1,8 +1,9 @@
# syntax=docker/dockerfile:experimental
ARG arch=armhf
ARG arch_qemu=arm
FROM ownyourbits/nextcloud-${arch}
FROM --platform=linux/${arch_qemu} ownyourbits/nextcloud-${arch}
ARG ncp_ver=v0.0.0

View File

@ -1,5 +1,9 @@
<<<<<<< HEAD
[v1.46.7](https://github.com/nextcloud/nextcloudpi/commit/0da8dcd) (2021-12-13) letsencrypt: fix invalid arithmetic operator error
=======
[v1.45.0](https://github.com/nextcloud/nextcloudpi/commit/b0379f1) (2021-11-09) update to Debian 11 Bullseye
>>>>>>> 41f692c (update to Debian 11 Bullseye)
[v1.44.6 ](https://github.com/nextcloud/nextcloudpi/commit/26a7778) (2021-12-06) notify_push: fix service not restarting on binary update (#1398)

View File

@ -8,11 +8,14 @@
# More at ownyourbits.com
#
export NCPCFG=${NCPCFG:-/usr/local/etc/ncp.cfg}
export CFGDIR=/usr/local/etc/ncp-config.d
export BINDIR=/usr/local/bin/ncp
export NCDIR=/var/www/nextcloud
export ncc=/usr/local/bin/ncc
export NCPCFG=${NCPCFG:-etc/ncp.cfg}
[[ -f "$NCPCFG" ]] || export NCPCFG=/usr/local/etc/ncp.cfg
[[ -f "$NCPCFG" ]] || { echo "$NCPCFG not found" >2; exit 1; }
#unset TRUSTED_DOMAINS
#declare -A TRUSTED_DOMAINS
@ -27,11 +30,11 @@ command -v jq &>/dev/null || {
apt-get install -y --no-install-recommends jq
}
[[ -f "$NCPCFG" ]] && {
NCLATESTVER=$(jq -r .nextcloud_version < "$NCPCFG")
PHPVER=$( jq -r .php_version < "$NCPCFG")
RELEASE=$( jq -r .release < "$NCPCFG")
}
NCLATESTVER=$(jq -r .nextcloud_version < "$NCPCFG")
PHPVER=$( jq -r .php_version < "$NCPCFG")
RELEASE=$( jq -r .release < "$NCPCFG")
# the default repo in bullseye is bullseye-security
RELEASE="${RELEASE}-security"
command -v ncc &>/dev/null && NCVER="$(ncc status 2>/dev/null | grep "version:" | awk '{ print $3 }')"
function configure_app()

View File

@ -1,16 +0,0 @@
{
"id": "nc-wifi",
"name": "Nc-wifi",
"title": "nc-wifi",
"description": "Configure your Wi-Fi connection",
"info": "\n0) Write 'yes' to activate wifi, and 'no' to disable it\n1) Select a Wi-Fi network\n2) Press right arrow ->\n3) Enter the passphrase for your Wi-Fi\n4) Make sure to select 'connect automatically'\n5) F10 to save\n6) C to connect",
"infotitle": "Instructions to configure Wi-Fi",
"params": [
{
"id": "ACTIVE",
"name": "Active",
"value": "no",
"type": "bool"
}
]
}

View File

@ -1,5 +1,5 @@
{
"nextcloud_version": "22.2.2",
"php_version": "7.3",
"release": "buster"
"php_version": "7.4",
"release": "bullseye"
}

View File

@ -19,8 +19,6 @@
# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
#
source /usr/local/etc/library.sh # sets PHPVER RELEASE
APTINSTALL="apt-get install -y --no-install-recommends"
export DEBIAN_FRONTEND=noninteractive
@ -142,7 +140,7 @@ EOF
# launch mariadb if not already running
if ! pgrep -c mysqld &>/dev/null; then
if ! [[ -f /run/mysqld/mysqld.pid ]]; then
echo "Starting mariaDB"
mysqld &
fi

View File

@ -15,13 +15,14 @@ configure()
# stop services
pkill -x redis-server
pgrep -x mysqld &>/dev/null && mysqladmin -u root shutdown
[[ -f /run/mysqld/mysqld.pid ]] && mysqladmin -u root shutdown
[[ -f /run/crond.pid ]] && kill "$(cat /run/crond.pid)"
pkill -f php-fpm
pkill -f notify_push
killall postdrop
killall sendmail
# cleanup all NCP extras
source /usr/local/etc/library.sh
find /usr/local/bin/ncp -name '*.sh' | \
while read script; do cleanup_script $script; done

View File

@ -24,7 +24,7 @@ from subprocess import run, getstatusoutput, PIPE
processes_must_be_running = [
'apache2',
'cron',
'mysqld',
'mariadb',
'php-fpm',
'postfix',
'redis-server',

View File

@ -32,6 +32,7 @@ nc-snapshot-sync
nc-restore-snapshot
nc-audit
nc-hdd-monitor
nc-hdd-test
nc-zram
SSH
fail2ban
@ -202,8 +203,8 @@ chmod +x /etc/update-motd.d/30ncp-dist-upgrade
# Remove redundant opcache configuration.
# Related to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.3 and debian buster packages.
[[ "$( ls -l /etc/php/7.3/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.3/fpm/conf.d/*-opcache.ini | tail -1 )"
[[ "$( ls -l /etc/php/7.3/cli/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.3/cli/conf.d/*-opcache.ini | tail -1 )"
[[ "$( ls -l /etc/php/"${PHPVER}"/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/"${PHPVER}"/fpm/conf.d/*-opcache.ini | tail -1 )"
[[ "$( ls -l /etc/php/"${PHPVER}"/cli/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/"${PHPVER}"/cli/conf.d/*-opcache.ini | tail -1 )"
exit 0