Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/ncp-provisioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# this script runs at startup to provide an unique random passwords for each instance

source /usr/local/etc/library.sh
set -x

## redis provisioning

CFG=/var/www/nextcloud/config/config.php
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp-restore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath
[[ "$DIR" =~ "$NCDIR".* ]] && { echo "Refusing to restore from $NCDIR"; exit 1; }

TEMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
[[ "$(stat -fc%T "${TEMPDIR}")" =~ ext|btrfs|zfs ]] || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TEMPDIR}")" >&2; exit 1; }
[[ "$(stat -fc%T "${TEMPDIR}")" =~ ext|btrfs|zfs|overlayfs ]] || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TEMPDIR}")" >&2; exit 1; }

TEMPDIR="$( cd "$TEMPDIR" &>/dev/null && pwd )" || { echo "$TEMPDIR not found"; exit 1; } #abspath
cleanup(){ local RET=$?; echo "Cleanup..."; rm -rf "${TEMPDIR}"; trap "" EXIT; exit $RET; }
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
trap 'cd /; rm -rf "${TEMPDIR}"' EXIT

echo -e "Downloading updates"
git clone --depth 20 -b "$BRANCH" -q https://github.com/nextcloud/nextcloudpi.git "$TEMPDIR" || {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution: NCP update source was changed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder. I was not aware that I was still working on the PullRQ-ed branch. The above change was not meant to be pulled in here. Also, Github complains about signed-offs, thus I will cancel the request.

git clone --depth 20 -b "$BRANCH" -q https://github.com/sven-ola/nextcloudpi.git "$TEMPDIR" || {
echo "No internet connectivity"
exit 1
}
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ configure()
local BASEDIR=$( dirname "$DBDIR" )
mkdir -p "$BASEDIR"

[[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs ]] || { echo -e "Only ext/btrfs/zfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")"; return 1; }
[[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs|overlayfs ]] || { echo -e "Only ext/btrfs/zfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")"; return 1; }

sudo -u mysql test -x "$BASEDIR" || { echo -e "ERROR: the user mysql does not have access permissions over $BASEDIR"; return 1; }

Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ configure()
ENCDIR="${BASEDIR}"/ncdata_enc

# checks
[[ "$DISABLE_FS_CHECK" == 1 ]] || [[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs ]] || {
[[ "$DISABLE_FS_CHECK" == 1 ]] || [[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs|overlayfs ]] || {
echo -e "Only ext/btrfs/zfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")')"
return 1
}
Expand Down
1 change: 0 additions & 1 deletion bin/ncp/NETWORKING/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

install()
{
set -x
apt-get update
apt-get install --no-install-recommends -y dnsmasq
sleep 10
Expand Down
2 changes: 1 addition & 1 deletion bin/nextcloud-domain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ done
# wicd service finishes before completing DHCP
while :; do
local_ip="$(get_ip)"
pub_ip="$(curl -m4 icanhazip.com 2>/dev/null)"
pub_ip="$(curl -m4 icanhazip.com 2>/dev/null|sed '/:/s/.*/[&]/')"

[[ "$pub_ip" != "" ]] && ncc config:system:set trusted_domains 11 --value="$pub_ip"
[[ "$local_ip" != "" ]] && break
Expand Down
1 change: 0 additions & 1 deletion build/build-LXD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ LXC_CREATE+=(ncp)
# fi
#fi

set -x
EXEC_ARGS=()
[[ -z "$BRANCH" ]] || EXEC_ARGS+=(--env "BRANCH=${BRANCH}")
systemd-run --user --scope -p "Delegate=yes" "${LXC_CMD[@]}" start ncp -q || \
Expand Down
36 changes: 27 additions & 9 deletions etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export NCDIR=/var/www/nextcloud
export ncc=/usr/local/bin/ncc
export NCPCFG=${NCPCFG:-etc/ncp.cfg}
export ARCH="$(dpkg --print-architecture)"
export DB_PREFIX="$(php -r 'include("/var/www/nextcloud/config/config.php"); echo $CONFIG['"'dbtableprefix'"'];' || echo 'oc_')"
[[ "${ARCH}" =~ ^(armhf|arm)$ ]] && ARCH="armv7"
[[ "${ARCH}" == "arm64" ]] && ARCH=aarch64
[[ "${ARCH}" == "amd64" ]] && ARCH=x86_64
Expand Down Expand Up @@ -52,12 +51,31 @@ command -v jq &>/dev/null || {
apt-get install -y --no-install-recommends jq
}

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
grep -Eh '^deb ' /etc/apt/sources.list | grep "${RELEASE}-security" > /dev/null && RELEASE="${RELEASE}-security"
command -v ncc &>/dev/null && NCVER="$(ncc status 2>/dev/null | grep "version:" | awk '{ print $3 }')"
if [ /var/www/ncp-web/library-cache -ot /etc/apt/sources.list ] || \
[ /var/www/ncp-web/library-cache -ot /var/www/nextcloud/config/config.php ] ||
[ /var/www/ncp-web/library-cache -ot "$NCPCFG" ]
then
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
grep -Eh '^deb ' /etc/apt/sources.list | grep "${RELEASE}-security" > /dev/null && RELEASE="${RELEASE}-security"
command -v ncc &>/dev/null && NCVER="$(ncc status 2>/dev/null | grep "version:" | awk '{ print $3 }')"
if [ -s /var/www/nextcloud/config/config.php ];then
DB_PREFIX="$(php -r 'include("/var/www/nextcloud/config/config.php"); echo $CONFIG["dbtableprefix"];')"
fi
test -d /var/www/ncp-web && cat > /var/www/ncp-web/library-cache << EOF
NCLATESTVER="${NCLATESTVER}"
PHPVER="${PHPVER}"
RELEASE="${RELEASE}"
NCVER="${NCVER}"
DB_PREFIX="${DB_PREFIX}"
EOF
else
source /var/www/ncp-web/library-cache
fi

export DB_PREFIX=${DB_PREFIX:-oc_}

function configure_app()
{
Expand Down Expand Up @@ -158,8 +176,8 @@ function set-nc-domain()
ncc config:system:set trusted_proxies 11 --value="127.0.0.1"
ncc config:system:set trusted_proxies 12 --value="::1"
# ncc config:system:set trusted_proxies 13 --value="${domain}"
local domain_ip="$(dig +short "${domain}")"
[[ -z "$domain_ip" ]] || ncc config:system:set trusted_proxies 14 --value="$(dig +short "${domain}")"
local domain_ip="$(dig +short "${domain}"|tail -n1)"
[[ -z "$domain_ip" ]] || ncc config:system:set trusted_proxies 14 --value="$(dig +short "${domain}"|tail -n1)"
sleep 5 # this seems to be required in the VM for some reason. We get `http2 error: protocol error` after ncp-upgrade-nc
for try in {1..5}
do
Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/nc-nextcloud.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"id": "VER",
"name": "Version",
"value": "31.0.2"
"value": "31.0.8"
},
{
"id": "MAXFILESIZE",
Expand Down
6 changes: 3 additions & 3 deletions etc/ncp.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"nextcloud_version": "31.0.2",
"php_version": "8.3",
"release": "bookworm"
"nextcloud_version": "31.0.8",
"php_version": "8.4",
"release": "trixie"
}
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y git ca
if [[ "${CODE_DIR}" == "" ]]; then
echo "Getting build code..."
CODE_DIR_TMP="${TEMPDIR}"/nextcloudpi
git clone -b "${BRANCH}" https://github.com/nextcloud/nextcloudpi.git "${CODE_DIR_TMP}"
git clone -b "${BRANCH}" https://github.com/sven-ola/nextcloudpi.git "${CODE_DIR_TMP}"
cd "$CODE_DIR_TMP"
else
cd "${CODE_DIR}"
Expand Down
9 changes: 5 additions & 4 deletions lamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ export DEBIAN_FRONTEND=noninteractive

install()
{
set -x
# 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
if [ ! -f /etc/apt/sources.list.d/php.list ] || [ ! -f /etc/apt/trusted.gpg.d/php.gpg ];then
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
fi
apt-get update
$APTINSTALL apt-utils cron curl
ls -l /var/lock || true
Expand Down Expand Up @@ -100,7 +101,7 @@ install()
done

cd /tmp
mysql_secure_installation <<EOF
mariadb-secure-installation <<EOF
$DBPASSWD
y
$DBPASSWD
Expand Down
2 changes: 1 addition & 1 deletion ncp-web/ncp-launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
require( "elements.php" );
// return JSON
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
echo ' "output": ' . json_encode( print_sidebar( $l, true ) ) . ' , ';
echo ' "output": ' . json_encode( print_sidebar( $l, false ) ) . ' , ';
echo ' "ret": "0" }';
}

Expand Down