Skip to content

Commit

Permalink
update to Debian 11 Bullseye
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <nacho@ownyourbits.com>
  • Loading branch information
nachoparker committed Mar 2, 2022
1 parent dd8fc3d commit 9bf5ff0
Show file tree
Hide file tree
Showing 32 changed files with 79 additions and 145 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp-diag
Original file line number Diff line number Diff line change
Expand Up @@ -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 )"
Expand Down
17 changes: 14 additions & 3 deletions bin/ncp-dist-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions bin/ncp/CONFIG/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions bin/ncp/CONFIG/nc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=$!
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions bin/ncp/CONFIG/nc-limits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ))
Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions bin/ncp/CONFIG/nc-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions bin/ncp/NETWORKING/nc-static-IP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 )"
Expand Down
6 changes: 2 additions & 4 deletions bin/ncp/SYSTEM/nc-hdd-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ configure()
}

[[ "$ACTIVE" != yes ]] && {
systemctl disable smartd
service smartd stop
systemctl disable --now smartd
echo "HDD monitor disabled"
return 0
}
Expand Down Expand Up @@ -70,8 +69,7 @@ EOF

done

systemctl enable smartd
service smartd start
systemctl enable --now smartd
echo "HDD monitor enabled"
}

Expand Down
8 changes: 2 additions & 6 deletions bin/ncp/SYSTEM/nc-hdd-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
59 changes: 0 additions & 59 deletions bin/ncp/SYSTEM/nc-wifi.sh

This file was deleted.

1 change: 0 additions & 1 deletion bin/ncp/UPDATES/nc-autoupdate-nc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
1 change: 0 additions & 1 deletion bin/ncp/UPDATES/nc-update-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions bin/ncp/UPDATES/unattended-upgrades.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions build/armbian/armbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions build/batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/build-LXD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions build/build-SD-armbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions build/build-SD-rpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions build/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Loading

0 comments on commit 9bf5ff0

Please sign in to comment.