Skip to content

Commit

Permalink
Add InstallOpenMediaVault function
Browse files Browse the repository at this point in the history
Together with last commit Armbian's build system can now create proper OMV 3 images for ~50 SBC.
  • Loading branch information
Thomas Kaiser committed Apr 2, 2017
1 parent ca3637c commit 04583b2
Showing 1 changed file with 91 additions and 11 deletions.
102 changes: 91 additions & 11 deletions scripts/customize-image.sh.template
Expand Up @@ -13,14 +13,94 @@ LINUXFAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4

case $RELEASE in
jessie)
# your code here
;;
xenial)
# your code here
;;
stretch)
# your code here
;;
esac
Main() {
case $RELEASE in
jessie)
# your code here
# InstallOpenMediaVault # uncomment to get an OMV 3 image
;;
xenial)
# your code here
;;
stretch)
# your code here
;;
esac
} # 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
#
# 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.
#
# This routine is based on idea/code courtesy Benny Stark. For fixes,
# discussion and feature requests please refer to
# https://forum.armbian.com/index.php?/topic/2644-openmediavault-3x-customize-imagesh/

echo root:openmediavault | chpasswd
rm /root/.not_logged_in_yet
echo "openmediavault" > /etc/hostname
sed -i -e "s/^::1 localhost.*/::1 localhost openmediavault ip6-localhost ip6-loopback/" \
-e "s/^127.0.0.1 localhost.*/127.0.0.1 localhost openmediavault/" /etc/hosts
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C
export LC_ALL="en_US.UTF-8"
export DEBIAN_FRONTEND=noninteractive

#Add OMV source.list and Update System
cat > /etc/apt/sources.list.d/openmediavault.list << EOF
deb http://packages.openmediavault.org/public erasmus main
## Uncomment the following line to add software from the proposed repository.
# deb http://packages.openmediavault.org/public erasmus-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
EOF
apt-get update

# Add OMV and OMV Plugin developer keys
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 for postfix 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 openmediavault

#install OMV extras
wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all3.deb -O /tmp/omvextras3.deb
dpkg -i /tmp/omvextras3.deb && rm -f /tmp/omvextras3.deb
/usr/sbin/omv-update

# Tidy up
apt-get autoremove
apt-get autoclean

#remove/enabled some services
systemctl disable tftpd-hpa
systemctl disable proftpd
systemctl disable nfs-kernel-server
systemctl disable nfs-common
systemctl disable snmpd
systemctl disable nmbd
systemctl disable samba-ad-dc
systemctl disable smbd
systemctl enable ssh
sed -i '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml

#FIX TFTPD ipv4
sed -i 's/--secure/--secure --ipv4/' /etc/default/tftpd-hpa

#adding omv-initsystem to firstrun -- q&d but shouldn't matter
echo "/usr/sbin/omv-initsystem" >> /etc/init.d/firstrun
} # InstallOpenMediaVault

Main "$@"

9 comments on commit 04583b2

@igorpecovnik
Copy link
Member

Choose a reason for hiding this comment

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

This recipe does not work for me, while this does:
https://github.com/igorpecovnik/Debian-micro-home-server/blob/dev/functions.sh#L216-L243
but it's not fixed for both (Jessie and Xenial) yet.

@ThomasKaiser
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I trusted in user's contribution here without even testing it (runs now). Now scheduled for later compatibility testing with Jessie, Xenial and Stretch. In case you suceed with Jessie/Xenial in the meantime please drop a note here. I will postpone any work on this until NEO Plus 2 arrived since the NAS use case will also be a test candidate for 32-bit userland evaluation (#645).

@ThomasKaiser
Copy link
Contributor

@ThomasKaiser ThomasKaiser commented on 04583b2 Apr 2, 2017

Choose a reason for hiding this comment

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

Should we also look into a subtly branding (a small 'powered by Armbian' somewhere)?

@igorpecovnik
Copy link
Member

Choose a reason for hiding this comment

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

Haven't got there yet. Fixing ISP config install problems now, but I'll check / fix this too ASAP. Branding, sure, why not.

@igorpecovnik
Copy link
Member

Choose a reason for hiding this comment

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

I dump the idea to have it fix for Xenial. Waste of time.

@ThomasKaiser
Copy link
Contributor

Choose a reason for hiding this comment

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

I dump the idea to have it fix for Xenial

Second that. Let's focus on Jessie here (and Stretch later). For my NAS tests I will simply use Samba and Netatalk built from sources.

@igorpecovnik
Copy link
Member

Choose a reason for hiding this comment

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

OMV now install fine with my script, but needs to be further tested ... at least no errors on install and it looks that works ok. There is no need to disable any services since all are down by default. Will continue on this tomorrow.

@ThomasKaiser
Copy link
Contributor

@ThomasKaiser ThomasKaiser commented on 04583b2 Apr 3, 2017

Choose a reason for hiding this comment

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

BTW: With Stretch OMV also fails to install due to PHP5 dependencies. So let's skip this entirely, wait until OMV folks fix their dependencies with a new release (if they ever think about supporting Stretch) and from then on it should work with both Stretch and Xenial.

Am currently testing installation routine with your code and if it succeeds will send a new commit.

@ThomasKaiser
Copy link
Contributor

Choose a reason for hiding this comment

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

'Nice': OMV overwrites /etc/default/cpufrequtils with garbage (suitable only for Intel boxes):

ENABLE="true"
GOVERNOR="conservative"
MAX_SPEED="0"
MIN_SPEED="0"

I currently try to restore our custom cpufreq settings and also deal with hostname issues when adding OMV as part of image creation :)

Please sign in to comment.