From cea7e7d015d68fbc846a855d03e9c79c83168896 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 22 Mar 2019 18:19:38 +0100 Subject: [PATCH] =?UTF-8?q?=C3=A7a=20avance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SOURCES/identPC.sh | 2 +- SOURCES/sync_check.sh | 23 ++++++++++++---- SOURCES/test.desktop | 19 +++++++++++++ SPECS/task-lalis.spec | 64 ++++++++++++++++++++++++++++++------------- 4 files changed, 83 insertions(+), 25 deletions(-) mode change 100644 => 100755 SOURCES/sync_check.sh create mode 100755 SOURCES/test.desktop diff --git a/SOURCES/identPC.sh b/SOURCES/identPC.sh index e7c614a..2a04276 100755 --- a/SOURCES/identPC.sh +++ b/SOURCES/identPC.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/bash ######### Script d'etablissement de la fiche technique d'un PC ######### FILE="identification.txt" diff --git a/SOURCES/sync_check.sh b/SOURCES/sync_check.sh old mode 100644 new mode 100755 index df87023..a3041f7 --- a/SOURCES/sync_check.sh +++ b/SOURCES/sync_check.sh @@ -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" diff --git a/SOURCES/test.desktop b/SOURCES/test.desktop new file mode 100755 index 0000000..f9af916 --- /dev/null +++ b/SOURCES/test.desktop @@ -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= diff --git a/SPECS/task-lalis.spec b/SPECS/task-lalis.spec index b61ed46..7ce4f78 100755 --- a/SPECS/task-lalis.spec +++ b/SPECS/task-lalis.spec @@ -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