From f51fecaf608d525e3cedefa6553c74af404f0652 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 3 Nov 2015 12:10:27 +0100 Subject: [PATCH] post_install_sid: Load some informations from another to avoid to enter in the post_install_sid script. --- .gitignore | 1 + informations.template | 8 ++++++++ post_install_sid.sh | 27 +++++++++++++-------------- 3 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 .gitignore create mode 100755 informations.template diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..771bd41 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +informations diff --git a/informations.template b/informations.template new file mode 100755 index 0000000..cda21fc --- /dev/null +++ b/informations.template @@ -0,0 +1,8 @@ +#!/bin/sh + +## End user of the new system +new_username='marvin' +new_user_mail='towel@101010.fr' + +## System informations +debian_version_name='sid' diff --git a/post_install_sid.sh b/post_install_sid.sh index 496d10a..503db97 100755 --- a/post_install_sid.sh +++ b/post_install_sid.sh @@ -146,7 +146,9 @@ fi # Variables globales # # ----------------------------------------------------------- -#  + +script_path=$(dirname $0) + ## Choix du mode d'exécution du script: (cf fonction def_debug) ## Niveau 0 # Exécution automatique avec normalement aucune interaction avec l'utilisateur et peu de log @@ -162,11 +164,8 @@ fi # Mode debug mode_debug=5 -## Utilisateur principal du système: -UTILISATEUR="jegardai" - -## Nom de la version Debian souhaitée -VERSION_NAME="sid" +# Load additionnal informations (new_username, new_user_mail, …) +. ${script_path}/informations ## Architecture de la distribution ARCH="" @@ -189,7 +188,7 @@ OPTIONS="" # ----------------------------------------------------------- # ## Répertoire de log -log_dir="/home/${UTILISATEUR}/log/`date +"%d"-"%m"-"%y"`" +log_dir="/home/${new_username}/log/`date +"%d"-"%m"-"%y"`" # !! Pour utiliser un répertoire de log, décommenter la ligne suivante: #mkdir -p $log_dir @@ -647,7 +646,7 @@ EOF ###### Post-configuration # Création d'un fichier ~/.xinitrc pour pouvoir lancer openbox à partir de startx -cat >> /home/"${UTILISATEUR}"/.xinitrc << EOF +cat >> /home/"${new_username}"/.xinitrc << EOF exec openbox-session EOF @@ -995,19 +994,19 @@ update-alternatives --set editor /usr/bin/vim.nox aptitude remove vim-tiny # Add default user to sudo group -adduser ${UTILISATEUR} sudo +adduser ${new_username} sudo ## Changement du shell par défaut pour les utilisateurs # Root chsh -s /bin/zsh rm -f ~/.bash* ~/.profile # Pour les utilisateurs déjà existants: -#usermod -s /bin/zsh "${UTILISATEUR}" -chsh -s /bin/zsh "${UTILISATEUR}" +#usermod -s /bin/zsh "${new_username}" +chsh -s /bin/zsh "${new_username}" # Pour les nouveaux utilisateurs sed -i "s;/bin/bash;/bin/zsh;" /etc/adduser.conf -mkdir /home/"${UTILISATEUR}"/.zsh -chown "${UTILISATEUR}":"${UTILISATEUR}" /home/"${UTILISATEUR}"/.zsh +mkdir /home/"${new_username}"/.zsh +chown "${new_username}":"${new_username}" /home/"${new_username}"/.zsh ## Disable Openvpn to automatically start systemctl disable openvpn.service @@ -1420,7 +1419,7 @@ aptitude remove avahi-autopid avahi-daemon cups-browsed libnss-mdns ###### Post-configuration # Add the standard user to lpadmin group to be able to manage Cups administration via webgui. -adduser "${UTILISATEUR}" lpadmin > /dev/null 2> "${fichier_erreur}" +adduser "${new_username}" lpadmin > /dev/null 2> "${fichier_erreur}" # cups needs samba! ###########################################################