Commit f74c7e2a authored by ThomasKaiser's avatar ThomasKaiser
Browse files

OMV5 preparations

parent 995ca13b
......@@ -523,10 +523,14 @@ if [[ $? = 0 ]]; then
fi
}
install_ncp (){
curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash
}
install_omv (){
#
# On Debian install OpenMediaVault 3 (Jessie) or 4 (Stretch)
......@@ -540,17 +544,28 @@ if [[ "$family" == "Ubuntu" ]]; then
fi
case $distribution in
jessie)
OMV_Name="erasmus"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all3.deb"
wheezy|jessie)
dialog --backtitle "$BACKTITLE" --title "OMV3 is End of Life" --msgbox "\nUpgrade to a supported Debian release first." 7 52
sleep 5
exit 1
;;
stretch)
OMV_Name="arrakis"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all4.deb"
OMV_EXTRA_PACKAGES="openmediavault-flashmemory openmediavault-netatalk"
;;
buster)
OMV_Name="usul"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all5.deb"
OMV_EXTRA_PACKAGES="openmediavault-flashmemory"
;;
esac
systemctl status log2ram >/dev/null 2>&1 && (systemctl stop log2ram ; systemctl disable log2ram >/dev/null 2>&1; rm /etc/cron.daily/log2ram)
systemctl status armbian-ramlog >/dev/null 2>&1 && (systemctl stop armbian-ramlog ; systemctl disable armbian-ramlog >/dev/null 2>&1; rm /etc/cron.daily/armbian-ram-logging)
export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
if [ -f /etc/armbian-release ]; then
. /etc/armbian-release
......@@ -564,46 +579,60 @@ if [ -f /etc/default/cpufrequtils ]; then
. /etc/default/cpufrequtils
fi
# Add OMV sources
cat > /etc/apt/sources.list.d/openmediavault.list << EOF
deb https://openmediavault.github.io/packages/ ${OMV_Name} main
deb https://packages.openmediavault.org/public ${OMV_Name} main
## Uncomment the following line to add software from the proposed repository.
deb https://openmediavault.github.io/packages/ ${OMV_Name}-proposed main
deb https://packages.openmediavault.org/public ${OMV_Name}-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb https://openmediavault.github.io/packages/ ${OMV_Name} partner
# deb https://packages.openmediavault.org/public ${OMV_Name} partner
EOF
# Install keys
wget -O "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" https://packages.openmediavault.org/public/archive.key
apt-key add "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc"
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get --yes install openmediavault-keyring
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
# configure install and check for disk space
read HOSTNAME </etc/hostname
read TZ </etc/timezone
debconf-set-selections <<< "postfix postfix/mailname string ${HOSTNAME}"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
SPACE_NEEDED=$(apt-get --assume-no --allow-unauthenticated --fix-missing --no-install-recommends install openmediavault postfix dirmngr 2>/dev/null | awk -F" " '/additional disk space will be used/ {print $4}')
SPACE_NEEDED=$(apt-get --assume-no --allow-unauthenticated --fix-missing --no-install-recommends install openmediavault-keyring openmediavault postfix dirmngr 2>/dev/null | awk -F" " '/additional disk space will be used/ {print $4}')
SPACE_NEEDED=${SPACE_NEEDED%.*}
SPACE_AVAIL=$(df -k / | awk -F" " '/\/$/ {printf ("%0.0f",$4/1200); }')
if [ ${SPACE_AVAIL} -lt ${SPACE_NEEDED} ]; then
dialog --backtitle "$BACKTITLE" --title "No space left on device" --msgbox "\nOpenMediaVault needs ${SPACE_NEEDED} MB for installation while only ${SPACE_AVAIL} MB are available." 7 52
exit 1
fi
apt-get --allow-unauthenticated install openmediavault-keyring
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
debconf-apt-progress -- apt-get -y --allow-unauthenticated --fix-missing --no-install-recommends \
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install openmediavault postfix dirmngr
# main install
echo "Now installing OMV packages. Be patient please"
debconf-apt-progress -- apt-get --yes --auto-remove --show-upgraded \
--allow-downgrades --allow-change-held-packages \
--no-install-recommends \
--option Dpkg::Options::="--force-confdef" \
--option DPkg::Options::="--force-confold" \
install postfix dirmngr openmediavault
# Fix multiple sources entry on ARM with OMV4
sed -i '/stretch-backports/d' /etc/apt/sources.list
# Install OMV-Extras
FILE="${TEMP_DIR}/omv_extras.deb"; wget "$OMV_EXTRAS_URL" -qO $FILE && dpkg -i $FILE ; rm $FILE
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get --yes --force-yes --fix-missing --auto-remove --allow-unauthenticated \
--show-upgraded --option DPkg::Options::="--force-confold" dist-upgrade
# Install flashmemory plugin and netatalk by default, use nice logo for the latter,
# Install flashmemory plugin and netatalk on OMV4 by default, use nice logo for the latter,
# disable OMV monitoring by default
. /usr/share/openmediavault/scripts/helper-functions
debconf-apt-progress -- apt-get -y --fix-missing --no-install-recommends --auto-remove install openmediavault-flashmemory openmediavault-netatalk
debconf-apt-progress -- apt-get -y --fix-missing --no-install-recommends --auto-remove install ${OMV_EXTRA_PACKAGES}
AFP_Options="mimic model = Macmini"
SMB_Options="min receivefile size = 16384\nwrite cache size = 524288\ngetwd cache = yes\nsocket options = TCP_NODELAY IPTOS_LOWDELAY"
xmlstarlet ed -L -u "/config/services/afp/extraoptions" -v "$(echo -e "${AFP_Options}")" ${OMV_CONFIG_FILE}
......@@ -634,9 +663,11 @@ fi
echo -e "OMV_CPUFREQUTILS_GOVERNOR=${GOVERNOR}" >>/etc/default/openmediavault
echo -e "OMV_CPUFREQUTILS_MINSPEED=${MIN_SPEED}" >>/etc/default/openmediavault
echo -e "OMV_CPUFREQUTILS_MAXSPEED=${MAX_SPEED}" >>/etc/default/openmediavault
for i in netatalk samba flashmemory ssh ntp timezone monit rrdcached collectd cpufrequtils ; do
/usr/sbin/omv-mkconf $i
done
if [ -x /usr/sbin/omv-mkconf ]; then
for i in netatalk samba flashmemory ssh ntp timezone monit rrdcached collectd cpufrequtils ; do
/usr/sbin/omv-mkconf $i
done
fi
# Hardkernel Cloudshell 1 and 2 fixes, read the whole thread for details:
# https://forum.openmediavault.org/index.php/Thread/17855
......@@ -659,9 +690,12 @@ case ${BOARD} in
bananapim3|nanopifire3|nanopct3plus|nanopim3)
HMP_Fix='; taskset -c -p 4-7 $i '
;;
nanopct4|odroidn1|renegade-elite|rockpro64)
*rk3399*|*edge*|nanopct4|nanopim4|nanopineo4|renegade-elite|rockpi-4*|rockpro64)
HMP_Fix='; taskset -c -p 4-5 $i '
;;
odroidn2)
HMP_Fix='; taskset -c -p 2-5 $i '
;;
esac
# Helios4 tweak
......@@ -673,23 +707,32 @@ if [ ${BOARD} == "helios4" ]; then
fi
fi
# Add a cron job to make NAS processes more snappy
# Add a cron job to make NAS processes more snappy and silence rsyslog
systemctl status rsyslog >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo ':msg, contains, "do ionice -c1" ~' >/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "action " ~' >>/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "netsnmp_assert" ~' >>/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "Failed to initiate sched scan" ~' >>/etc/rsyslog.d/omv-armbian.conf
systemctl restart rsyslog
fi
echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ionice -c1 -p \$i ${HMP_Fix}; done >/dev/null 2>&1" >/etc/cron.d/make_nas_processes_faster
chmod 600 /etc/cron.d/make_nas_processes_faster
# Fix python bug upstream Debian 9 obviously ignores
if [ /usr/lib/python3.5/weakref.py ]; then
wget -O /usr/lib/python3.5/weakref.py \
https://raw.githubusercontent.com/python/cpython/9cd7e17640a49635d1c1f8c2989578a8fc2c1de6/Lib/weakref.py
fi
/usr/sbin/omv-initsystem
# finishing steps
case $distribution in
stretch)
# Fix python bug upstream Debian 9 obviously ignores
if [ /usr/lib/python3.5/weakref.py ]; then
wget -O /usr/lib/python3.5/weakref.py \
https://raw.githubusercontent.com/python/cpython/9cd7e17640a49635d1c1f8c2989578a8fc2c1de6/Lib/weakref.py
fi
/usr/sbin/omv-initsystem
;;
buster)
/usr/sbin/omv-confdbadm populate
;;
esac
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment