Add --autosysadmin flag
This commit is contained in:
parent
95b45bac8e
commit
21f7464d42
|
@ -5,6 +5,7 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Add `--autosysadmin` flag
|
||||||
* Commit change in /etc of lxc containers
|
* Commit change in /etc of lxc containers
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -47,6 +47,7 @@ Options
|
||||||
--no-evocheck disable evocheck execution
|
--no-evocheck disable evocheck execution
|
||||||
--auto use "auto" mode
|
--auto use "auto" mode
|
||||||
--no-auto use "manual" mode (default)
|
--no-auto use "manual" mode (default)
|
||||||
|
--autosysadmin author change as autosysadmin
|
||||||
-v, --verbose increase verbosity
|
-v, --verbose increase verbosity
|
||||||
-n, --dry-run actions are not executed
|
-n, --dry-run actions are not executed
|
||||||
--help print this message and exit
|
--help print this message and exit
|
||||||
|
@ -97,9 +98,9 @@ get_who() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_begin_date() {
|
get_begin_date() {
|
||||||
# XXX Begin end date isn't applicable when used in autosysadmin,
|
# XXX A begin date isn't applicable when used in autosysadmin, so we
|
||||||
# so we use the same one as the end date.
|
# use the same date as the end date.
|
||||||
if [ "${AUTOSYSADMIN}" -eq 1 ]; then
|
if is_autosysadmin; then
|
||||||
get_end_date
|
get_end_date
|
||||||
else
|
else
|
||||||
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
||||||
|
@ -108,7 +109,7 @@ get_begin_date() {
|
||||||
|
|
||||||
get_ip() {
|
get_ip() {
|
||||||
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
||||||
if [ "${AUTOSYSADMIN}" -eq 1 ] || [ "${ip}" = ":0" ]; then
|
if is_autosysadmin || [ "${ip}" = ":0" ]; then
|
||||||
ip="localhost"
|
ip="localhost"
|
||||||
elif [ -z "${ip}" ]; then
|
elif [ -z "${ip}" ]; then
|
||||||
ip="unknown (no tty)"
|
ip="unknown (no tty)"
|
||||||
|
@ -126,7 +127,7 @@ get_now() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user() {
|
get_user() {
|
||||||
if [ "${AUTOSYSADMIN}" -eq 1 ]; then
|
if is_autosysadmin; then
|
||||||
echo autosysadmin
|
echo autosysadmin
|
||||||
else
|
else
|
||||||
logname
|
logname
|
||||||
|
@ -191,6 +192,10 @@ print_session_data() {
|
||||||
printf "Message : %s\n" "${MESSAGE}"
|
printf "Message : %s\n" "${MESSAGE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_autosysadmin() {
|
||||||
|
test "${AUTOSYSADMIN}" -eq 1
|
||||||
|
}
|
||||||
|
|
||||||
is_repository_readonly() {
|
is_repository_readonly() {
|
||||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
partition=$(stat -f '%Sd' $1)
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
@ -515,7 +520,7 @@ HOSTNAME_TEXT=$(get_complete_hostname)
|
||||||
IP=$(get_ip)
|
IP=$(get_ip)
|
||||||
BEGIN_DATE=$(get_begin_date)
|
BEGIN_DATE=$(get_begin_date)
|
||||||
END_DATE=$(get_end_date)
|
END_DATE=$(get_end_date)
|
||||||
USER=$(logname)
|
USER=$(get_user)
|
||||||
|
|
||||||
PATH=${PATH}:/usr/sbin
|
PATH=${PATH}:/usr/sbin
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue