|
|
@@ -1,4 +1,7 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
|
|
|
|
|
|
|
|
|
|
prog="$(basename "$0")"
|
|
|
|
prog="$(basename "$0")"
|
|
|
|
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
usage() {
|
|
|
@@ -12,7 +15,7 @@ usage() {
|
|
|
|
-A ADDONS Comma separated list of addons to install (ispconfig, docker)
|
|
|
|
-A ADDONS Comma separated list of addons to install (ispconfig, docker)
|
|
|
|
-S SHARE Name of the SMB share to create (default: share)
|
|
|
|
-S SHARE Name of the SMB share to create (default: share)
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
(C) 2022 nasbeery installer by bashclub (https://github.com/bashclub)
|
|
|
|
(C) 2026 nasbeery installer by bashclub (https://github.com/bashclub)
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
exit $1
|
|
|
|
exit $1
|
|
|
@@ -69,20 +72,27 @@ whiptail --title "Possible data loss!" \
|
|
|
|
FORMAT=$?
|
|
|
|
FORMAT=$?
|
|
|
|
|
|
|
|
|
|
|
|
# pin cockpit to buster backports
|
|
|
|
# pin cockpit to buster backports
|
|
|
|
echo "Configure apt to install cockpit from backports repo"
|
|
|
|
#echo "Configure apt to install cockpit from backports repo"
|
|
|
|
cat << EOF | tee -i /etc/apt/preferences.d/99-cockpit
|
|
|
|
#cat << EOF | tee -i /etc/apt/preferences.d/99-cockpit
|
|
|
|
Package: cockpit cockpit-*
|
|
|
|
#Package: cockpit cockpit-*
|
|
|
|
Pin: release a=bullseye-backports
|
|
|
|
#Pin: release a=bullseye-backports
|
|
|
|
Pin-Priority: 900
|
|
|
|
#Pin-Priority: 900
|
|
|
|
EOF
|
|
|
|
#EOF
|
|
|
|
|
|
|
|
|
|
|
|
grep contrib /etc/apt/sources.list
|
|
|
|
timedatectl set-ntp true
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
systemctl restart systemd-timesyncd
|
|
|
|
sed -i "s/main/main contrib non-free/g" /etc/apt/sources.list
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Add debian bullseye backports repo"
|
|
|
|
|
|
|
|
echo "deb http://ftp.de.debian.org/debian/ bullseye-backports main contrib non-free" | tee -i /etc/apt/sources.list.d/bulleye-backports.list
|
|
|
|
echo "Ensure contrib repo is enabled (required for ZFS)"
|
|
|
|
|
|
|
|
sed -i 's/ main$/ main contrib non-free-firmware/' /etc/apt/sources.list
|
|
|
|
|
|
|
|
sed -i 's/ main non-free-firmware$/ main contrib non-free-firmware/' /etc/apt/sources.list
|
|
|
|
|
|
|
|
apt update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "=== Install Cockpit (Debian) ==="
|
|
|
|
|
|
|
|
apt install -y cockpit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#echo "Add debian bullseye backports repo"
|
|
|
|
|
|
|
|
#echo "deb http://ftp.de.debian.org/debian/ bullseye-backports main contrib non-free" | tee -i /etc/apt/sources.list.d/bulleye-backports.list
|
|
|
|
|
|
|
|
|
|
|
|
# update system and install packages
|
|
|
|
# update system and install packages
|
|
|
|
echo "Updating package lists"
|
|
|
|
echo "Updating package lists"
|
|
|
@@ -100,6 +110,10 @@ elif [[ $(dpkg --get-selections | grep -E -m1 "linux-image-current-meson64") ]];
|
|
|
|
headers="linux-headers-current-meson64"
|
|
|
|
headers="linux-headers-current-meson64"
|
|
|
|
elif [[ $(dpkg --get-selections | grep -E -m1 "linux-image-edge-meson64") ]]; then
|
|
|
|
elif [[ $(dpkg --get-selections | grep -E -m1 "linux-image-edge-meson64") ]]; then
|
|
|
|
headers="linux-headers-edge-meson64"
|
|
|
|
headers="linux-headers-edge-meson64"
|
|
|
|
|
|
|
|
elif [[ $(dpkg --get-selections | grep -m1 "linux-image-generic") ]]; then
|
|
|
|
|
|
|
|
headers="linux-headers-generic"
|
|
|
|
|
|
|
|
elif [[ $(dpkg --get-selections | grep -m1 "linux-image-raspi") ]]; then
|
|
|
|
|
|
|
|
headers="linux-headers-raspi"
|
|
|
|
elif [[ $(dpkg --get-selections | grep -m1 "linux-image-amd64") ]]; then
|
|
|
|
elif [[ $(dpkg --get-selections | grep -m1 "linux-image-amd64") ]]; then
|
|
|
|
headers="linux-headers-amd64"
|
|
|
|
headers="linux-headers-amd64"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@@ -107,53 +121,44 @@ echo "Intalling required packages"
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install $headers ntpdate git apt-transport-https gnupg2 software-properties-common vim htop net-tools dnsutils dpkg-dev
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install $headers ntpdate git apt-transport-https gnupg2 software-properties-common vim htop net-tools dnsutils dpkg-dev
|
|
|
|
|
|
|
|
|
|
|
|
# add extra apt keys
|
|
|
|
# add extra apt keys
|
|
|
|
echo "Add wsdd apt repo key"
|
|
|
|
#echo "Add wsdd apt repo key"
|
|
|
|
wget -O - https://pkg.ltec.ch/public/conf/ltec-ag.gpg.key | gpg --dearmor | tee -i /etc/apt/trusted.gpg.d/wsdd.gpg
|
|
|
|
#wget -O - https://pkg.ltec.ch/public/conf/ltec-ag.gpg.key | gpg --dearmor | tee -i /etc/apt/trusted.gpg.d/wsdd.gpg
|
|
|
|
|
|
|
|
|
|
|
|
# add extra apt repos
|
|
|
|
# add extra apt repos
|
|
|
|
echo "Add wsdd apt repo url"
|
|
|
|
#echo "Add wsdd apt repo url"
|
|
|
|
echo "deb [signed-by=/etc/apt/trusted.gpg.d/wsdd.gpg] https://pkg.ltec.ch/public/ $(lsb_release -cs) main" | tee -i /etc/apt/sources.list.d/wsdd.list
|
|
|
|
#echo "deb [signed-by=/etc/apt/trusted.gpg.d/wsdd.gpg] https://pkg.ltec.ch/public/ $(lsb_release -cs) main" | tee -i /etc/apt/sources.list.d/wsdd.list
|
|
|
|
|
|
|
|
|
|
|
|
echo "add 45drives repo key"
|
|
|
|
echo "add 45drives repo key"
|
|
|
|
wget -O - https://repo.45drives.com/key/gpg.asc | gpg --dearmor | tee -i /etc/apt/trusted.gpg.d/45drives.gpg
|
|
|
|
wget -O - https://repo.45drives.com/key/gpg.asc | gpg --dearmor | tee -i /etc/apt/trusted.gpg.d/45drives.gpg
|
|
|
|
|
|
|
|
|
|
|
|
echo "Add 45drives apt repo url"
|
|
|
|
echo "Add 45drives apt repo url"
|
|
|
|
echo "deb [signed-by=/etc/apt/trusted.gpg.d/45drives.gpg arch=amd64] https://repo.45drives.com/debian focal main" > /etc/apt/sources.list.d/45drives.list
|
|
|
|
echo "deb [signed-by=/etc/apt/trusted.gpg.d/45drives.gpg arch=amd64] https://repo.45drives.com/enterprise/debian bookworm main" > /etc/apt/sources.list.d/45drives.list
|
|
|
|
|
|
|
|
|
|
|
|
echo "Updating package lists"
|
|
|
|
echo "Updating package lists"
|
|
|
|
apt -qq update
|
|
|
|
apt -qq update
|
|
|
|
echo "Installing samba"
|
|
|
|
echo "Installing samba"
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install -t bullseye-backports acl samba-dsdb-modules samba-vfs-modules samba winbind wsdd zfs-dkms zfsutils-linux zfs-auto-snapshot
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install acl samba-dsdb-modules samba-vfs-modules samba winbind wsdd zfs-dkms zfsutils-linux zfs-auto-snapshot
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$(arch)" == "aarch64" ]]; then
|
|
|
|
|
|
|
|
znapzend_version=$(apt search znapzend 2>/dev/null | grep znapzend | cut -d ' ' -f2)
|
|
|
|
|
|
|
|
wget -O znapzend_${znapzend_version}_amd64.deb https://repo.45drives.com/debian/pool/main/z/znapzend/znapzend_${znapzend_version}_amd64.deb
|
|
|
|
|
|
|
|
mkdir znapzend
|
|
|
|
|
|
|
|
dpkg-deb -R znapzend_${znapzend_version}_amd64.deb ./znapzend
|
|
|
|
|
|
|
|
sed -i "s/amd64/arm64/g" ./znapzend/DEBIAN/control
|
|
|
|
|
|
|
|
sed -i "s/x86_64-linux-gnu/aarch64-linux-gnu/g" znapzend/usr/bin/*
|
|
|
|
|
|
|
|
mv znapzend/usr/lib/x86_64-linux-gnu znapzend/usr/lib/aarch64-linux-gnu
|
|
|
|
|
|
|
|
dpkg-deb -b znapzend znapzend_${znapzend_version}_arm64.deb
|
|
|
|
|
|
|
|
apt install ./znapzend_${znapzend_version}_arm64.deb
|
|
|
|
|
|
|
|
systemctl disable znapzend.service
|
|
|
|
|
|
|
|
rm -r znapzend*
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Installing cockpit"
|
|
|
|
echo "Installing cockpit"
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install --no-install-recommends cockpit cockpit-identities cockpit-file-sharing cockpit-navigator cockpit-zfs-manager cockpit-benchmark
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install --no-install-recommends cockpit cockpit-identities cockpit-file-sharing cockpit-navigator cockpit-benchmark
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
git clone https://github.com/45drives/cockpit-zfs-manager.git
|
|
|
|
|
|
|
|
cp -r cockpit-zfs-manager/zfs /usr/share/cockpit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "=== Install ZFS (Debian) ==="
|
|
|
|
|
|
|
|
apt install -y zfs-dkms zfsutils-linux zfs-auto-snapshot
|
|
|
|
|
|
|
|
|
|
|
|
echo "Activate zfs module"
|
|
|
|
echo "Activate zfs module"
|
|
|
|
modprobe zfs
|
|
|
|
/sbin/modprobe zfs
|
|
|
|
|
|
|
|
|
|
|
|
echo "Update time via ntp"
|
|
|
|
#echo "Update time via ntp"
|
|
|
|
ntpdate-debian -b > /dev/null
|
|
|
|
#ntpdate-debian -b > /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
rootfs=$(grep " / " /proc/mounts | cut -d'/' -f3)
|
|
|
|
echo "Detecting root disk (SAFETY CHECK)"
|
|
|
|
if [[ "$rootfs" == *"nvme"* ]] || [[ "$rootfs" == *"mmcblk"* ]]; then
|
|
|
|
rootdisk=$(findmnt -n -o SOURCE / | sed 's/[0-9]*$//;s/p$//')
|
|
|
|
rootdisk=${rootfs::-3}
|
|
|
|
rootdisk=$(basename "$rootdisk")
|
|
|
|
else
|
|
|
|
|
|
|
|
rootdisk=${rootfs::1}
|
|
|
|
echo "Root disk detected as: /dev/$rootdisk"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zdisks=$(echo $(lsblk -nd -I 8,259,179 -o name | grep -v ${rootdisk}) | cut -d' ' -f1-2)
|
|
|
|
zdisks=$(echo $(lsblk -nd -I 8,259,179 -o name | grep -v ${rootdisk}) | cut -d' ' -f1-2)
|
|
|
|
case $FORMAT in
|
|
|
|
case $FORMAT in
|
|
|
@@ -204,6 +209,8 @@ smbpasswd -x $USERNAME
|
|
|
|
(echo $PASSWORD; echo $PASSWORD) | smbpasswd -a $USERNAME
|
|
|
|
(echo $PASSWORD; echo $PASSWORD) | smbpasswd -a $USERNAME
|
|
|
|
usermod -aG sudo $USERNAME
|
|
|
|
usermod -aG sudo $USERNAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p /etc/cockpit/zfs/
|
|
|
|
|
|
|
|
|
|
|
|
echo "Writing cockpit configuration"
|
|
|
|
echo "Writing cockpit configuration"
|
|
|
|
cat << EOF | tee -i /etc/cockpit/zfs/config.json
|
|
|
|
cat << EOF | tee -i /etc/cockpit/zfs/config.json
|
|
|
|
{
|
|
|
|
{
|
|
|
@@ -251,7 +258,6 @@ EOF
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f /etc/cockpit/zfs/shares.conf ]; then
|
|
|
|
if [ -f /etc/cockpit/zfs/shares.conf ]; then
|
|
|
|
echo "Creating cockpit zfs shares conf"
|
|
|
|
echo "Creating cockpit zfs shares conf"
|
|
|
|
mkdir -p /etc/cockpit/zfs/
|
|
|
|
|
|
|
|
cat << EOF | tee -i /etc/cockpit/zfs/shares.conf
|
|
|
|
cat << EOF | tee -i /etc/cockpit/zfs/shares.conf
|
|
|
|
# COCKPIT ZFS MANAGER
|
|
|
|
# COCKPIT ZFS MANAGER
|
|
|
|
# WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION
|
|
|
|
# WARNING: DO NOT EDIT, AUTO-GENERATED CONFIGURATION
|
|
|
@@ -316,4 +322,4 @@ systemctl enable smbd nmbd wsdd
|
|
|
|
echo "############################################"
|
|
|
|
echo "############################################"
|
|
|
|
echo "nasbeery installation finished! rebooting..."
|
|
|
|
echo "nasbeery installation finished! rebooting..."
|
|
|
|
echo "############################################"
|
|
|
|
echo "############################################"
|
|
|
|
reboot
|
|
|
|
/sbin/reboot
|
|
|
|