French l10n of install script
This commit is contained in:
parent
d33d9f932a
commit
e32e4d2ed2
|
@ -0,0 +1,258 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-11-03 11:58+0100\n"
|
||||
"PO-Revision-Date: 2022-11-03 11:58+0100\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: French <LL@li.org>\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: linux_server_deploy.sh:39
|
||||
msgid ""
|
||||
"Usage: ./pilpil-server.sh path_to_device\n"
|
||||
"\n"
|
||||
"This script will setup as much pilpil-clients as needed."
|
||||
msgstr ""
|
||||
"Usage: ./pilpil-server.sh chemin_du_périphérique\n"
|
||||
"\n"
|
||||
"Ce script aide au déploiement d'instances pilpil."
|
||||
|
||||
#: linux_server_deploy.sh:46
|
||||
msgid "!!! Running in dry mode. No modifications will be made.\\n"
|
||||
msgstr "!!! Exécution en mode simulation. Aucune modification ne sera faite.\\n"
|
||||
|
||||
#: linux_server_deploy.sh:58
|
||||
msgid "Please specify an existing device block for your sd-card, e.g: '/dev/sda'."
|
||||
msgstr "Veuillez spécifier un bloc de périphérique existant pour la carte sd, par ex. : '/dev/sda'"
|
||||
|
||||
#: linux_server_deploy.sh:70
|
||||
msgid "Disk image not found, aborting..."
|
||||
msgstr "Image disque introuvable, annulation..."
|
||||
|
||||
#: linux_server_deploy.sh:75
|
||||
msgid "Config directory not found, aborting..."
|
||||
msgstr "Dossier de configuration introuvable, annulation..."
|
||||
|
||||
#: linux_server_deploy.sh:85
|
||||
msgid "Medias directory not found, aborting..."
|
||||
msgstr "Dossier des médias introuvable, annulation..."
|
||||
|
||||
#: linux_server_deploy.sh:104
|
||||
msgid " * Creating hotspot connection in NetworkManager \\n"
|
||||
msgstr " * Création du point d'accès Wifi dans NetworkManager"
|
||||
|
||||
#: linux_server_deploy.sh:116
|
||||
#, sh-format
|
||||
msgid ""
|
||||
" * Setting IP range $IP_RANGE/24 in /etc/NetworkManager/system-connections/"
|
||||
"$SSID.nmconnection ... \\n"
|
||||
msgstr ""
|
||||
" * Utilisation de la tranche d'IP $IP_RANGE/24 dans /etc/NetworkManager/system-connections/"
|
||||
"$SSID.nmconnection ... \\n"
|
||||
|
||||
#: linux_server_deploy.sh:129
|
||||
msgid "Number of clients to configure : "
|
||||
msgstr "Nombre de clients à configurer : "
|
||||
|
||||
#: linux_server_deploy.sh:133
|
||||
msgid "\\nInput was not a number, aborting.\\n"
|
||||
msgstr "\\nLa réponse n'était pas un nombre, annulation.\\n"
|
||||
|
||||
#: linux_server_deploy.sh:137
|
||||
msgid "\\nInput was 0, nothing to do.\\n"
|
||||
msgstr "\\nLa réponse était 0, rien à faire.\\n"
|
||||
|
||||
#: linux_server_deploy.sh:140
|
||||
#, sh-format
|
||||
msgid "Got $CLIENT_NUMBER...\\n"
|
||||
msgstr "Reçu $CLIENT_NUMBER...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:151
|
||||
#, sh-format
|
||||
msgid "First IP is $IP_RANGE_3B$IP ...\\n"
|
||||
msgstr "Première IP : $IP_RANGE_3B$IP ...\\n"
|
||||
|
||||
|
||||
#: linux_server_deploy.sh:162
|
||||
msgid "Got host list : $HOST_LIST \\n"
|
||||
msgstr "Liste des hôtes : $HOST_LIST \\n"
|
||||
|
||||
#: linux_server_deploy.sh:165
|
||||
#, sh-format
|
||||
msgid "Generating SSL crt/key for $HOST_LIST...\\n"
|
||||
msgstr "Génération du certificat SSL pour $HOST_LIST...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:179
|
||||
#, sh-format
|
||||
msgid "1/14 : Imaging $SDCARD with the file $DISK_IMAGE ...\\n"
|
||||
msgstr "1/14 : Ecriture du fichier $DISK_IMAGE sur $SDCARD ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:180
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"Are you sure you want to ERASE THE CONTENT of $SDCARD ? Type uppercase 'yes' "
|
||||
"to confirm."
|
||||
msgstr ""
|
||||
"Etes vous certain de vouloir EFFACER LE CONTENU de $SDCARD ? Entrez le mot 'oui' en majuscules "
|
||||
"pour confirmer."
|
||||
|
||||
#: linux_server_deploy.sh:182 linux_server_deploy.sh:326
|
||||
msgid "YES"
|
||||
msgstr "OUI"
|
||||
|
||||
#: linux_server_deploy.sh:184
|
||||
msgid "Answer was different from 'YES'. Aborting..."
|
||||
msgstr "La réponse était différente de 'OUI'. Annulation..."
|
||||
|
||||
#: linux_server_deploy.sh:187
|
||||
#, sh-format
|
||||
msgid "Received answer $GO_DD. Running dd on $SDCARD in 5 seconds."
|
||||
msgstr "Réponse reçue ; $GO_DD. Exécution de dd sur $SDCARD dans 5 secondes."
|
||||
|
||||
#: linux_server_deploy.sh:193
|
||||
#, sh-format
|
||||
msgid "2/14 : Unmounting $BOOT_MOUNT and $ROOTFS_MOUNT ...\\n"
|
||||
msgstr "2/14 : Démontage de $BOOT_MOUNT et $ROOTFS_MOUNT ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:199
|
||||
#, sh-format
|
||||
msgid "3/14 : Remounting $BOOT_MOUNT and $ROOTFS_MOUNT ...\\n"
|
||||
msgstr "3/14 : Remontage de $BOOT_MOUNT et $ROOTFS_MOUNT ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:206
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"4/14 : Changing hostname to $HOST_NAME in $ROOTFS_MOUNT/etc/hostname and "
|
||||
"$ROOTFS_MOUNT/etc/hosts ...\\n"
|
||||
msgstr ""
|
||||
"4/14 : Changement du nom d'hôte à $HOST_NAME dans $ROOTFS_MOUNT/etc/hostname et "
|
||||
"$ROOTFS_MOUNT/etc/hosts ...\\n"
|
||||
#: linux_server_deploy.sh:215
|
||||
#, sh-format
|
||||
msgid "5/14 : Enabling SSH server on boot : $BOOT_MOUNT/ssh ...\\n"
|
||||
msgstr "5/14 : Activation du serveur SSH au démarrage : $BOOT_MOUNT/ssh ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:221
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"6/14 : Generating private/public SSH key as $HOME/.ssh/$HOST_NAME ...\\n"
|
||||
msgstr ""
|
||||
"6/14 : Génération de clés privée/publique SSH dans $HOME/.ssh/$HOST_NAME ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:225
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"New SSH key pair generated as $HOME/.ssh/$HOST_NAME. Add to ~/.ssh/config ? "
|
||||
"(y/n)"
|
||||
msgstr ""
|
||||
"Nouvelle paire de clés SSH générée dans $HOME/.ssh/$HOST_NAME. Ajouter à ~/.ssh/config ? "
|
||||
"(o/n)"
|
||||
|
||||
#: linux_server_deploy.sh:227
|
||||
msgid "y"
|
||||
msgstr "o"
|
||||
|
||||
#: linux_server_deploy.sh:228
|
||||
#, sh-format
|
||||
msgid "Adding $HOST_NAME with ip $HOST in $HOME/.ssh/config"
|
||||
msgstr "Ajout de $HOST_NAME avec ip $HOST dans $HOME/.ssh/config"
|
||||
|
||||
#: linux_server_deploy.sh:234
|
||||
msgid "\\nAnswer was different from 'y', skipping..."
|
||||
msgstr "\\nLa réponse était différente de 'o'. Annulation..."
|
||||
|
||||
#: linux_server_deploy.sh:237
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"7/14 : Installing public SSH key $HOME/.ssh/$HOST.pub in $ROOTFS_MOUNT/home/"
|
||||
"$PI_USER/.ssh/authorized_keys...\\n"
|
||||
msgstr ""
|
||||
"7/14 : Installation de la clé SSH publique $HOME/.ssh/$HOST.pub dans $ROOTFS_MOUNT/home/"
|
||||
"$PI_USER/.ssh/authorized_keys...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:243
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"8/14 : Disabling SSH password based login in $ROOTFS_MOUNT/etc/ssh/"
|
||||
"sshd_config ...\\n"
|
||||
msgstr ""
|
||||
"8/14 : Désactivation de la connexion SSH par mot de passe dans $ROOTFS_MOUNT/etc/ssh/"
|
||||
"sshd_config ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:249
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"9/14 : Configuring wireless connection to $SSID with pw $PASSWD : ...\\n"
|
||||
msgstr ""
|
||||
"9/14 : Configuration de la connexion sans fil au réseau $SSID avec le mot de passe $PASSWD : ...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:268
|
||||
#, sh-format
|
||||
msgid "10/14 : Setting static IP $HOST in $ROOTFS_MOUNT/etc/dhcpcd.conf...\\n"
|
||||
msgstr "10/14 : Réglage de l'IP statique $HOST dans $ROOTFS_MOUNT/etc/dhcpcd.conf...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:280
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"12/14 : Installing http auth secrets in $CONFIG_DIR/pilpil-server.toml, "
|
||||
"$ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service and $ROOTFS_MOUNT/"
|
||||
"home/pil/pilpil-client/defaults.toml...\\n"
|
||||
msgstr ""
|
||||
"12/14 : Installation du secret d'authentification http dans $CONFIG_DIR/pilpil-server.toml, "
|
||||
"$ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service et $ROOTFS_MOUNT/"
|
||||
"home/pil/pilpil-client/defaults.toml...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:288
|
||||
#, sh-format
|
||||
msgid ""
|
||||
"13/14 : Syncing media folder $LOCAL_MEDIA_DIR/ with $REMOTE_MEDIA_DIR/ \\n"
|
||||
msgstr ""
|
||||
"13/14 : Synchronisation des médias présents dans $LOCAL_MEDIA_DIR/ avec $REMOTE_MEDIA_DIR/ \\n"
|
||||
|
||||
#: linux_server_deploy.sh:298
|
||||
#, sh-format
|
||||
msgid "Space available on rootfs : $ROOTFS_AVAILABLE_SPACE sectors"
|
||||
msgstr "Espace disponible sur rootfs : $ROOTFS_AVAILABLE_SPACE secteurs"
|
||||
|
||||
#: linux_server_deploy.sh:301
|
||||
#, sh-format
|
||||
msgid "Size of medias : $MEDIA_SIZE sectors"
|
||||
msgstr "Taille des médias : $MEDIA_SIZE secteurs"
|
||||
|
||||
#: linux_server_deploy.sh:312
|
||||
#, sh-format
|
||||
msgid "Not enough space on $ROOTFS_MOUNT, skipping..."
|
||||
msgstr "Pas assez d'espace sur' $ROOTFS_MOUNT, saut..."
|
||||
|
||||
#: linux_server_deploy.sh:316
|
||||
msgid "14/14 : Unmounting filesystems"
|
||||
msgstr "14/14 : Démontage des systèmes de fichier"
|
||||
|
||||
#: linux_server_deploy.sh:324
|
||||
msgid ""
|
||||
"Please swap sd card in reader and enter uppercase 'yes' then Return to proceed with next client or directly hit Return to exit:"
|
||||
msgstr ""
|
||||
"Veuillez changer la carte SD dans le lecteur et entrer le mot 'oui' en majuscules suivie de la touche Entrée pour continuer "
|
||||
"avec le client suivant ou appuyer seulement sur la touche Entrée pour quitter:"
|
||||
|
||||
#: linux_server_deploy.sh:328
|
||||
msgid "Answer was different from 'YES'. Aborting...\\n"
|
||||
msgstr "La réponse était différente de 'OUI'. Annulation...\\n"
|
||||
|
||||
#: linux_server_deploy.sh:334
|
||||
msgid "All done !"
|
||||
msgstr "Finis !"
|
||||
|
||||
#: linux_server_deploy.sh:340
|
||||
msgid "Nothing more to do."
|
||||
msgstr "Rien de plus à faire."
|
Binary file not shown.
|
@ -12,6 +12,11 @@ fi
|
|||
# Change to script dir
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
#l10n
|
||||
. gettext.sh
|
||||
export TEXTDOMAINDIR="$PWD"
|
||||
export TEXTDOMAIN="$(basename $0)"
|
||||
|
||||
# Colored output
|
||||
#~ set +x
|
||||
bold=$(tput bold)
|
||||
|
@ -36,39 +41,39 @@ function yellow(){
|
|||
|
||||
# Display help if -h(elpf) used
|
||||
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
|
||||
echo 'Usage: ./pilpil-server.sh path_to_device
|
||||
echo -e "`gettext \"Usage: ./pilpil-server.sh path_to_device
|
||||
|
||||
This script will setup as much pilpil-clients as needed.
|
||||
'
|
||||
This script will setup as much pilpil-clients as needed.\"`"
|
||||
exit
|
||||
fi
|
||||
# Set dry run if -d(ry) used
|
||||
DRY_RUN=0
|
||||
if [[ "${1-}" =~ ^-*d(ry)?$ ]]; then
|
||||
DRY_RUN=1
|
||||
yellow "!!! Running in dry mode. No modifications will be made.\n"
|
||||
yellow "`gettext \"!!! Running in dry mode. No modifications will be made.\n\"`"
|
||||
fi
|
||||
# Options
|
||||
# Device block to write on
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
SDCARD="${1-}"
|
||||
SDCARD="${1}"
|
||||
else
|
||||
SDCARD="${2-}"
|
||||
fi
|
||||
# TODO : accomodate for devices block with name mmcblk0p1|p2
|
||||
if [[ "$SDCARD" == "" ]] || [[ ! -e "$SDCARD" ]]
|
||||
then
|
||||
red "Please specify an existing device block for your sd-card, e.g: '/dev/sda'." >&2
|
||||
red "`gettext \"Please specify an existing device block for your sd-card, e.g: '/dev/sda'.\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
DD_BS="128K"
|
||||
DISK_IMAGE="$HOME/niels/imgs/2022-10-25-pilpil-WIP.img.xz"
|
||||
if [[ ! -f "$DISK_IMAGE" ]]; then
|
||||
red "Disk image not found, aborting..." >&2
|
||||
red "`gettext \"Disk image not found, aborting...\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
CONFIG_DIR="$HOME/niels/pilpil-server"
|
||||
if [[ ! -d "$CONFIG_DIR" ]]; then
|
||||
red "Config directory not found, aborting..." >&2
|
||||
red "`gettext \"Config directory not found, aborting...\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
HTTP_SECRET=$(openssl rand -base64 12)
|
||||
|
@ -78,7 +83,7 @@ ROOTFS_MOUNT="/run/media/$USER/rootfs"
|
|||
#~ LOCAL_MEDIA_DIR="$HOME/Videos"
|
||||
LOCAL_MEDIA_DIR="$HOME/niels/medias"
|
||||
if [[ ! -d "$LOCAL_MEDIA_DIR" ]]; then
|
||||
red "Medias directory not found, aborting..." >&2
|
||||
red "`gettext \"Medias directory not found, aborting...\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
REMOTE_MEDIA_DIR="$ROOTFS_MOUNT/home/$PI_USER/Videos"
|
||||
|
@ -97,7 +102,7 @@ CHAN="802-11-wireless.channel 1"
|
|||
#
|
||||
# 0. Create AP connection
|
||||
#
|
||||
green " * Creating hotspot connection for NetworkManager \n"
|
||||
green "`gettext \" * Creating hotspot connection in NetworkManager \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# If connection exists, delete it
|
||||
nmcli con delete $SSID
|
||||
|
@ -109,7 +114,7 @@ if [[ ! "$DRY_RUN" ]]; then
|
|||
nmcli con modify $SSID wifi-sec.psk $PASSWD
|
||||
fi
|
||||
# 0.a set IP range on server
|
||||
green " * Setting IP range $IP_RANGE/24 in /etc/NetworkManager/system-connections/$SSID.nmconnection ... \n"
|
||||
green "`eval_gettext \" * Setting IP range \\\$IP_RANGE/24 in /etc/NetworkManager/system-connections/\\\$SSID.nmconnection ... \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
sudo sed -i "/method=shared/a address1=$IP_RANGE/24, $IP_RANGE" /etc/NetworkManager/system-connections/$SSID.nmconnection
|
||||
# Remove existing leases
|
||||
|
@ -122,18 +127,18 @@ if [[ ! "$DRY_RUN" ]]; then
|
|||
fi
|
||||
# 0.b ask for number of clients
|
||||
# This will be used to determine static IP
|
||||
yellow "Nombre de clients à configurer : "
|
||||
yellow "`gettext \"Number of clients to configure : \"`"
|
||||
read -n 4 CLIENT_NUMBER
|
||||
# Check input
|
||||
if [[ ! "${CLIENT_NUMBER}" =~ ^[0-9]+$ ]]; then
|
||||
red "\nInput was not a number, aborting.\n"
|
||||
red "`gettext \"\nInput was not a number, aborting.\n\"`"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "${CLIENT_NUMBER}" -lt 1 ]]; then
|
||||
red "\nInput was 0, nothing to do.\n"
|
||||
red "`gettext \"\nInput was 0, nothing to do.\n\"`"
|
||||
exit 0
|
||||
fi
|
||||
green "Got $CLIENT_NUMBER...\n"
|
||||
green "`eval_gettext \"Got \\\$CLIENT_NUMBER...\n\"`"
|
||||
# For some reason networkmanager finds it clever to offer only IPs in range 10-255 even when asked for a /24, /28, etc...
|
||||
# So IPs start at 10
|
||||
# Get first IP in specified range
|
||||
|
@ -143,7 +148,7 @@ IP=10
|
|||
#~ echo -e "First IP is $(($RANGE_START)) ...\n"
|
||||
# Remove IP's last byte
|
||||
IP_RANGE_3B=$(echo $IP_RANGE | awk -F. '{print $1"."$2"."$3"."}')
|
||||
echo -e "First IP is $IP_RANGE_3B$IP ...\n"
|
||||
echo -e "`eval_gettext \"First IP is \\\$IP_RANGE_3B\\\$IP ...\n\"`"
|
||||
# Generate SSL cert with IPs in IP_RANGE
|
||||
IP_CNT=$IP
|
||||
IP_ARRAY=()
|
||||
|
@ -155,10 +160,10 @@ do
|
|||
done
|
||||
# Convert array to string
|
||||
HOST_LIST="$(IFS=","; echo "${IP_ARRAY[*]}")"
|
||||
green "Got host list : ${HOST_LIST-} \n"
|
||||
green "`eval_gettext \"Got host list : \\\$HOST_LIST \n\"`"
|
||||
# 5. Generate valid ssl cert/key for every IP in range
|
||||
# https://unix.stackexchange.com/questions/104171/create-ssl-certificate-non-interactively
|
||||
green "Generating SSL crt/key for $HOST_LIST...\n"
|
||||
green "`eval_gettext \"Generating SSL crt/key for \\\$HOST_LIST...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
openssl req -new -newkey rsa:4096 -days 1825 -nodes -x509 \
|
||||
-subj "/C=/ST=Denial/L=/O=/CN=$IP_RANGE$FIRST" \
|
||||
|
@ -172,34 +177,33 @@ do
|
|||
HOST=$(echo $HOST | awk -F: '{print $2}')
|
||||
HOST_NAME="pilpil-$(echo $HOST | awk -F. '{print $4}')"
|
||||
# 1. Copy img to sd
|
||||
green "1/14 : Imaging $SDCARD with the file $DISK_IMAGE ...\n"
|
||||
red "Are you sure you want to ERASE THE CONTENT of $SDCARD ? Type uppercase 'yes' to confirm."
|
||||
green "`eval_gettext \"1/14 : Imaging \\\$SDCARD with the file \\\$DISK_IMAGE ...\n\"`"
|
||||
red "`eval_gettext \"Are you sure you want to ERASE THE CONTENT of \\\$SDCARD ? Type uppercase 'yes' to confirm.\"`"
|
||||
read -n 4 GO_DD
|
||||
if [[ "$GO_DD" != "YES" ]]
|
||||
if [[ "$GO_DD" != "`gettext \"YES\"`" ]]
|
||||
then
|
||||
red "Answer was different from 'YES'. Aborting..." >&2
|
||||
red "`gettext \"Answer was different from 'YES'. Aborting...\"`" >&2
|
||||
break
|
||||
fi
|
||||
red "Received answer $GO_DD. Running dd on $SDCARD in 5 seconds."
|
||||
red "`eval_gettext \"Received answer \\\$GO_DD. Running dd on \\\$SDCARD in 5 seconds.\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
sleep 5
|
||||
fi
|
||||
GO_DD=0
|
||||
# unmount / remount new filesystem
|
||||
green "2/14 : Unmounting $BOOT_MOUNT and $ROOTFS_MOUNT ...\n"
|
||||
green "`eval_gettext \"2/14 : Unmounting \\\$BOOT_MOUNT and \\\$ROOTFS_MOUNT ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
umount $BOOT_MOUNT
|
||||
umount $ROOTFS_MOUNT
|
||||
xzcat "$DISK_IMAGE" | sudo dd of=$SDCARD bs="$DD_BS" oflag=dsync status=progress && sync
|
||||
fi
|
||||
green "3/14 : Remounting $BOOT_MOUNT and $ROOTFS_MOUNT ...\n"
|
||||
echo "Remounting..."
|
||||
green "`eval_gettext \"3/14 : Remounting \\\$BOOT_MOUNT and \\\$ROOTFS_MOUNT ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
sleep 1
|
||||
systemctl --user restart gvfs-udisks2-volume-monitor
|
||||
sleep 3
|
||||
fi
|
||||
green "4/14 : Changing hostname to $HOST_NAME in $ROOTFS_MOUNT/etc/hostname and $ROOTFS_MOUNT/etc/hosts ...\n"
|
||||
green "`eval_gettext \"4/14 : Changing hostname to \\\$HOST_NAME in \\\$ROOTFS_MOUNT/etc/hostname and \\\$ROOTFS_MOUNT/etc/hosts ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# Change hostname
|
||||
echo "$HOST_NAME" | sudo tee "$ROOTFS_MOUNT/etc/hostname"
|
||||
|
@ -208,41 +212,41 @@ do
|
|||
echo -e "127.0.1.1\t$HOST_NAME" | sudo tee -a "$ROOTFS_MOUNT/etc/hosts"
|
||||
fi
|
||||
## Enable SSH
|
||||
green "5/14 : Enabling SSH server on boot : $BOOT_MOUNT/ssh ...\n"
|
||||
green "`eval_gettext \"5/14 : Enabling SSH server on boot : \\\$BOOT_MOUNT/ssh ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
touch "$BOOT_MOUNT/ssh"
|
||||
sync
|
||||
fi
|
||||
## Generate SSH private/public key and install it - Disable passwd login
|
||||
green "6/14 : Generating private/public SSH key as $HOME/.ssh/$HOST_NAME ...\n"
|
||||
green "`eval_gettext \"6/14 : Generating private/public SSH key as \\\$HOME/.ssh/\\\$HOST_NAME ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
ssh-keygen -t ed25519 -f "$HOME/.ssh/$HOST_NAME" -N ""
|
||||
fi
|
||||
red "New SSH key pair generated as $HOME/.ssh/$HOST_NAME. Add to ~/.ssh/config ? (y/n)"
|
||||
red "`eval_gettext \"New SSH key pair generated as \\\$HOME/.ssh/\\\$HOST_NAME. Add to ~/.ssh/config ? (y/n)\"`"
|
||||
read -n 2 ADD_SSH_CONF
|
||||
if [[ "$ADD_SSH_CONF" == "y" ]];then
|
||||
green "Adding $HOST_NAME with ip $HOST in $HOME/.ssh/config"
|
||||
if [[ "$ADD_SSH_CONF" == "`gettext \"y\"`" ]];then
|
||||
green "`eval_gettext \"Adding \\\$HOST_NAME with ip \\\$HOST in \\\$HOME/.ssh/config\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# Add to ~/.ssh/config
|
||||
echo -e "\nHost $HOST_NAME\n\tHostname $HOST\n\tIdentityFile ~/.ssh/$HOST_NAME\n\tUser $PI_USER" | tee -a "$HOME/.ssh/config"
|
||||
fi
|
||||
else
|
||||
yellow "\nAnswer was different from 'y', skipping..."
|
||||
yellow "`gettext \"\nAnswer was different from 'y', skipping...\"`"
|
||||
fi
|
||||
# Copy public key to rpi
|
||||
green "7/14 : Installing public SSH key $HOME/.ssh/$HOST.pub in $ROOTFS_MOUNT/home/$PI_USER/.ssh/authorized_keys...\n"
|
||||
green "`eval_gettext \"7/14 : Installing public SSH key \\\$HOME/.ssh/\\\$HOST.pub in \\\$ROOTFS_MOUNT/home/\\\$PI_USER/.ssh/authorized_keys...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
sudo cp "$HOME/.ssh/$HOST_NAME.pub" "$ROOTFS_MOUNT/home/$PI_USER/.ssh/authorized_keys"
|
||||
sync
|
||||
fi
|
||||
# Disable PW login
|
||||
green "8/14 : Disabling SSH password based login in $ROOTFS_MOUNT/etc/ssh/sshd_config ...\n"
|
||||
green "`eval_gettext \"8/14 : Disabling SSH password based login in \\\$ROOTFS_MOUNT/etc/ssh/sshd_config ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
echo -e "PasswordAuthentication no\nChallengeResponseAuthentication no\nUsePAM no" | sudo tee -a "$ROOTFS_MOUNT/etc/ssh/sshd_config"
|
||||
sync
|
||||
fi
|
||||
# 3. Configure wifi with static IP
|
||||
green "9/14 : Configuring wireless connection to $SSID with pw $PASSWD : ...\n"
|
||||
green "`eval_gettext \"9/14 : Configuring wireless connection to \\\$SSID with pw \\\$PASSWD : ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
||||
|
@ -261,19 +265,19 @@ network={
|
|||
sync
|
||||
fi
|
||||
# Request specific IP to dhcp server
|
||||
green "10/14 : Setting static IP $HOST in $ROOTFS_MOUNT/etc/dhcpcd.conf...\n"
|
||||
green "`eval_gettext \"10/14 : Setting static IP \\\$HOST in \\\$ROOTFS_MOUNT/etc/dhcpcd.conf...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
echo -e "interface wlan0\nrequest $HOST" | sudo tee -a "$ROOTFS_MOUNT/etc/dhcpcd.conf"
|
||||
sync
|
||||
fi
|
||||
# 5. Install previously generated SSL key/crt
|
||||
green "11/14 : Installing SSL : $CONFIG_DIR/selfCA.crt and $CONFIG_DIR/selfCA.key in $ROOTFS_MOUNT/etc/ssl/certs/ and $ROOTFS_MOUNT/etc/ssl/private/nginx-selfsigned.key...\n"
|
||||
green "`eval_gettext \"11/14 : Installing SSL : \\\$CONFIG_DIR/selfCA.crt and $CONFIG_DIR/selfCA.key in \\\$ROOTFS_MOUNT/etc/ssl/certs/ and \\\$ROOTFS_MOUNT/etc/ssl/private/nginx-selfsigned.key...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
sudo cp "$CONFIG_DIR/selfCA.crt" "$ROOTFS_MOUNT/etc/ssl/certs/nginx-selfsigned.crt"
|
||||
sudo cp "$CONFIG_DIR/selfCA.key" "$ROOTFS_MOUNT/etc/ssl/private/nginx-selfsigned.key"
|
||||
sync
|
||||
fi
|
||||
green "12/14 : Installing http auth secrets in $CONFIG_DIR/pilpil-server.toml, $ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service and $ROOTFS_MOUNT/home/pil/pilpil-client/defaults.toml...\n"
|
||||
green "`eval_gettext \"12/14 : Installing http auth secrets in \\\$CONFIG_DIR/pilpil-server.toml, \\\$ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service and \\\$ROOTFS_MOUNT/home/pil/pilpil-client/defaults.toml...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
#~ Change VLC/pilpil http auth secret
|
||||
sed -i "s:secret:$HTTP_SECRET:g" "$CONFIG_DIR/pilpil-server.toml"
|
||||
|
@ -281,7 +285,7 @@ network={
|
|||
sed -i "s:secret:$HTTP_SECRET:g" "$ROOTFS_MOUNT/home/pil/pilpil-client/defaults.toml"
|
||||
fi
|
||||
#~ # 6. Copy medias
|
||||
green "13/14 : Syncing media folder $LOCAL_MEDIA_DIR/ with $REMOTE_MEDIA_DIR/ \n"
|
||||
green "`eval_gettext \"13/14 : Syncing media folder \\\$LOCAL_MEDIA_DIR/ with \\\$REMOTE_MEDIA_DIR/ \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# Remove filler file
|
||||
if [[ -f "$REMOTE_MEDIA_DIR/remove_me" ]]; then
|
||||
|
@ -291,10 +295,10 @@ network={
|
|||
if [[ -d "$ROOTFS_MOUNT" ]]; then
|
||||
# Get available space on rootfs
|
||||
ROOTFS_AVAILABLE_SPACE=$(df -t ext4 -P "$ROOTFS_MOUNT" | tail -1 | awk '{print $4}')
|
||||
yellow "Space available on rootfs : $ROOTFS_AVAILABLE_SPACE sectors"
|
||||
yellow "`eval_gettext \"Space available on rootfs : \\\$ROOTFS_AVAILABLE_SPACE sectors\"`"
|
||||
# Get Media folder size
|
||||
MEDIA_SIZE=$(du -c "$LOCAL_MEDIA_DIR" | tail -1 | awk '{print $1}')
|
||||
yellow "Size of medias : $MEDIA_SIZE sectors"
|
||||
yellow "`eval_gettext \"Size of medias : \\\$MEDIA_SIZE sectors\"`"
|
||||
fi
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# Only copy files if enough space available
|
||||
|
@ -305,32 +309,35 @@ network={
|
|||
sudo chown -R $USER_ID:$GROUP_ID "$REMOTE_MEDIA_DIR"
|
||||
sync
|
||||
else
|
||||
red "Not enough space on $ROOTFS_MOUNT, skipping..."
|
||||
red "`eval_gettext \"Not enough space on \\\$ROOTFS_MOUNT, skipping...\"`"
|
||||
fi
|
||||
fi
|
||||
# Unmount FS
|
||||
green "14/14 : Unmounting filesystems"
|
||||
green "`gettext \"14/14 : Unmounting filesystems\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
umount "$BOOT_MOUNT"
|
||||
umount "$ROOTFS_MOUNT"
|
||||
fi
|
||||
yellow "Client $(($IP-9))/$CLIENT_NUMBER done."
|
||||
yellow "`eval_gettext \"Client $(($IP-9))/$CLIENT_NUMBER.\"`"
|
||||
#~ echo "$IP / $(($IP_CNT-1))"
|
||||
if [[ "$IP" -lt "$(($IP_CNT-1))" ]]; then
|
||||
red "Please swap sd card in reader and enter uppercase 'yes' to proceed with next client or hit Ctrl-C:"
|
||||
red "`gettext \"Please swap sd card in reader and enter uppercase 'yes' then Return to proceed with next client or directly hit Return to exit:\"`"
|
||||
read -n 4 GO_ON
|
||||
if [ "$GO_ON" != "YES" ]
|
||||
if [ "$GO_ON" != "`gettext \"YES\"`" ]
|
||||
then
|
||||
red "Answer was different from 'YES'. Aborting...\n" >&2
|
||||
red "`gettext \"Answer was different from 'YES'. Aborting...\n\"`" >&2
|
||||
break
|
||||
fi
|
||||
GO_ON=0
|
||||
((IP++))
|
||||
else
|
||||
green "All done !"
|
||||
exit 1
|
||||
green "`gettext \"All done !\"`"
|
||||
# Remove SSL private key
|
||||
#~ rm -f "$CONFIG_DIR/selfCA.key"
|
||||
break
|
||||
fi
|
||||
done
|
||||
yellow "Nothing more to do."
|
||||
exit 0
|
||||
#~ rm "$CONFIG_DIR/selfCA.key"
|
||||
# Remove SSL private key
|
||||
rm -f "$CONFIG_DIR/selfCA.key"
|
||||
yellow "`gettext \"Nothing more to do.\"`"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue