Passer au contenu principal

Script de mise à jour sous Debian-like

En construction.png

#!/bin/bash

txt_path=/home/"$1"/.config/system_update.txt
date_now=$(date)
declare -i date_char=$(( $(echo "$date_now" | wc -c) + 3 ))
date_stars=$(printf '*%.0s' $(seq 1 "$date_char" ))
echo "$date_stars" > "$txt_path"
echo "* $date_now *" >> "$txt_path"
echo "$date_stars" >> "$txt_path"
echo "" >> "$txt_path"
echo " Clean " >> "$txt_path"
echo " Clean "
echo "*******" >> "$txt_path"
apt-get clean >> "$txt_path"
echo "" >> "$txt_path"
echo " Autoclean " >> "$txt_path"
echo " Autoclean "
echo "***********" >> "$txt_path"
apt-get autoclean >> "$txt_path"
echo "" >> "$txt_path"
echo " Update " >> "$txt_path"
echo " Update "
echo "********" >> "$txt_path"
apt-get update >> "$txt_path"
echo "" >> "$txt_path"
echo " Upgrade " >> "$txt_path"
echo " Upgrade "
echo "*********" >> "$txt_path"
apt-get upgrade -y >> "$txt_path"
echo "" >> "$txt_path"
echo " Autoremove " >> "$txt_path"
echo " Autoremove "
echo "************" >> "$txt_path"
apt-get autoremove >> "$txt_path"
chown "$1":"$1" "$txt_path"