diff options
Diffstat (limited to 'debian/bugscript')
-rwxr-xr-x | debian/bugscript | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/bugscript b/debian/bugscript index 4fb920c2..7ecd2ccc 100755 --- a/debian/bugscript +++ b/debian/bugscript @@ -28,6 +28,53 @@ if ! command -v yesno >/dev/null; then exec 3>&1 fi +if [ $(id -u) != 0 ]; then + if [ -x "$(command -v sudo)" ]; then + yesno "Gather system information as root using sudo? (Y/n) " yep + if [ "$REPLY" = yep ]; then + echo running sudo "$0" "$@"... + sudo "$0" "$@" && exit 0 + echo "sudo invocation failed, trying /bin/su..." + fi + fi + + yesno "Gather system information as root using su? (Y/n) " yep + if [ "$REPLY" = yep ]; then + ARGS= + for i in "$@"; do ARGS="${ARGS:+$ARGS }'$1'"; shift; done + echo "running su root -s '/bin/sh -c $0 $ARGS'..." + su root -s /bin/sh -c "$0 $ARGS" && exit 0 + unset ARGS + echo "su invocation failed." + fi + + # arrive here only if neither sudo nor su worked: + yesno "Will you provide system information in the bug report yourself? (N/y) " nop + if [ "$REPLY" = yep ]; then + cat <<_eof >&3 + +IMPORTANT: + please do not forget to include all relevant system information with this + bug report. You could run + /usr/share/bug/mdadm/script 3>&1 + as root and attach or include the output. + +_eof + exit 0 + fi + + # try our best + cat <<_eof >&3 + +WARNING: + the following output was not generated by the root user. If you can, please + replace the following up until "-- System Information:" with the output of + /usr/share/bug/mdadm/script 3>&1 + run as root. Thanks! + +_eof +fi + if [ ! -r /proc/mdstat ]; then echo "The local system does not have MD (RAID) support: no drivers loaded." echo "Without MD support, I cannot collect as much information as I'd like." |