Added -h/--help and fixed a typo

This commit is contained in:
TuDatTr
2020-05-23 18:25:34 +02:00
parent 60d8d78979
commit 3b17b736d3
2 changed files with 20 additions and 5 deletions

View File

@@ -1,3 +1,3 @@
# March
A small script to automate my archlinux configuration
A small script to automate my archlinux configuration.

View File

@@ -1,5 +1,4 @@
#!/bin/bash
set -o errexit -o pipefail -o noclobber -o nounset
! getopt --test > /dev/null
@@ -8,8 +7,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
exit 1
fi
OPTIONS=dtlhus
LONGOPTS=device,timezone,locale,hostname,username,sudogrp
OPTIONS=dtlhush
LONGOPTS=device,timezone,locale,hostname,username,sudogrp,help
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
@@ -52,6 +51,22 @@ while true; do
sudogrp="$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"
exit 3