General installation should work

This commit is contained in:
Alexandre CATTEAU 2023-07-02 12:02:18 +02:00
parent 763962b89c
commit 9e5905562e
3 changed files with 52 additions and 32 deletions

View File

@ -6,12 +6,8 @@ This repository contains files used to setup our SBCs with a freshly installed A
Files in this repository only cover the SBC setup. Files in this repository only cover the SBC setup.
#### Installation #### Installation
* `setup.sh` is a script automating the installation and configuration of required software * `setup.sh` is a script automating the installation and configuration of required software
* `variables.conf.template` contains examples variables definitions, and should be copied locally to `variables.conf`
(with any required modifications).
### TODO ### TODO
* not working as of now * RAS
* set up variables
* add use cases
* SSH bouncer
* Printscan
* UPNP renderer
* NAS server

View File

@ -3,7 +3,14 @@
# (Keep in mind that default root password is 1234) # (Keep in mind that default root password is 1234)
# Flash SBC's SD with Armbian and clone this repository in /root # Flash SBC's SD with Armbian and clone this repository in /root
# YOU SHOULD REMOVE THIS SCRIPT AFTER SETUP run_directory=$(dirname $(readlink -f "$0"))
source "$run_directory/variables.conf"
# Only run if the user is root
if [[ $USER != 'root' ]]; then
echo "You must run this script as root!"
exit 1
fi
# initialization # initialization
echo "Starting initialization" echo "Starting initialization"
@ -14,11 +21,19 @@ systemctl disable apt-daily-upgrade.timer
# install packages # install packages
echo "Starting packages installation" echo "Starting packages installation"
sed -i -e "s/$deb_apt_default_repo/$deb_apt_repo/g" /etc/apt/sources.list #sed -i -e "s/$deb_apt_default_repo/$deb_apt_repo/g" /etc/apt/sources.list
apt update apt update
apt upgrade -y apt upgrade -y
# TODO define $additional-packages, depending on $use-case and $sbc additional_packages=''
apt install -y vim tree tmux neofetch git if [[ $use_case = 'printscan-server' ]]; then
additional_packages+="sane sane-utils hplip apache2"
elif [[ $use_case = 'upnp-renderer' ]]; then
wget -P /usr/share/keyrings/ https://www.lesbonscomptes.com/pages/lesbonscomptes.gpg
wget -P /etc/apt/sources.list.d/ https://www.lesbonscomptes.com/upmpdcli/pages/upmpdcli-rbullseye.list
sed -i -e "s/deb-src/#deb-src/g" /etc/apt/sources.list.d/upmpdcli-rbullseye.list
additional_packages+="mpd upmpdcli"
fi
apt install -y vim tree tmux neofetch git $additional_packages
# add users # add users
echo "Adding users" echo "Adding users"
@ -38,6 +53,11 @@ sudo -H -u $user cp $sync_directory_path/conf-sync/variables.conf.template \
sudo -H -u $user sed -i -e "s/\"desktop\"/\"server\"/g" $sync_directory_path/conf-sync/variables.conf sudo -H -u $user sed -i -e "s/\"desktop\"/\"server\"/g" $sync_directory_path/conf-sync/variables.conf
sudo -H -u $user $sync_directory_path/conf-sync/install.sh sudo -H -u $user $sync_directory_path/conf-sync/install.sh
# set use case config
echo "Getting and deploying use-case $use_case configuration"
sudo -H -u $user git clone https://gitea.kto.black/adminconf/$use_case.git $sync_directory_path/$use_case
# TODO how to start install? We need to define variables
# SSH config # SSH config
echo "Getting SSH public key" echo "Getting SSH public key"
sudo -H -u $user mkdir /home/$user/.ssh sudo -H -u $user mkdir /home/$user/.ssh
@ -48,31 +68,11 @@ sed -i -e "s/#PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/s
sed -i -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config sed -i -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config
# specific function for orangepizero # specific function for orangepizero
if [[ $default_hostname = 'orangepizero' ]]; then if [[ $sbc = 'orangepizero' ]]; then
echo "Setting CPU frequency to performance" echo "Setting CPU frequency to performance"
sed -i -e "s/GOVERNOR=ondemand/GOVERNOR=performance/g" /etc/default/cpufrequtils sed -i -e "s/GOVERNOR=ondemand/GOVERNOR=performance/g" /etc/default/cpufrequtils
fi fi
# 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 TODO replace by a variables.conf
fqdn='pi2.jab.kto.black'
keymap='fr'
timezone='Europe/Paris'
deb_apt_default_repo='deb.debian.org'
deb_apt_repo='ftp.fr.debian.org'
user='alex'
sync_directory_path="/home/$user/.sync"
systemd_units_path='/etc/systemd/system'
remote_pubkey_location='https://keys.kto.black'
remote_pubkey='home.pub'
echo "" echo ""
echo "We're all good here!" echo "We're all good here!"
echo "You should now:" echo "You should now:"

24
variables.conf.template Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copy this file as variables.conf, with the correct values
fqdn=''
keymap='fr'
timezone='Europe/Paris'
#deb_apt_default_repo='deb.debian.org'
#deb_apt_repo='ftp.fr.debian.org'
user='alex'
sync_directory_path="/home/$user/.sync"
remote_pubkey_location='https://keys.kto.black'
remote_pubkey='home.pub'
# Choose one of the following use cases:
#use_case='upnp-renderer'
#use_case='ssh-bounce-server'
#use-case='printscan-server'
#use-case='nas-server'
# Choose one of the following SBC:
#sbc='pine64'
#sbc='orangepizero'
#sbc='odroidhc2'