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 #########
FILE="identification.txt"

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

@ -1,5 +1,18 @@
#!/bin/sh
SERIAL=`grep -is -m 1 "serial number" ./identification.txt`
DIRNAME=${SERIAL##* }
mkdir
rsync -aP *.txt lalis69.ddns.net::lalis-ordis
#!/usr/bin/sh
#./identPC.sh
/usr/bin/kate ./checklist.txt
grep -is -m 2 "numéro de série" ./identification.txt >tmp.txt
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
Name: task-lalis
Version: 1
Release: %mkrel 3
Version: 2
Release: %mkrel 1
License: GPLv3
Group: Tools
Url: http://lalis.fr
@ -12,6 +12,7 @@ Source3: Lalis.desktop
Source4: identPC.sh
Source5: sync_check.sh
Source6: checklist.txt
Source7: test.desktop
Requires: openssh-server
Requires: sshfs-fuse
Requires: celestia
@ -129,7 +130,7 @@ cp -af %{SOURCE1} %{buildroot}/tmp/
cp -f %{SOURCE2} %{buildroot}/usr/local/bin/
cp -f %{SOURCE4} %{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/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/identPC.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/dist/desktop-files/default
%post
#desktop()
#{
# DESKTOP=`grep XDG_DESKTOP_DIR $1/.config/user-dirs.dirs`
# DESKTOP=${DESKTOP##*}
#}
DESKTOP="Bureau"
mv -f /tmp/journald.conf /etc/systemd/
adduser lalis
chmod -R o-rwX /home/lalis
# Ajoute l'utilisateur lalis à ka liste des utilisateurs autorisés à se connecter en ssh
if [ -z "`grep cyberbaladeur /etc/ssh/sshd_config`" ]; then
getent passwd lalis
if [ $? -ne 0 ]; then
adduser lalis
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
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
cp -f /usr/share/kio_desktop/Lalis.desktop /usr/share/dist/desktop-files/default/
for i in /home/*
do
if [ "$i" != "/home/lost+found" ]; then
echo "$i"
USER=`basename "$i"`
getent passwd "$USER"
if [ $? -eq 0 ]; then
if [ -d $i ]; then
if [ -d "$i/Bureau" ]; then
D="$i/Bureau"
elif [ -d "$i/Desktop" ]; then
D="$i/Desktop"
# desktop "/home/$i"
if ! [ -d "$i/$DESKTOP" ]; then
su -c "mkdir $i/Bureau" - "$USER"
fi
cp -fa /usr/share/kio_desktop/Lalis.desktop "$D/"
OWNER=`basename $i`
chown $OWNER:$OWNER "$D/Lalis.desktop"
cp -fa /usr/share/kio_desktop/Lalis.desktop "$i/$DESKTOP/"
chown $USER:$USER "$i/$DESKTOP/Lalis.desktop"
fi
fi
done