Update 'install.sh'
This commit is contained in:
11
install.sh
11
install.sh
@@ -6,18 +6,19 @@ function show_help {
|
|||||||
|
|
||||||
ARCH=$(/usr/bin/dpkg --print-architecture)
|
ARCH=$(/usr/bin/dpkg --print-architecture)
|
||||||
|
|
||||||
while getopts "h?vyi:acrbm:" opt; do
|
while getopts "h?vyi:acrbm:p" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h|\?) show_help; exit 0 ;;
|
h|\?) show_help; exit 0 ;;
|
||||||
v) P_Verbose=1 ;;
|
v) P_Verbose=1 ;;
|
||||||
d) P_Debug=1 ;;
|
d) P_Debug=1 ;;
|
||||||
y) P_Yes=1 ;;
|
y) P_Yes=1 ;;
|
||||||
a) P_APT=1 ;;
|
p) P_APT=1; P_DEB=1 ;;
|
||||||
c) P_CONFIG=1 ;;
|
c) P_CONFIG=1 ;;
|
||||||
r) P_RC=1 ;;
|
r) P_RC=1 ;;
|
||||||
b) P_BINARY=1 ;;
|
b) P_BINARY=1 ;;
|
||||||
i) P_Install=$OPTARG ;;
|
i) P_Install=$OPTARG ;;
|
||||||
m) ARCH=$OPTARG ;;
|
m) ARCH=$OPTARG ;;
|
||||||
|
a) P_APT=1; P_DEB=1; P_CONFIG=1; P_RC=1; P_BINARY=1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ function user_confirm_overwrite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function download_config {
|
function download_config {
|
||||||
|
if [ ! -z "$P_CONFIG" ]; then return 0; fi
|
||||||
mkdir -p "$CONFIG_PATH/$1/"
|
mkdir -p "$CONFIG_PATH/$1/"
|
||||||
FILE="$CONFIG_PATH/$1/$2"
|
FILE="$CONFIG_PATH/$1/$2"
|
||||||
if [ ! -e "$FILE" ] || user_confirm_overwrite "$FILE"; then
|
if [ ! -e "$FILE" ] || user_confirm_overwrite "$FILE"; then
|
||||||
@@ -91,6 +93,7 @@ function download_config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function install_rc {
|
function install_rc {
|
||||||
|
if [ ! -z "$P_RC" ]; then return 0; fi
|
||||||
# Make sure the directory exists
|
# Make sure the directory exists
|
||||||
mkdir -p "$CONFIG_PATH/$1/"
|
mkdir -p "$CONFIG_PATH/$1/"
|
||||||
|
|
||||||
@@ -125,6 +128,7 @@ function install_rc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init_install_rc {
|
function init_install_rc {
|
||||||
|
if [ ! -z "$P_RC" ]; then return 0; fi
|
||||||
# Add the file to the rc file as source $file
|
# Add the file to the rc file as source $file
|
||||||
SOURCE_CMD="$1"
|
SOURCE_CMD="$1"
|
||||||
RC="$HOME_PATH/$RC_FILE"
|
RC="$HOME_PATH/$RC_FILE"
|
||||||
@@ -168,7 +172,7 @@ function install_deb_check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function install_deb {
|
function install_deb {
|
||||||
if [ ! -z "$P_" ]; then return 0; fi
|
if [ ! -z "$P_DEB" ]; then return 0; fi
|
||||||
log_info "Downloading $2 to $TMP_PATH ..."
|
log_info "Downloading $2 to $TMP_PATH ..."
|
||||||
wget -O $TMP_PATH/$1.deb $2 > /dev/null 2>&1
|
wget -O $TMP_PATH/$1.deb $2 > /dev/null 2>&1
|
||||||
|
|
||||||
@@ -209,6 +213,7 @@ function cleanup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apt_install {
|
function apt_install {
|
||||||
|
if [ ! -z "$P_APT" ]; then return 0; fi
|
||||||
RESULT=$(sudo apt install -y $1 2>&1 )
|
RESULT=$(sudo apt install -y $1 2>&1 )
|
||||||
if echo "$1 is already the newest version" | grep "$RESULT" > /dev/null; then
|
if echo "$1 is already the newest version" | grep "$RESULT" > /dev/null; then
|
||||||
log_info "$1 is already installed"
|
log_info "$1 is already installed"
|
||||||
|
|||||||
Reference in New Issue
Block a user