diff options
-rw-r--r-- | etc/ncp-config.d/nc-datadir.sh | 16 | ||||
-rw-r--r-- | etc/ncp-config.d/unattended-upgrades.sh | 28 |
2 files changed, 39 insertions, 5 deletions
diff --git a/etc/ncp-config.d/nc-datadir.sh b/etc/ncp-config.d/nc-datadir.sh index 38f0e05f..4c4a45c4 100644 --- a/etc/ncp-config.d/nc-datadir.sh +++ b/etc/ncp-config.d/nc-datadir.sh @@ -44,9 +44,21 @@ configure() [ -d "$BASEDIR" ] || { echo "$BASEDIR does not exist"; return 1; } - grep -q -e ext -e btrfs <( stat -fc%T "$BASEDIR" ) || { echo -e "Only ext/btrfs filesystems can hold the data directory"; return 1; } + # If the user chooses the root of the mountpoint, force a folder + mountpoint -q "$DATADIR_" && { + BASEDIR="$DATADIR_" + DATADIR_="$DATADIR_/ncdata" + } + + grep -q -e ext -e btrfs <( stat -fc%T "$BASEDIR" ) || { + echo -e "Only ext/btrfs filesystems can hold the data directory" + return 1 + } - sudo -u www-data test -x "$BASEDIR" || { echo -e "ERROR: the user www-data does not have access permissions over $BASEDIR"; return 1; } + sudo -u www-data test -x "$BASEDIR" || { + echo -e "ERROR: the user www-data does not have access permissions over $BASEDIR" + return 1 + } [[ $( stat -fc%d / ) == $( stat -fc%d "$BASEDIR" ) ]] && { echo "Refusing to move to the SD card. Abort" diff --git a/etc/ncp-config.d/unattended-upgrades.sh b/etc/ncp-config.d/unattended-upgrades.sh index 94b391d8..eba93a5d 100644 --- a/etc/ncp-config.d/unattended-upgrades.sh +++ b/etc/ncp-config.d/unattended-upgrades.sh @@ -24,9 +24,12 @@ configure() [[ $ACTIVE_ == "yes" ]] && local AUTOUPGRADE=1 || local AUTOUPGRADE=0 [[ $AUTOREBOOT_ == "yes" ]] && local AUTOREBOOT=true || local AUTOREBOOT=false - # It seems like the label Raspbian-Security does not work for Raspbian - # See https://www.raspberrypi.org/forums/viewtopic.php?t=82863&p=585739 - cat > /etc/apt/apt.conf.d/20ncp-upgrades <<EOF + # Raspbian case + grep -q Raspbian /etc/issue && { + + # It seems like the label Raspbian-Security does not work for Raspbian + # See https://www.raspberrypi.org/forums/viewtopic.php?t=82863&p=585739 + cat > /etc/apt/apt.conf.d/20ncp-upgrades <<EOF APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "$AUTOUPGRADE"; APT::Periodic::MaxAge "14"; @@ -41,6 +44,25 @@ Dpkg::Options { "--force-confold"; }; EOF + + # Armbian case # TODO security only? + } || { + cat > /etc/apt/apt.conf.d/20ncp-upgrades <<EOF +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "$AUTOUPGRADE"; +APT::Periodic::MaxAge "14"; +APT::Periodic::AutocleanInterval "7"; +Unattended-Upgrade::Automatic-Reboot "$AUTOREBOOT"; +Unattended-Upgrade::Automatic-Reboot-Time "04:00"; +Unattended-Upgrade::Origins-Pattern { +o=Debian,n=stretch,l=Debian; +} +Dpkg::Options { + "--force-confdef"; + "--force-confold"; +}; +EOF + } echo "Unattended upgrades active: $ACTIVE_ (autoreboot $AUTOREBOOT_)" } |