Added -h/--help and fixed a typo
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
# March
|
# March
|
||||||
|
|
||||||
A small script to automate my archlinux configuration
|
A small script to automate my archlinux configuration.
|
||||||
|
|||||||
23
install.sh
23
install.sh
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o errexit -o pipefail -o noclobber -o nounset
|
set -o errexit -o pipefail -o noclobber -o nounset
|
||||||
|
|
||||||
! getopt --test > /dev/null
|
! getopt --test > /dev/null
|
||||||
@@ -8,8 +7,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OPTIONS=dtlhus
|
OPTIONS=dtlhush
|
||||||
LONGOPTS=device,timezone,locale,hostname,username,sudogrp
|
LONGOPTS=device,timezone,locale,hostname,username,sudogrp,help
|
||||||
|
|
||||||
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
|
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
|
||||||
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
||||||
@@ -52,9 +51,25 @@ while true; do
|
|||||||
sudogrp="$2"
|
sudogrp="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-h|--help)
|
||||||
|
description=$(< tail -n +3 $CWD/README.md)
|
||||||
|
echo "
|
||||||
|
Usage: ./install.sh -d [DEVICE] -t [/usr/share/zoneinfo/REGION/CITY] -l [LOCALE] -h [HOSTNAME] -u [USER] -s [SUDO]
|
||||||
|
|
||||||
|
Mandatory arguments:
|
||||||
|
-d | --device Device that shoud be partitioned e.g. "/dev/sda"
|
||||||
|
-t | --timezone Your timezone according to /usr/share/zoneinfo/ e.g. "/usr/share/zoneinfo/EUROPE/Berlin"
|
||||||
|
-l | --locale Your locale according to /etc/locale.gen e.g. "en_US.UTF-8 UTF-8"
|
||||||
|
-h | --hostname Name for your machine e.g. "ArchLinux"
|
||||||
|
-u | --username Your username e.g. "foo"
|
||||||
|
-s | --sudogrp Name of the sudogrp
|
||||||
|
-h | --help This ehre.
|
||||||
|
"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Programming error"
|
echo "Programming error"
|
||||||
exit3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user