Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reboot script] add -h, -? options #484

Merged
merged 4 commits into from
Mar 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@ function clear_warm_boot()
/sbin/kexec -u || /bin/true
}

SCRIPT=$0

function show_help_and_exit()
{
echo "Usage ${SCRIPT} [options]"
echo " Available options:"
echo " -h -? : getting this help"
jleveque marked this conversation as resolved.
Show resolved Hide resolved
echo " -x : execute with -x flag"
jleveque marked this conversation as resolved.
Show resolved Hide resolved

exit 0
}

function parse_options()
{
while getopts "h?x" opt; do
case ${opt} in
h )
show_help_and_exit
;;
\? )
jleveque marked this conversation as resolved.
Show resolved Hide resolved
show_help_and_exit
;;
x )
set -x
;;
esac
done
}

parse_options $@

# Exit if not superuser
if [[ "$EUID" -ne 0 ]]; then
echo "This command must be run as root" >&2
Expand Down