On arrête d'être stupide et on échappe les commandes
Arrêt de la restauration si non superuser
This commit is contained in:
parent
414cf617ff
commit
3012af9c19
2 changed files with 17 additions and 8 deletions
11
Perso/package_restore.sh
Normal file → Executable file
11
Perso/package_restore.sh
Normal file → Executable file
|
@ -1,11 +1,16 @@
|
|||
#! /bin/bash
|
||||
|
||||
cp . /etc/apt/sources.list
|
||||
cp ./preferences.d/ /etc/apt/preferences.d/my_preferences
|
||||
if [ $(id -u) -ne "0" ]; then
|
||||
echo "Please execute with superuser privileges"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
cp ./sources.list /etc/apt/sources.list
|
||||
cp ./preferences.d/my_preferences /etc/apt/preferences.d/my_preferences
|
||||
cp -r ./sources.list.d/* /etc/apt/sources.list.d
|
||||
|
||||
apt-get update
|
||||
apt-get install dselect
|
||||
dpkg --set-selections < "manual_package_save"
|
||||
apt-get dselect-upgrade
|
||||
apt-get remove dselect
|
||||
apt-get remove dselect
|
|
@ -41,9 +41,14 @@ b="package_restore.sh"
|
|||
|
||||
echo "#! /bin/bash" > $b
|
||||
echo "" >> $b
|
||||
echo cp . /etc/apt/sources.list >> $b
|
||||
echo cp ./preferences.d/ /etc/apt/preferences.d/my_preferences >> $b
|
||||
echo cp -r ./sources.list.d/* /etc/apt/sources.list.d >> $b
|
||||
echo 'if [ $(id -u) -ne "0" ]; then' >> $b
|
||||
echo ' echo "Please execute with superuser privileges"' >> $b
|
||||
echo " exit -1" >> $b
|
||||
echo fi >> $b
|
||||
echo "" >> $b
|
||||
echo cp ./sources.list /etc/apt/sources.list >> $b
|
||||
echo cp ./preferences.d/my_preferences /etc/apt/preferences.d/my_preferences >> $b
|
||||
echo 'cp -r ./sources.list.d/* /etc/apt/sources.list.d' >> $b
|
||||
echo "" >> $b
|
||||
echo apt-get update >> $b
|
||||
echo apt-get install dselect >> $b
|
||||
|
@ -55,5 +60,4 @@ chmod u-x "$b"
|
|||
|
||||
cd -
|
||||
|
||||
exit
|
||||
|
||||
exit
|
Loading…
Add table
Reference in a new issue