This repository has been archived on 2023-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
nas-server/setup1.sh

60 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2021-11-12 15:53:21 +01:00
#!/bin/bash
# The purpose of this script is to setup OMV on a blank Armbian.
# This script is to be run as root.
# (Keep in mind that default root password is 1234)
# Flash SBC's SD with Armbian and copy this script as well as setup2.sh (depending of usage) and conf-sync.sh to /root
# YOU SHOULD REMOVE THIS SCRIPT AFTER SETUP
# Functions
init() {
echo "Starting initialization"
echo $hostname > /etc/hostname
sed -i -e "s/=default_hostname/$fqdn $hostname/g" /etc/hosts
localectl set-keymap $keymap
timedatectl set-timezone $timezone
systemctl disable apt-daily-upgrade.timer
}
install_packages() {
echo "Starting packages installation"
sed -i -e "s/$deb_apt_default_repo/$deb_apt_repo/g" /etc/apt/sources.list
apt update
apt upgrade -y
apt install -y vim tree tmux neofetch
}
install_omv() { # This step ends on a reboot, so we part the script here
wget $omv_install_script_link
chmod u+x $run_directory_path/install
bash $run_directory_path/install
}
# Only run if the user is root
if [[ $USER != 'root' ]] ; then
echo "You must run this script as root!"
exit 1
fi
run_directory_path=$(pwd)
# Set parameters
default_hostname='odroidxu4'
hostname='hk1'
fqdn='hk1.kto.black'
keymap='fr'
timezone='Europe/Paris'
deb_apt_default_repo='httpredir.debian.org'
deb_apt_repo='ftp.fr.debian.org'
omv_install_script_link='https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install'
# Main process
# You should comment below what you do not want to happen
init
install_packages
install_omv
exit 0