correction bug postun
This commit is contained in:
parent
bec955fa32
commit
47b30e9904
@ -72,88 +72,89 @@ desktop()
|
||||
DESKTOP=""
|
||||
fi
|
||||
}
|
||||
|
||||
# crée un utilisateur Lalis et enlève les droits de lecture/écriture/visibilité/exécution à others
|
||||
cp -f /usr/share/lalis/journald.conf /etc/systemd/
|
||||
getent passwd lalis
|
||||
if [ ${?} -ne 0 ]; then
|
||||
adduser lalis
|
||||
chmod -R o-rwX /home/lalis
|
||||
passwd lalis << EOF
|
||||
Lalis
|
||||
Lalis
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Ajoute l'utilisateur lalis à la liste des utilisateurs autorisés à se connecter en ssh
|
||||
echo "Ajout de l'utilisateur Lalis dans sshd_config"
|
||||
if [ -z "`grep lalis /etc/ssh/sshd_config`" ]; then
|
||||
if [ -z "`grep -i allowusers /etc/ssh/sshd_config`" ]; then
|
||||
echo "Allowusers lalis" >>/etc/ssh/sshd_config
|
||||
else
|
||||
sed -i -e 's/^Allowusers.*$/& lalis/g' /etc/ssh/sshd_config
|
||||
if [ $1 == 1 ];then
|
||||
# crée un utilisateur Lalis et enlève les droits de lecture/écriture/visibilité/exécution à others
|
||||
cp -f /usr/share/lalis/journald.conf /etc/systemd/
|
||||
getent passwd lalis
|
||||
if [ ${?} -ne 0 ]; then
|
||||
adduser lalis
|
||||
chmod -R o-rwX /home/lalis
|
||||
passwd lalis << EOF
|
||||
Lalis
|
||||
Lalis
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
echo "relance sshd"
|
||||
/usr/bin/systemctl restart sshd
|
||||
|
||||
# Ajoute le fichier test.desktop sur le bureau de l'utilisateur lalis
|
||||
echo "Ajout du script de test sur le bureau de lalis"
|
||||
desktop /home/lalis
|
||||
echo $DESKTOP
|
||||
if [ "$DESKTOP" = "" ]; then
|
||||
/usr/bin/mkdir "/home/lalis/Desktop"
|
||||
fi
|
||||
chmod a+rw /usr/share/lalis/checklist.txt
|
||||
cp /usr/share/dist/desktop-files/default/test.desktop /home/lalis/$DESKTOP/
|
||||
chown lalis:lalis -R /home/lalis/$DESKTOP/test.desktop
|
||||
# Copie le fichier Lalis.desktop dans le dossier /etc/skel
|
||||
cp -f /usr/share/kio_desktop/Lalis.desktop /etc/skel/$DESKTOP
|
||||
|
||||
# Copie le fichier Lalis.desktop sur le bureau des utilisateurs existant
|
||||
echo "copie de lalis.desktop dans le bureau des utilisateurs"
|
||||
cp -f /usr/share/kio_desktop/Lalis.desktop /usr/share/dist/desktop-files/default/
|
||||
for i in /home/*
|
||||
do
|
||||
USER=`basename "$i"`
|
||||
getent passwd "$USER"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
if [ -d $i ]; then
|
||||
desktop "/$i"
|
||||
echo $DESKTOP
|
||||
if ! [ -d "$i/$DESKTOP" ]; then
|
||||
su -c "mkdir $i/$DESKTOP" - "$USER"
|
||||
echo "su -c mkdir $i/$DESKTOP - $USER"
|
||||
fi
|
||||
cp -fa /usr/share/kio_desktop/Lalis.desktop "$i/$DESKTOP/"
|
||||
chown $USER:$USER "$i/$DESKTOP"
|
||||
# Ajoute l'utilisateur lalis à la liste des utilisateurs autorisés à se connecter en ssh
|
||||
echo "Ajout de l'utilisateur Lalis dans sshd_config"
|
||||
if [ -z "`grep lalis /etc/ssh/sshd_config`" ]; then
|
||||
if [ -z "`grep -i allowusers /etc/ssh/sshd_config`" ]; then
|
||||
echo "Allowusers lalis" >>/etc/ssh/sshd_config
|
||||
else
|
||||
sed -i -e 's/^Allowusers.*$/& lalis/g' /etc/ssh/sshd_config
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "relance sshd"
|
||||
/usr/bin/systemctl restart sshd
|
||||
|
||||
#disabling mdadm when no raid detected
|
||||
# Ajoute le fichier test.desktop sur le bureau de l'utilisateur lalis
|
||||
echo "Ajout du script de test sur le bureau de lalis"
|
||||
desktop /home/lalis
|
||||
echo $DESKTOP
|
||||
if [ "$DESKTOP" = "" ]; then
|
||||
/usr/bin/mkdir "/home/lalis/Desktop"
|
||||
fi
|
||||
chmod a+rw /usr/share/lalis/checklist.txt
|
||||
cp /usr/share/dist/desktop-files/default/test.desktop /home/lalis/$DESKTOP/
|
||||
chown lalis:lalis -R /home/lalis/$DESKTOP/test.desktop
|
||||
# Copie le fichier Lalis.desktop dans le dossier /etc/skel
|
||||
cp -f /usr/share/kio_desktop/Lalis.desktop /etc/skel/$DESKTOP
|
||||
|
||||
MD=`grep -c active /proc/mdstat`
|
||||
if [ $MD > 0 ]; then
|
||||
echo "Désactivation de mdadm"
|
||||
systemctl disable mdadm.service
|
||||
fi
|
||||
# Copie le fichier Lalis.desktop sur le bureau des utilisateurs existant
|
||||
echo "copie de lalis.desktop dans le bureau des utilisateurs"
|
||||
cp -f /usr/share/kio_desktop/Lalis.desktop /usr/share/dist/desktop-files/default/
|
||||
for i in /home/*
|
||||
do
|
||||
USER=`basename "$i"`
|
||||
getent passwd "$USER"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
if [ -d $i ]; then
|
||||
desktop "/$i"
|
||||
echo $DESKTOP
|
||||
if ! [ -d "$i/$DESKTOP" ]; then
|
||||
su -c "mkdir $i/$DESKTOP" - "$USER"
|
||||
echo "su -c mkdir $i/$DESKTOP - $USER"
|
||||
fi
|
||||
cp -fa /usr/share/kio_desktop/Lalis.desktop "$i/$DESKTOP/"
|
||||
chown $USER:$USER "$i/$DESKTOP"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
#disabling network-up if nfs not used
|
||||
if [ ! -e /etc/nfs.conf ]; then
|
||||
echo "Désactivation de network-up"
|
||||
systemctl disable network-up
|
||||
fi
|
||||
ARCH=`uname -i`
|
||||
U=`uname -r`
|
||||
MGAVERSION=${U##*.mga}
|
||||
#disabling mdadm when no raid detected
|
||||
|
||||
#adding lalis mirror
|
||||
echo "ajout du miroir Lalis"
|
||||
grep -q 'lalis rsync://lalis69.ddns.net:10073/mageia/lalis/' /etc/urpmi/urpmi.cfg
|
||||
if [ ${?} -ne 0 ]; then
|
||||
echo -e "\nlalis rsync://lalis69.ddns.net:10073/mageia/lalis/$MGAVERSION/x86_64/media/core {\nupdate\n}" >>/etc/urpmi/urpmi.cfg
|
||||
echo "urpmi.update lalis" | at now +1 minutes
|
||||
MD=`grep -c active /proc/mdstat`
|
||||
if [ $MD > 0 ]; then
|
||||
echo "Désactivation de mdadm"
|
||||
systemctl disable mdadm.service
|
||||
fi
|
||||
|
||||
#disabling network-up if nfs not used
|
||||
if [ ! -e /etc/nfs.conf ]; then
|
||||
echo "Désactivation de network-up"
|
||||
systemctl disable network-up
|
||||
fi
|
||||
ARCH=`uname -i`
|
||||
U=`uname -r`
|
||||
MGAVERSION=${U##*.mga}
|
||||
|
||||
#adding lalis mirror
|
||||
echo "ajout du miroir Lalis"
|
||||
grep -q 'lalis rsync://lalis69.ddns.net:10073/mageia/lalis/' /etc/urpmi/urpmi.cfg
|
||||
if [ ${?} -ne 0 ]; then
|
||||
echo -e "\nlalis rsync://lalis69.ddns.net:10073/mageia/lalis/$MGAVERSION/x86_64/media/core {\nupdate\n}" >>/etc/urpmi/urpmi.cfg
|
||||
echo "urpmi.update lalis" | at now +1 minutes
|
||||
fi
|
||||
fi
|
||||
|
||||
%postun
|
||||
@ -168,37 +169,38 @@ desktop()
|
||||
DESKTOP=""
|
||||
fi
|
||||
}
|
||||
if [ $1 == 0 ];then
|
||||
# supprime l'utilisateur Lalis
|
||||
echo "Suppression de l'utilisateur lalis (dossier personnel compris)"
|
||||
userdel -rf lalis
|
||||
|
||||
# supprime l'utilisateur Lalis
|
||||
echo "Suppression de l'utilisateur lalis (dossier personnel compris)"
|
||||
userdel -rf lalis
|
||||
|
||||
# supprime l'utilisateur lalis de la liste des utilisateurs autorisés à se connecter en ssh
|
||||
echo "suppression de l'utilisateur lalis de sshd_config"
|
||||
if [ -n "`grep lalis /etc/ssh/sshd_config`" ]; then
|
||||
sed -i -e 's/ lalis//g' /etc/ssh/sshd_config
|
||||
fi
|
||||
/usr/bin/systemctl restart sshd
|
||||
|
||||
# Supprime le fichier Lalis.desktop dans le dossier /etc/skel
|
||||
echo "suppression de Lalis.desktop du dossier /etc/skel"
|
||||
rm -f /etc/skel/$DESKTOP/Lalis.desktop
|
||||
|
||||
# Supprime le fichier Lalis.desktop de bureau des utilisateurs existant
|
||||
echo "suppression de Lalis.desktop du dossier de bureau des utilisateurs"
|
||||
for i in /home/*
|
||||
do
|
||||
USER=`basename "$i"`
|
||||
getent passwd "$USER"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
if [ -d $i ]; then
|
||||
desktop "/$i"
|
||||
echo $DESKTOP
|
||||
rm -f "$i/$DESKTOP/Lalis.desktop"
|
||||
fi
|
||||
# supprime l'utilisateur lalis de la liste des utilisateurs autorisés à se connecter en ssh
|
||||
echo "suppression de l'utilisateur lalis de sshd_config"
|
||||
if [ -n "`grep lalis /etc/ssh/sshd_config`" ]; then
|
||||
sed -i -e 's/ lalis//g' /etc/ssh/sshd_config
|
||||
fi
|
||||
done
|
||||
/usr/bin/systemctl restart sshd
|
||||
|
||||
# supprime le miroir lalis
|
||||
echo "suppression du dépôt lalis"
|
||||
echo "urpmi.removemedia lalis" | at now +1 minutes
|
||||
# Supprime le fichier Lalis.desktop dans le dossier /etc/skel
|
||||
echo "suppression de Lalis.desktop du dossier /etc/skel"
|
||||
rm -f /etc/skel/$DESKTOP/Lalis.desktop
|
||||
|
||||
# Supprime le fichier Lalis.desktop de bureau des utilisateurs existant
|
||||
echo "suppression de Lalis.desktop du dossier de bureau des utilisateurs"
|
||||
for i in /home/*
|
||||
do
|
||||
USER=`basename "$i"`
|
||||
getent passwd "$USER"
|
||||
if [ ${?} -eq 0 ]; then
|
||||
if [ -d $i ]; then
|
||||
desktop "/$i"
|
||||
echo $DESKTOP
|
||||
rm -f "$i/$DESKTOP/Lalis.desktop"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# supprime le miroir lalis
|
||||
echo "suppression du dépôt lalis"
|
||||
echo "urpmi.removemedia lalis" | at now +1 minutes
|
||||
fi
|
||||
|
Reference in New Issue
Block a user