Browse Source

Fixing a borked repo

Signed-off-by: fbt <fbt@fleshless.org>
master
Jack L. Frost 3 years ago
commit
eef7392bff
  1. 13
      LICENSE
  2. 9
      README.md
  3. 41
      shutdown

13
LICENSE

@ -0,0 +1,13 @@
Copyright (c) 2012-2014, Jack L. Frost <fbt@fleshless.org>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without
fee is hereby granted, provided that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.

9
README.md

@ -0,0 +1,9 @@
sinit-tools
===========
shutdown
--------
A script that provides a familiar command to poweroff or reboot your system.
It checks the exe name, so you can just make poweroff and reboot links in your $PATH.

41
shutdown

@ -0,0 +1,41 @@
#!/bin/sh
usage() { echo "Usage: shutdown <-p|-r>"; }
_poweroff() {
echo 'Shutting down.'
init_signal=USR1
}
_reboot() {
echo 'Rebooting.'
init_signal='INT'
}
main() {
while [ "$1" ]; do
case "$1" in
-p|--poweroff) _poweroff;;
-r|--reboot) _reboot;;
-h|--help|--usage) usage; return;;
*) usage; return 1
esac
shift
done
exe_name="${0##*/}"
if [ -z "$init_signal" ]; then
case "$exe_name" in
poweroff) _poweroff;;
reboot) _reboot;;
*) usage; return 1;;
esac
fi
kill -s "$init_signal" 1
}
main "$@"
Loading…
Cancel
Save