mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.55.2
This commit is contained in:
parent
00aa00f41d
commit
2a06f40749
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version=2.55.1
|
version=2.55.2
|
||||||
date="5/12/2017"
|
date="5/12/2017"
|
||||||
projet="simpledeb"
|
projet="simpledeb"
|
||||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||||
|
@ -219,6 +219,50 @@ f__wget_test(){ # 5/12/2017
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# user ayant initié la session graphique, assigne $fu_user
|
||||||
|
# return 1 sur échec identification user, return 2 sur absence home/
|
||||||
|
# gestion variable environnement user avec: USER_INSTALL=<user> script
|
||||||
|
f__user(){ # 3/12/2017
|
||||||
|
local user userid test root_login
|
||||||
|
|
||||||
|
root_login="$(grep ':0:' /etc/passwd | cut -d':' -f1)" || root_login="root"
|
||||||
|
if [ "$USER_INSTALL" ]; then # user via variable environnement, moyen d'injecter root si pb
|
||||||
|
fu_user="$USER_INSTALL";
|
||||||
|
return 0
|
||||||
|
elif [[ "$TERM" =~ linux ]]; then #debian 9 recovery ou nomodeset TERM=linux
|
||||||
|
if [ "$USER" ]; then
|
||||||
|
user="$USER"
|
||||||
|
elif [ "$EUID" -eq 0 ]; then
|
||||||
|
fu_user="$root_login"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$SUDO_UID" ]; then
|
||||||
|
userid="$SUDO_UID";
|
||||||
|
elif grep -qEo '[0-9]+' <<< "$XDG_RUNTIME_DIR" ; then
|
||||||
|
userid="$(grep -Eo '[0-9]+' <<< $XDG_RUNTIME_DIR | cut -d'/' -f4)"
|
||||||
|
elif grep -qEo '[0-9]+' <<< "$XAUTHORITY" ; then
|
||||||
|
userid="$(grep -Eo '[0-9]+' <<< $XAUTHORITY | cut -d'/' -f4)"
|
||||||
|
fi
|
||||||
|
[ "$userid" ] && user="$(grep $userid /etc/passwd | cut -d ":" -f 1 )"
|
||||||
|
if [ "$user" ] && [ "$user" != "$root_login" ]; then
|
||||||
|
fu_user="$user"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
if [ "$SUDO_USER" ] && [ "$SUDO_USER" != "$root_login" ]; then
|
||||||
|
user="$SUDO_USER";
|
||||||
|
elif grep -qv 'root' <<< "$(who)"; then
|
||||||
|
user="$(grep -v 'root' <<< $(who) | head -n1 | cut -d ' ' -f1)"; # grep -v 'root' <<< $(who) | gawk 'FNR==1{print $1}'
|
||||||
|
elif grep -q 'hourly.*get[A-Z].*\.anacrontab.*\.config/anacron/spool' /etc/crontab; then
|
||||||
|
user="$(grep 'hourly.*get[A-Z].*\.anacrontab.*\.config/anacron/spool' /etc/crontab | head -n1 | cut -d' ' -f2)"; # grep 'hourly.*get[A-Z].*\.anacrontab.*\.config/anacron/spool' /etc/crontab | gawk 'FNR==1{print $2}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fu_user="$user"
|
||||||
|
[ "$fu_user" ] || return 1
|
||||||
|
[ -d "/home/$fu_user" ] || return 2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# $1='-l' comptage ligne dans variable $2, affiche quantité
|
# $1='-l' comptage ligne dans variable $2, affiche quantité
|
||||||
# $1='-w' comptage dans variable $2 des mots
|
# $1='-w' comptage dans variable $2 des mots
|
||||||
# $1='-wv' comptage dans variable $2, des mots $3, affiche quantité
|
# $1='-wv' comptage dans variable $2, des mots $3, affiche quantité
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* révision: fscript_cronAnacron, fscript_install, fscript_remove, fscript_update
|
* révision: fscript_cronAnacron, fscript_install, fscript_remove, fscript_update
|
||||||
f__log, renommage $fileInstall $fileLogs
|
f__log, renommage $fileInstall $fileLogs
|
||||||
* fix: f__wget_test
|
* fix: f__wget_test
|
||||||
|
* fix: fonction manquante
|
||||||
|
|
||||||
## 2.54.0 03/12/2017
|
## 2.54.0 03/12/2017
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue