clean old code and prepare ground for future conf-sync

This commit is contained in:
Alexandre CATTEAU 2022-03-11 16:08:54 +01:00
parent 524c6e99a9
commit ced8abb228

View File

@ -33,35 +33,30 @@ add_users() {
usermod -a -G lp saned usermod -a -G lp saned
} }
get_conf() { # TODO get_conf() { # TODO when new conf-sync will be available
echo "Getting configuration" echo "Getting configuration"
sudo -H -u $user mkdir $sync_directory_path sudo -H -u $user mkdir $sync_directory_path
cp $run_directory_path/conf-sync.sh $sync_directory_path/
chown $user:$user $sync_directory_path/conf-sync.sh git clone https://gitea.kto.black/adminconf/rcs-general.git $sync_directory_path/rcs-general
sudo -H -u $user chmod u+x $sync_directory_path/conf-sync.sh # git clone confsync-du-futur
sudo -H -u $user $sync_directory_path/conf-sync.sh
} }
set_conf() { # TODO set_conf() { # TODO when new conf-sync will be available
echo "Setting configuration" echo "Setting configuration"
ln -s $sync_directory_path/conf-sync-server.timer $systemd_units_path/conf-sync.timer # deploy confsync-du-futur
ln -s $sync_directory_path/*.service $systemd_units_path/
systemctl daemon-reload
systemctl enable conf-sync.timer
} }
set_cups_conf() { set_cups_conf() {
echo "Setting CUPS configuration" echo "Setting CUPS configuration"
mv $cups_conf_path/cupsd.conf $cups_conf_path/cupsd.conf.orig mv $cups_conf_path/cupsd.conf $cups_conf_path/cupsd.conf.orig
ln -s $sync_directory_path/cupsd.conf $cups_conf_path/cupsd.conf # TODO cp $run_directory_path/cupsd.conf $cups_conf_path/cupsd.conf
} }
set_sane_conf() { # TODO set_sane_conf() {
echo $printscan_container_ip >> /etc/sane.d/saned.conf
systemctl enable saned.socket systemctl enable saned.socket
} }
rcs_links() { rcs_links() { # NOTE this should be handled by an install script in rcs-general
echo "Linking rcs" echo "Linking rcs"
rm /home/$user/.bashrc rm /home/$user/.bashrc
rm /root/.bashrc rm /root/.bashrc
@ -91,18 +86,15 @@ run_directory_path=$(pwd)
# Set parameters # Set parameters
default_hostname='pine64' default_hostname='pine64'
hostname='pn1' hostname='pn1'
fqdn='pn1.kto.black' fqdn='pn1.hr.kto.black'
keymap='fr' keymap='fr'
timezone='Europe/Paris' timezone='Europe/Paris'
deb_apt_default_repo='deb.debian.org' deb_apt_default_repo='deb.debian.org'
deb_apt_repo='ftp.fr.debian.org' deb_apt_repo='ftp.fr.debian.org'
user='alex' user='alex'
scan_user='scan'
scan_user_home_directory="/home/$scan_user"
sync_directory_path="/home/$user/.sync" sync_directory_path="/home/$user/.sync"
systemd_units_path='/etc/systemd/system' systemd_units_path='/etc/systemd/system'
cups_conf_path='/etc/cups' cups_conf_path='/etc/cups'
printscan_container_ip='192.168.0.91'
remote_pubkey_location='https://keys.kto.black' remote_pubkey_location='https://keys.kto.black'
remote_pubkey='home.pub' remote_pubkey='home.pub'
@ -123,7 +115,7 @@ echo "We're all good here!"
echo "You should now:" echo "You should now:"
echo "* set $user's password" echo "* set $user's password"
echo "* lock root account" echo "* lock root account"
echo "* remove setup.sh and conf-sync.sh" echo "* remove setup.sh"
echo "* reboot the SBC" echo "* reboot the SBC"
echo "And perhaps:" echo "And perhaps:"
echo "* connect to http://$hostname:631/ and add a printer" echo "* connect to http://$hostname:631/ and add a printer"
@ -132,4 +124,5 @@ echo "* remove password for sudo" # TODO we should automate that, with a flag
echo "* use below commands to edit SSH config:" echo "* use below commands to edit SSH config:"
echo " sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config" echo " sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config"
echo " sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config" echo " sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config"
echo "* MIND THAT CONF-SYNC IS NOT SET"
exit 0 exit 0