1
0

ça avance

This commit is contained in:
Daniel Tartavel 2019-03-22 18:19:38 +01:00
parent 844f5b3787
commit cea7e7d015
4 changed files with 83 additions and 25 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/bash
######### Script d'etablissement de la fiche technique d'un PC ######### ######### Script d'etablissement de la fiche technique d'un PC #########
FILE="identification.txt" FILE="identification.txt"

23
SOURCES/sync_check.sh Normal file → Executable file
View File

@ -1,5 +1,18 @@
#!/bin/sh #!/usr/bin/sh
SERIAL=`grep -is -m 1 "serial number" ./identification.txt` #./identPC.sh
DIRNAME=${SERIAL##* } /usr/bin/kate ./checklist.txt
mkdir grep -is -m 2 "numéro de série" ./identification.txt >tmp.txt
rsync -aP *.txt lalis69.ddns.net::lalis-ordis while read LIGNE
do
TMP=${LIGNE##*}
if [ "$TMP" != "Number" ];then
DIRNAME="$DIRNAME$TMP"
break
else
DIRNAME="CM_"
fi
done < tmp.txt
rm -f tmp.txt
mkdir $DIRNAME
rsync --port 10073 -aP *.txt "lalis69.ddns.net::lalis-ordis/$DIRNAME"

19
SOURCES/test.desktop Executable file
View File

@ -0,0 +1,19 @@
[Desktop Entry]
Comment[fr_FR]=Outils de test et de inventaire matériel de LALIS
Comment=Inventory and test tool for LALIS
Exec=kate ./checklist.txt;kdesu -u root /usr/local/bin/sync_check.sh
GenericName[fr_FR]=Test
GenericName=Test
Icon=bleachbit
MimeType=
Name[fr_FR]=Test
Name=Test
Path=$HOME/Bureau
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

View File

@ -1,7 +1,7 @@
Summary: Install LALIS packages and configuration Summary: Install LALIS packages and configuration
Name: task-lalis Name: task-lalis
Version: 1 Version: 2
Release: %mkrel 3 Release: %mkrel 1
License: GPLv3 License: GPLv3
Group: Tools Group: Tools
Url: http://lalis.fr Url: http://lalis.fr
@ -12,6 +12,7 @@ Source3: Lalis.desktop
Source4: identPC.sh Source4: identPC.sh
Source5: sync_check.sh Source5: sync_check.sh
Source6: checklist.txt Source6: checklist.txt
Source7: test.desktop
Requires: openssh-server Requires: openssh-server
Requires: sshfs-fuse Requires: sshfs-fuse
Requires: celestia Requires: celestia
@ -129,7 +130,7 @@ cp -af %{SOURCE1} %{buildroot}/tmp/
cp -f %{SOURCE2} %{buildroot}/usr/local/bin/ cp -f %{SOURCE2} %{buildroot}/usr/local/bin/
cp -f %{SOURCE4} %{buildroot}/usr/local/bin/ cp -f %{SOURCE4} %{buildroot}/usr/local/bin/
cp -f %{SOURCE5} %{buildroot}/usr/local/bin/ cp -f %{SOURCE5} %{buildroot}/usr/local/bin/
cp -f %{SOURCE6} %{buildroot}/usr/local/bin/ #cp -f %{SOURCE6} %{buildroot}/usr/local/bin/
cp -f %{SOURCE3} %{buildroot}/usr/share/kio_desktop/ cp -f %{SOURCE3} %{buildroot}/usr/share/kio_desktop/
cp -f %{SOURCE3} %{buildroot}/usr/share/dist/desktop-files/default/ cp -f %{SOURCE3} %{buildroot}/usr/share/dist/desktop-files/default/
@ -142,35 +143,60 @@ cp -f %{SOURCE3} %{buildroot}/usr/share/dist/desktop-files/default/
/usr/local/bin/lalistunnel /usr/local/bin/lalistunnel
/usr/local/bin/identPC.sh /usr/local/bin/identPC.sh
/usr/local/bin/sync_check.sh /usr/local/bin/sync_check.sh
/usr/local/bin/checklist.txt #/usr/local/etc/checklist.txt
/usr/share/kio_desktop/Lalis.desktop /usr/share/kio_desktop/Lalis.desktop
/usr/share/dist/desktop-files/default /usr/share/dist/desktop-files/default
%post %post
#desktop()
#{
# DESKTOP=`grep XDG_DESKTOP_DIR $1/.config/user-dirs.dirs`
# DESKTOP=${DESKTOP##*}
#}
DESKTOP="Bureau"
mv -f /tmp/journald.conf /etc/systemd/ mv -f /tmp/journald.conf /etc/systemd/
adduser lalis getent passwd lalis
chmod -R o-rwX /home/lalis if [ $? -ne 0 ]; then
# Ajoute l'utilisateur lalis à ka liste des utilisateurs autorisés à se connecter en ssh adduser lalis
if [ -z "`grep cyberbaladeur /etc/ssh/sshd_config`" ]; then chmod -R o-rwX /home/lalis
fi
# Ajoute l'utilisateur lalis à la liste des utilisateurs autorisés à se connecter en ssh
if [ -z "`grep lalis /etc/ssh/sshd_config`" ]; then
echo "Allowusers lalis" >>/etc/ssh/sshd_config echo "Allowusers lalis" >>/etc/ssh/sshd_config
fi fi
# met en exécution pour tout le monde
chmod a+x /usr/local/bin/lalistunnel # Ajoute le fichier checklist.txt et test.desktop sur le bureau de l'utilisateur lalis
#desktop /home/lalis
if ! [ -d "/home/lalis/$DESKTOP" ]; then
/usr/bin/mkdir "/home/lalis/$DESKTOP"
fi
cp %{SOURCE7} /home/lalis/$DESKTOP/
cp %{SOURCE6} /home/lalis/$DESKTOP/
chown lalis:lalis -R /home/lalis
# met en exécution pour tout le monde les outils lalis
chmod a+x /usr/local/bin/%{SOURCE2}
chmod a+x /usr/local/bin/%{SOURCE4}
chmod a+x /usr/local/bin/%{SOURCE5}
# Copie le fichier Lalis.desktop dans les dossier utilisateurs existant # Copie le fichier Lalis.desktop dans les dossier utilisateurs existant
cp -f /usr/share/kio_desktop/Lalis.desktop /usr/share/dist/desktop-files/default/ cp -f /usr/share/kio_desktop/Lalis.desktop /usr/share/dist/desktop-files/default/
for i in /home/* for i in /home/*
do do
if [ "$i" != "/home/lost+found" ]; then USER=`basename "$i"`
echo "$i" getent passwd "$USER"
if [ $? -eq 0 ]; then
if [ -d $i ]; then if [ -d $i ]; then
if [ -d "$i/Bureau" ]; then # desktop "/home/$i"
D="$i/Bureau" if ! [ -d "$i/$DESKTOP" ]; then
elif [ -d "$i/Desktop" ]; then su -c "mkdir $i/Bureau" - "$USER"
D="$i/Desktop"
fi fi
cp -fa /usr/share/kio_desktop/Lalis.desktop "$D/" cp -fa /usr/share/kio_desktop/Lalis.desktop "$i/$DESKTOP/"
OWNER=`basename $i` chown $USER:$USER "$i/$DESKTOP/Lalis.desktop"
chown $OWNER:$OWNER "$D/Lalis.desktop"
fi fi
fi fi
done done