[OMV] Small installer tweaks, OMV4 preparation done

This commit is contained in:
ThomasKaiser 2017-09-03 23:53:15 -07:00
parent da47ae207b
commit 9a217b3603
2 changed files with 34 additions and 35 deletions

View File

@ -32,15 +32,14 @@ Main() {
} # Main
InstallOpenMediaVault() {
# use this routine to create a Debian Jessie based fully functional
# OpenMediaVault 3 OS image. Use of mainline kernel highly recommended!
# After exchanging userpatches/customize-image.sh or at least uncommenting
# InstallOpenMediaVault line above you would then run this for a NEO 2
# for example: ./compile.sh RELEASE=jessie BRANCH=dev BOARD=nanopineo2
# use this routine to create a Debian based fully functional OpenMediaVault
# image (OMV 3 on Jessie, OMV 4 with Stretch). Use of mainline kernel highly
# recommended!
#
# Please note that this variant changes Armbian default security
# policies since you end up with root password 'openmediavault' which
# you have to change yourself later.
# you have to change yourself later. SSH login as root has to be enabled
# through OMV web UI first
#
# This routine is based on idea/code courtesy Benny Stark. For fixes,
# discussion and feature requests please refer to
@ -49,21 +48,28 @@ InstallOpenMediaVault() {
echo root:openmediavault | chpasswd
rm /root/.not_logged_in_yet
cp -p /etc/default/cpufrequtils /etc/default/cpufrequtils.bak
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C LC_ALL="en_US.UTF-8"
case ${RELEASE} in
jessie)
OMV_Name="erasmus"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all3.deb"
;;
stretch)
OMV_Name="arrakis"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all4.deb"
;;
esac
#Add OMV source.list and Update System
cat > /etc/apt/sources.list.d/openmediavault.list <<- EOF
# deb http://packages.openmediavault.org/public erasmus main
deb https://openmediavault.github.io/packages/ erasmus main
deb https://openmediavault.github.io/packages/ ${OMV_Name} main
## Uncomment the following line to add software from the proposed repository.
# deb http://packages.openmediavault.org/public erasmus-proposed main
deb https://openmediavault.github.io/packages/ erasmus-proposed main
deb https://openmediavault.github.io/packages/ ${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 http://packages.openmediavault.org/public erasmus partner
# deb https://openmediavault.github.io/packages/ ${OMV_Name} partner
EOF
# Add OMV and OMV Plugin developer keys, add Cloudshell 2 repo for XU4
@ -71,20 +77,19 @@ InstallOpenMediaVault() {
add-apt-repository -y ppa:kyle1117/ppa
sed -i 's/jessie/xenial/' /etc/apt/sources.list.d/kyle1117-ppa-jessie.list
fi
debconf-apt-progress -- apt-get update
apt-get update
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
# install debconf-utils, postfix and OMV
debconf-set-selections <<< "postfix postfix/mailname string openmediavault"
HOSTNAME="${BOARD}"
debconf-set-selections <<< "postfix postfix/mailname string ${HOSTNAME}"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
debconf-utils postfix
# move newaliases temporarely out of the way (see Ubuntu bug 1531299)
cp -p /usr/bin/newaliases /usr/bin/newaliases.bak && ln -sf /bin/true /usr/bin/newaliases
# set hostname
read HOSTNAME </etc/hostname
sed -i -e "s/^::1 localhost.*/::1 ${HOSTNAME} localhost ip6-localhost ip6-loopback/" \
-e "s/^127.0.0.1 localhost.*/127.0.0.1 ${HOSTNAME} localhost/" /etc/hosts
sed -i -e "s/^mydestination =.*/mydestination = ${HOSTNAME}, localhost.localdomain, localhost/" \
@ -96,25 +101,27 @@ InstallOpenMediaVault() {
# install OMV extras, enable folder2ram, zram, tweak some settings
FILE=$(mktemp)
wget https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all3.deb -qO $FILE && dpkg -i $FILE
wget "$OMV_EXTRAS_URL" -qO $FILE && dpkg -i $FILE
wget https://mirrors.kernel.org/ubuntu/pool/universe/z/zram-config/zram-config_0.5_all.deb -qO $FILE && dpkg -i $FILE
/usr/sbin/omv-update
# Install flashmemory plugin and netatalk by default, use nice logo for the latter
# Install flashmemory plugin and netatalk by default, use nice logo for the latter,
# tweak some OMV settings
. /usr/share/openmediavault/scripts/helper-functions
apt-get -y -q install openmediavault-netatalk openmediavault-flashmemory
AFP_Options="mimic model = Macmini"
xmlstarlet ed -L -u "/config/services/afp/extraoptions" -v "$(echo -e "${AFP_Options}")" \
/etc/openmediavault/config.xml
/usr/sbin/omv-mkconf netatalk
# use folder2ram instead of log2ram with OMV, configure services
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}")" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/flashmemory/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/ssh/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/ssh/permitrootlogin" -v "0" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/time/ntp/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/time/timezone" -v "UTC" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/network/dns/hostname" -v "${HOSTNAME}" /etc/openmediavault/config.xml
/usr/sbin/omv-mkconf flashmemory
/usr/sbin/omv-mkconf ssh
/usr/sbin/omv-mkconf ntp
for i in netatalk samba flashmemory ssh ntp timezone ; do
/usr/sbin/omv-mkconf $i
done
systemctl disable log2ram
rm /etc/cron.daily/log2ram
/sbin/folder2ram -enablesystemd
@ -146,9 +153,6 @@ InstallOpenMediaVault() {
/usr/sbin/omv-mkconf monit \
/usr/sbin/omv-mkconf rrdcached \
/usr/sbin/omv-mkconf collectd \
FILE=$(mktemp) \
wget https://mirrors.kernel.org/ubuntu/pool/universe/z/zram-config/zram-config_0.5_all.deb -qO $FILE \
dpkg -i $FILE \
lsusb | egrep -q "0b95:1790|0b95:178a|0df6:0072" || sed -i "/ax88179_178a/d" /etc/modules' /etc/init.d/firstrun
sed -i '/systemctl\ disable\ firstrun/a \
sync && sleep 30 && reboot' /etc/init.d/firstrun
@ -157,11 +161,6 @@ InstallOpenMediaVault() {
echo -e "r8152\nax88179_178a" >>/etc/modules
egrep -q "air|neo|zero" <<<${BOARD} && echo "overlays=usbhost0 usbhost2 usbhost3" >>/boot/armbianEnv.txt
# some performance tuning: Samba, cpufreq behaviour, IO scheduling/priority
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/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" ${OMV_CONFIG_FILE}
/usr/sbin/omv-mkconf samba
# Special treatment for ODROID-XU4 (and later Amlogic S912, RK3399 and other big.LITTLE
# based devices). Move all NAS daemons to the big cores.
# to 1MB: https://forum.odroid.com/viewtopic.php?f=146&t=26016&start=200#p197729

View File

@ -10,7 +10,7 @@
# common options
# daily beta build contains date in subrevision
if [[ $BETA == yes && -z $SUBREVISION ]]; then SUBREVISION="."$(date --date="tomorrow" +"%y%m%d"); fi
REVISION="5.32$SUBREVISION" # all boards have same revision
REVISION="5.33$SUBREVISION" # all boards have same revision
ROOTPWD="1234" # Must be changed @first login
MAINTAINER="Igor Pecovnik" # deb signature
MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature