Update 'install.sh'
This commit is contained in:
53
install.sh
53
install.sh
@@ -1,28 +1,51 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
echo "This is the help"
|
echo "Usage: install.sh [cmd] [ -y | --yes ] [ -h | --help ] [ -m | --arch ARCH-STRING ] [ -d | --debug ]
|
||||||
|
[ -d | --delta DELTA ] filename(s)"
|
||||||
|
echo "Available commands:
|
||||||
|
update
|
||||||
|
install"
|
||||||
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PARSED_ARGUMENTS=$(getopt -a -n install.sh -o hvyi:acrbm:p --long yes,help,debug,arch: -- "$@")
|
||||||
|
VALID_ARGUMENTS=$?
|
||||||
|
if [ "$VALID_ARGUMENTS" != "0" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
ARCH=$(/usr/bin/dpkg --print-architecture)
|
ARCH=$(/usr/bin/dpkg --print-architecture)
|
||||||
|
|
||||||
while getopts "h?vyi:acrbm:p" opt; do
|
echo "PARSED_ARGUMENTS is $PARSED_ARGUMENTS"
|
||||||
case "$opt" in
|
eval set -- "$PARSED_ARGUMENTS"
|
||||||
h|\?) show_help; exit 0 ;;
|
while :
|
||||||
v) P_Verbose=1 ;;
|
do
|
||||||
d) P_Debug=1 ;;
|
case "$1" in
|
||||||
y) P_Yes=1 ;;
|
-h | --help) show_help ;;
|
||||||
p) P_APT=1; P_DEB=1 ;;
|
-v) P_Verbose=1 ; shift ;;
|
||||||
c) P_CONFIG=1 ;;
|
-d | --debug) P_Debug=1 ; shift ;;
|
||||||
r) P_RC=1 ;;
|
-y) P_Yes=1 ; shift ;;
|
||||||
b) P_BINARY=1 ;;
|
-p) P_APT=1; P_DEB=1 ; shift ;;
|
||||||
i) P_Install=$OPTARG ;;
|
-c) P_CONFIG=1 ; shift ;;
|
||||||
m) ARCH=$OPTARG ;;
|
-r) P_RC=1 ; shift ;;
|
||||||
z) P_ZSH=1 ;;
|
-b) P_BINARY=1 ; shift ;;
|
||||||
a) P_APT=1; P_DEB=1; P_CONFIG=1; P_RC=1; P_BINARY=1; P_ZSH=1 ;;
|
-i) P_Install="$2"; shift 2 ;;
|
||||||
|
-m | --arch) ARCH="$2" ; shift 2 ;;
|
||||||
|
-z) P_ZSH=1 ; shift ;;
|
||||||
|
-a) P_APT=1; P_DEB=1; P_CONFIG=1; P_RC=1; P_BINARY=1; P_ZSH=1; shift ;;
|
||||||
|
# -- means the end of the arguments; drop this, and break out of the while loop
|
||||||
|
--) shift; break ;;
|
||||||
|
# If invalid options were passed, then getopt should have reported an error,
|
||||||
|
# which we checked as VALID_ARGUMENTS when getopt was called...
|
||||||
|
*) echo "Unexpected option: $1 - this should not happen."
|
||||||
|
usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Parameters remaining are: $@"
|
||||||
|
|
||||||
|
|
||||||
ASK="\e[34m"
|
ASK="\e[34m"
|
||||||
INFO="\e[91m\e[1m"
|
INFO="\e[91m\e[1m"
|
||||||
ADD="\e[32m\e[1m"
|
ADD="\e[32m\e[1m"
|
||||||
|
|||||||
Reference in New Issue
Block a user