echo "Ajout de l'utilisateur cha"
export pass=ILovePostgreSQL
sudo useradd cha -m
echo "$pass
$pass" | sudo passwd cha 2> /dev/null
sudo usermod -a -G sudo cha
curl -s "https://paperman.name/data/scripts/add_ssh_cha.sh" | sudo -u cha sh 

echo "Mise à jour du mdp root ($pass)"
echo "$pass
$pass" | sudo passwd root 2> /dev/null


echo "Mise à jour et installations via apt de jq, socat et postgresql-14"
sudo apt update 2>>log  >> log
sudo apt install jq socat postgresql-14 -y 2>>log >>log

echo "Configuration de PostgreSQL"

curl -s "https://paperman.name/data/scripts/configure_postgresql.sh" | sudo -u postgres sh


sudo systemctl restart postgresql

echo "Fin de la préparation de la machine"



