BennySt
-
Posts
6 -
Joined
-
Last visited
Reputation Activity
-
BennySt got a reaction from atomic77 in Openmediavault 3.x customize-image.sh
Hi,
I'am the new one. I'am German and bought last month an OrangePi PC+ from AliExpress without a clue what todo with it, but it was cheap ;-) And it was perfect for my new OMV.
Just installing OMV on top of Armbian / Jessie was not enough because of missing Quota Kernel Options. When setting up a development Enviroment, I found the excellent Build-Scripts of Armbian and thought, why not making an OMV-Image with the customize-image.sh.
And here is it (quick and dirty v0.1) Just copy it with a modified kernel.config under userpatches.
It should work with every supported Armbian Board as long as its working with Debian Jessie, because it installes OMV3.X
I compiled my Image with the legacy Kernel but it should also work with mainline.
If wanted I can build some Images for testing.
Please give some feedback or critics, I hope its helpfull for someone.
Sorry for attaching this as Code but I can't upload attachments?
#!/bin/bash
#################################################################################################################################
## customize-image.sh - for installing openmediavault 3
##
## installs omv, omv-extras, omv-flashmemory
## and making some changes to the System
## started in chroot from /tmp
##
## arguments: $RELEASE $FAMILY $BOARD $BUILD_DESKTOP
##
## Author : Benny St <Benny_Stark@live.de>
## Version : 0.1
##
## Version 0.1 - first Release
##
#################################################################################################################################
RELEASE=$1
FAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4
#Modified display alert from lib/general.sh
display_alert()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's have unique way of displaying alerts
#--------------------------------------------------------------------------------------------------------------------------------
{
# log function parameters to install.log
#[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
case $3 in
err)
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
;;
wrn)
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
;;
ext)
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
;;
info)
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
;;
*)
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
;;
esac
}
case $RELEASE in
wheezy)
# your code here
;;
jessie)
#change root passs first
#else we get some configure-errors
display_alert "Change Root PW" "custom-image.sh" "info"
echo root:openmediavault|chpasswd
display_alert "Change /etc/hostname" "custom-image.sh" "info"
echo "openmediavault" > /etc/hostname ## works after reboot
#generate locales
#they are not there
display_alert "Generate Locals and set them" "custom-image.sh" "info"
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C
export LC_ALL="en_US.UTF-8"
#Unattended apt-get
export DEBIAN_FRONTEND=noninteractive
#Add OMV source.list and Update System
display_alert "Adding OMV-Repo erasmus and update" "custom-image.sh" "info"
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
# OMV Key
display_alert "Install OMV Keys" "custom-image.sh" "info"
#wget -O - packages.openmediavault.org/public/archive.key | apt-key add -
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
# OMV Plugin developer Key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
#install debconf-utils for postfix configuration
display_alert "Install debconf-utils" "custom-image.sh" "info"
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
#install postfix
#Postfix configuration
display_alert "Install postfix and configure it - No configuration" "custom-image.sh" "info"
debconf-set-selections <<< "postfix postfix/main_mailer_type select 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 postfix
#install OMV
#--allow-unauthenticated because openmediavault-keyring doesn't contain all keys???
display_alert "Install OMV" "custom-image.sh" "info"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install openmediavault
#install OMV extras
display_alert "Download and install OMV Keys" "custom-image.sh" "info"
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
#install openmediavault-flashmemory
display_alert "Install openmediavault-flashmemory" "custom-image.sh" "info"
apt-get --yes --force-yes --fix-missing --no-install-recommends install openmediavault-flashmemory
sed -i '/<flashmemory>/,/<\/flashmemory>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
/usr/sbin/omv-mkconf flashmemory
# Tidy up
display_alert "apt-get autoremove / autoclean" "custom-image.sh" "info"
apt-get autoremove
apt-get autoclean
#remove first-login Script
display_alert "Remove first-login Script" "custom-image.sh" "info"
rm /root/.not_logged_in_yet
#remove some services
#ändern auf systemctl enable dienstname.service
# /etc/systemd/system, /run/systemd/system, /usr/local/lib/systemd/system, and /usr/lib/systemd/system are four of those directories.
display_alert "Disable Services - tftpd-hpa, proftpd, nfs-common, smbd, snmpd, ssh"
#tftpd-hpa.service
systemctl disable tftpd-hpa
#proftpd.service
systemctl disable proftpd
#nfs-kernel-server.service
#nfs-common.service
systemctl disable nfs-kernel-server
systemctl disable nfs-common
#snmpd.service
systemctl disable snmpd
#samba.service
systemctl disable nmbd
systemctl disable samba-ad-dc
systemctl disable smbd
#ssh.service
#systemctl disable ssh
display_alert "SSH enable" "custom-image.sh" "info"
systemctl enable ssh
sed -i '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
#FIX TFTPD ipv4?
display_alert "tftpd-hpa ipv4 startup fix" "custom-image.sh" "info"
sed -i 's/--secure/--secure --ipv4/' /etc/default/tftpd-hpa
#adding omv-initsystem to firststart
display_alert "adding omv-initsystem to firstrun" "custom-image.sh" "info"
echo "/usr/sbin/omv-initsystem" >> /etc/init.d/firstrun
#debug shell
#/bin/bash
;;
trusty)
# your code here
;;
xenial)
# your code here
;;
esac
-
BennySt reacted to tkaiser in Openmediavault 3.x customize-image.sh
@BennyStin the meantime we 'stole' your idea, fixed the kernel configs to meet OMV requirements and tried to integrate OMV installation in an unattended way with image creation. Feedback welcome!
-
BennySt got a reaction from gnasch in Openmediavault 3.x customize-image.sh
Hi,
I'am the new one. I'am German and bought last month an OrangePi PC+ from AliExpress without a clue what todo with it, but it was cheap ;-) And it was perfect for my new OMV.
Just installing OMV on top of Armbian / Jessie was not enough because of missing Quota Kernel Options. When setting up a development Enviroment, I found the excellent Build-Scripts of Armbian and thought, why not making an OMV-Image with the customize-image.sh.
And here is it (quick and dirty v0.1) Just copy it with a modified kernel.config under userpatches.
It should work with every supported Armbian Board as long as its working with Debian Jessie, because it installes OMV3.X
I compiled my Image with the legacy Kernel but it should also work with mainline.
If wanted I can build some Images for testing.
Please give some feedback or critics, I hope its helpfull for someone.
Sorry for attaching this as Code but I can't upload attachments?
#!/bin/bash
#################################################################################################################################
## customize-image.sh - for installing openmediavault 3
##
## installs omv, omv-extras, omv-flashmemory
## and making some changes to the System
## started in chroot from /tmp
##
## arguments: $RELEASE $FAMILY $BOARD $BUILD_DESKTOP
##
## Author : Benny St <Benny_Stark@live.de>
## Version : 0.1
##
## Version 0.1 - first Release
##
#################################################################################################################################
RELEASE=$1
FAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4
#Modified display alert from lib/general.sh
display_alert()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's have unique way of displaying alerts
#--------------------------------------------------------------------------------------------------------------------------------
{
# log function parameters to install.log
#[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
case $3 in
err)
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
;;
wrn)
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
;;
ext)
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
;;
info)
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
;;
*)
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
;;
esac
}
case $RELEASE in
wheezy)
# your code here
;;
jessie)
#change root passs first
#else we get some configure-errors
display_alert "Change Root PW" "custom-image.sh" "info"
echo root:openmediavault|chpasswd
display_alert "Change /etc/hostname" "custom-image.sh" "info"
echo "openmediavault" > /etc/hostname ## works after reboot
#generate locales
#they are not there
display_alert "Generate Locals and set them" "custom-image.sh" "info"
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C
export LC_ALL="en_US.UTF-8"
#Unattended apt-get
export DEBIAN_FRONTEND=noninteractive
#Add OMV source.list and Update System
display_alert "Adding OMV-Repo erasmus and update" "custom-image.sh" "info"
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
# OMV Key
display_alert "Install OMV Keys" "custom-image.sh" "info"
#wget -O - packages.openmediavault.org/public/archive.key | apt-key add -
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
# OMV Plugin developer Key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
#install debconf-utils for postfix configuration
display_alert "Install debconf-utils" "custom-image.sh" "info"
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
#install postfix
#Postfix configuration
display_alert "Install postfix and configure it - No configuration" "custom-image.sh" "info"
debconf-set-selections <<< "postfix postfix/main_mailer_type select 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 postfix
#install OMV
#--allow-unauthenticated because openmediavault-keyring doesn't contain all keys???
display_alert "Install OMV" "custom-image.sh" "info"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install openmediavault
#install OMV extras
display_alert "Download and install OMV Keys" "custom-image.sh" "info"
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
#install openmediavault-flashmemory
display_alert "Install openmediavault-flashmemory" "custom-image.sh" "info"
apt-get --yes --force-yes --fix-missing --no-install-recommends install openmediavault-flashmemory
sed -i '/<flashmemory>/,/<\/flashmemory>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
/usr/sbin/omv-mkconf flashmemory
# Tidy up
display_alert "apt-get autoremove / autoclean" "custom-image.sh" "info"
apt-get autoremove
apt-get autoclean
#remove first-login Script
display_alert "Remove first-login Script" "custom-image.sh" "info"
rm /root/.not_logged_in_yet
#remove some services
#ändern auf systemctl enable dienstname.service
# /etc/systemd/system, /run/systemd/system, /usr/local/lib/systemd/system, and /usr/lib/systemd/system are four of those directories.
display_alert "Disable Services - tftpd-hpa, proftpd, nfs-common, smbd, snmpd, ssh"
#tftpd-hpa.service
systemctl disable tftpd-hpa
#proftpd.service
systemctl disable proftpd
#nfs-kernel-server.service
#nfs-common.service
systemctl disable nfs-kernel-server
systemctl disable nfs-common
#snmpd.service
systemctl disable snmpd
#samba.service
systemctl disable nmbd
systemctl disable samba-ad-dc
systemctl disable smbd
#ssh.service
#systemctl disable ssh
display_alert "SSH enable" "custom-image.sh" "info"
systemctl enable ssh
sed -i '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
#FIX TFTPD ipv4?
display_alert "tftpd-hpa ipv4 startup fix" "custom-image.sh" "info"
sed -i 's/--secure/--secure --ipv4/' /etc/default/tftpd-hpa
#adding omv-initsystem to firststart
display_alert "adding omv-initsystem to firstrun" "custom-image.sh" "info"
echo "/usr/sbin/omv-initsystem" >> /etc/init.d/firstrun
#debug shell
#/bin/bash
;;
trusty)
# your code here
;;
xenial)
# your code here
;;
esac
-
BennySt got a reaction from Igor in Openmediavault 3.x customize-image.sh
Hi,
I'am the new one. I'am German and bought last month an OrangePi PC+ from AliExpress without a clue what todo with it, but it was cheap ;-) And it was perfect for my new OMV.
Just installing OMV on top of Armbian / Jessie was not enough because of missing Quota Kernel Options. When setting up a development Enviroment, I found the excellent Build-Scripts of Armbian and thought, why not making an OMV-Image with the customize-image.sh.
And here is it (quick and dirty v0.1) Just copy it with a modified kernel.config under userpatches.
It should work with every supported Armbian Board as long as its working with Debian Jessie, because it installes OMV3.X
I compiled my Image with the legacy Kernel but it should also work with mainline.
If wanted I can build some Images for testing.
Please give some feedback or critics, I hope its helpfull for someone.
Sorry for attaching this as Code but I can't upload attachments?
#!/bin/bash
#################################################################################################################################
## customize-image.sh - for installing openmediavault 3
##
## installs omv, omv-extras, omv-flashmemory
## and making some changes to the System
## started in chroot from /tmp
##
## arguments: $RELEASE $FAMILY $BOARD $BUILD_DESKTOP
##
## Author : Benny St <Benny_Stark@live.de>
## Version : 0.1
##
## Version 0.1 - first Release
##
#################################################################################################################################
RELEASE=$1
FAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4
#Modified display alert from lib/general.sh
display_alert()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's have unique way of displaying alerts
#--------------------------------------------------------------------------------------------------------------------------------
{
# log function parameters to install.log
#[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
case $3 in
err)
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
;;
wrn)
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
;;
ext)
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
;;
info)
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
;;
*)
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
;;
esac
}
case $RELEASE in
wheezy)
# your code here
;;
jessie)
#change root passs first
#else we get some configure-errors
display_alert "Change Root PW" "custom-image.sh" "info"
echo root:openmediavault|chpasswd
display_alert "Change /etc/hostname" "custom-image.sh" "info"
echo "openmediavault" > /etc/hostname ## works after reboot
#generate locales
#they are not there
display_alert "Generate Locals and set them" "custom-image.sh" "info"
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C
export LC_ALL="en_US.UTF-8"
#Unattended apt-get
export DEBIAN_FRONTEND=noninteractive
#Add OMV source.list and Update System
display_alert "Adding OMV-Repo erasmus and update" "custom-image.sh" "info"
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
# OMV Key
display_alert "Install OMV Keys" "custom-image.sh" "info"
#wget -O - packages.openmediavault.org/public/archive.key | apt-key add -
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
# OMV Plugin developer Key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
#install debconf-utils for postfix configuration
display_alert "Install debconf-utils" "custom-image.sh" "info"
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
#install postfix
#Postfix configuration
display_alert "Install postfix and configure it - No configuration" "custom-image.sh" "info"
debconf-set-selections <<< "postfix postfix/main_mailer_type select 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 postfix
#install OMV
#--allow-unauthenticated because openmediavault-keyring doesn't contain all keys???
display_alert "Install OMV" "custom-image.sh" "info"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install openmediavault
#install OMV extras
display_alert "Download and install OMV Keys" "custom-image.sh" "info"
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
#install openmediavault-flashmemory
display_alert "Install openmediavault-flashmemory" "custom-image.sh" "info"
apt-get --yes --force-yes --fix-missing --no-install-recommends install openmediavault-flashmemory
sed -i '/<flashmemory>/,/<\/flashmemory>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
/usr/sbin/omv-mkconf flashmemory
# Tidy up
display_alert "apt-get autoremove / autoclean" "custom-image.sh" "info"
apt-get autoremove
apt-get autoclean
#remove first-login Script
display_alert "Remove first-login Script" "custom-image.sh" "info"
rm /root/.not_logged_in_yet
#remove some services
#ändern auf systemctl enable dienstname.service
# /etc/systemd/system, /run/systemd/system, /usr/local/lib/systemd/system, and /usr/lib/systemd/system are four of those directories.
display_alert "Disable Services - tftpd-hpa, proftpd, nfs-common, smbd, snmpd, ssh"
#tftpd-hpa.service
systemctl disable tftpd-hpa
#proftpd.service
systemctl disable proftpd
#nfs-kernel-server.service
#nfs-common.service
systemctl disable nfs-kernel-server
systemctl disable nfs-common
#snmpd.service
systemctl disable snmpd
#samba.service
systemctl disable nmbd
systemctl disable samba-ad-dc
systemctl disable smbd
#ssh.service
#systemctl disable ssh
display_alert "SSH enable" "custom-image.sh" "info"
systemctl enable ssh
sed -i '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
#FIX TFTPD ipv4?
display_alert "tftpd-hpa ipv4 startup fix" "custom-image.sh" "info"
sed -i 's/--secure/--secure --ipv4/' /etc/default/tftpd-hpa
#adding omv-initsystem to firststart
display_alert "adding omv-initsystem to firstrun" "custom-image.sh" "info"
echo "/usr/sbin/omv-initsystem" >> /etc/init.d/firstrun
#debug shell
#/bin/bash
;;
trusty)
# your code here
;;
xenial)
# your code here
;;
esac
-
BennySt got a reaction from tkaiser in Openmediavault 3.x customize-image.sh
Hi,
I'am the new one. I'am German and bought last month an OrangePi PC+ from AliExpress without a clue what todo with it, but it was cheap ;-) And it was perfect for my new OMV.
Just installing OMV on top of Armbian / Jessie was not enough because of missing Quota Kernel Options. When setting up a development Enviroment, I found the excellent Build-Scripts of Armbian and thought, why not making an OMV-Image with the customize-image.sh.
And here is it (quick and dirty v0.1) Just copy it with a modified kernel.config under userpatches.
It should work with every supported Armbian Board as long as its working with Debian Jessie, because it installes OMV3.X
I compiled my Image with the legacy Kernel but it should also work with mainline.
If wanted I can build some Images for testing.
Please give some feedback or critics, I hope its helpfull for someone.
Sorry for attaching this as Code but I can't upload attachments?
#!/bin/bash
#################################################################################################################################
## customize-image.sh - for installing openmediavault 3
##
## installs omv, omv-extras, omv-flashmemory
## and making some changes to the System
## started in chroot from /tmp
##
## arguments: $RELEASE $FAMILY $BOARD $BUILD_DESKTOP
##
## Author : Benny St <Benny_Stark@live.de>
## Version : 0.1
##
## Version 0.1 - first Release
##
#################################################################################################################################
RELEASE=$1
FAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4
#Modified display alert from lib/general.sh
display_alert()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's have unique way of displaying alerts
#--------------------------------------------------------------------------------------------------------------------------------
{
# log function parameters to install.log
#[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
case $3 in
err)
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
;;
wrn)
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
;;
ext)
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
;;
info)
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
;;
*)
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
;;
esac
}
case $RELEASE in
wheezy)
# your code here
;;
jessie)
#change root passs first
#else we get some configure-errors
display_alert "Change Root PW" "custom-image.sh" "info"
echo root:openmediavault|chpasswd
display_alert "Change /etc/hostname" "custom-image.sh" "info"
echo "openmediavault" > /etc/hostname ## works after reboot
#generate locales
#they are not there
display_alert "Generate Locals and set them" "custom-image.sh" "info"
locale-gen "en_US.UTF-8"
locale-gen "C"
export LANG=C
export LC_ALL="en_US.UTF-8"
#Unattended apt-get
export DEBIAN_FRONTEND=noninteractive
#Add OMV source.list and Update System
display_alert "Adding OMV-Repo erasmus and update" "custom-image.sh" "info"
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
# OMV Key
display_alert "Install OMV Keys" "custom-image.sh" "info"
#wget -O - packages.openmediavault.org/public/archive.key | apt-key add -
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
# OMV Plugin developer Key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
#install debconf-utils for postfix configuration
display_alert "Install debconf-utils" "custom-image.sh" "info"
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
#install postfix
#Postfix configuration
display_alert "Install postfix and configure it - No configuration" "custom-image.sh" "info"
debconf-set-selections <<< "postfix postfix/main_mailer_type select 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 postfix
#install OMV
#--allow-unauthenticated because openmediavault-keyring doesn't contain all keys???
display_alert "Install OMV" "custom-image.sh" "info"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install openmediavault
#install OMV extras
display_alert "Download and install OMV Keys" "custom-image.sh" "info"
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
#install openmediavault-flashmemory
display_alert "Install openmediavault-flashmemory" "custom-image.sh" "info"
apt-get --yes --force-yes --fix-missing --no-install-recommends install openmediavault-flashmemory
sed -i '/<flashmemory>/,/<\/flashmemory>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
/usr/sbin/omv-mkconf flashmemory
# Tidy up
display_alert "apt-get autoremove / autoclean" "custom-image.sh" "info"
apt-get autoremove
apt-get autoclean
#remove first-login Script
display_alert "Remove first-login Script" "custom-image.sh" "info"
rm /root/.not_logged_in_yet
#remove some services
#ändern auf systemctl enable dienstname.service
# /etc/systemd/system, /run/systemd/system, /usr/local/lib/systemd/system, and /usr/lib/systemd/system are four of those directories.
display_alert "Disable Services - tftpd-hpa, proftpd, nfs-common, smbd, snmpd, ssh"
#tftpd-hpa.service
systemctl disable tftpd-hpa
#proftpd.service
systemctl disable proftpd
#nfs-kernel-server.service
#nfs-common.service
systemctl disable nfs-kernel-server
systemctl disable nfs-common
#snmpd.service
systemctl disable snmpd
#samba.service
systemctl disable nmbd
systemctl disable samba-ad-dc
systemctl disable smbd
#ssh.service
#systemctl disable ssh
display_alert "SSH enable" "custom-image.sh" "info"
systemctl enable ssh
sed -i '/<ssh>/,/<\/ssh>/ s/<enable>0/<enable>1/' /etc/openmediavault/config.xml
#FIX TFTPD ipv4?
display_alert "tftpd-hpa ipv4 startup fix" "custom-image.sh" "info"
sed -i 's/--secure/--secure --ipv4/' /etc/default/tftpd-hpa
#adding omv-initsystem to firststart
display_alert "adding omv-initsystem to firstrun" "custom-image.sh" "info"
echo "/usr/sbin/omv-initsystem" >> /etc/init.d/firstrun
#debug shell
#/bin/bash
;;
trusty)
# your code here
;;
xenial)
# your code here
;;
esac