added zoom to kfg (deb only for now)
This commit is contained in:
32
kfg
Normal file → Executable file
32
kfg
Normal file → Executable file
@@ -9,10 +9,11 @@ CONFIG_PATH="$HOME_PATH/.config"
|
||||
BINARY_PATH="/usr/bin"
|
||||
RC_FILE=".zshrc"
|
||||
|
||||
ASK="\e[38;5;9m"
|
||||
ASK="\e[38;5;180m"
|
||||
INFO="\e[38;5;39m"
|
||||
ADD="\e[32m\e[1m"
|
||||
ERROR="\033[0;31m"
|
||||
DEBUG="\e[33m"
|
||||
ENDCOLOR="\e[0m"
|
||||
|
||||
declare -A TOOLS || typeset -A TOOLS
|
||||
@@ -27,6 +28,7 @@ TOOLS[omp]="Customisable shell prompt renderer - https://github.com/jandedobbele
|
||||
TOOLS[zoxide]="A smarter cd command. - https://github.com/ajeetdsouza/zoxide"
|
||||
TOOLS[fzf]="A command-line fuzzy finder - https://github.com/junegunn/fzf"
|
||||
TOOLS[fzf-tab]="Replace zsh's default completion selection menu with fzf - https://github.com/Aloxaf/fzf-tab"
|
||||
TOOLS[zoom]="Conference platform Zoom - https://eu01web.zoom.us/"
|
||||
|
||||
function show_help_name {
|
||||
echo "$NAME v$VERSION"
|
||||
@@ -51,7 +53,7 @@ function show_help_opt {
|
||||
|
||||
function show_help {
|
||||
show_help_name
|
||||
echo -e "Usage: $NAME <cmd> [ opt ]\n"
|
||||
echo -e "Usage: ${INFO}${NAME}${ENDCOLOR} cmd [ opt ... ]\n"
|
||||
show_help_cmd
|
||||
show_help_opt
|
||||
exit 2
|
||||
@@ -85,7 +87,7 @@ function err {
|
||||
|
||||
function log_debug {
|
||||
if [ -z "$P_Debug" ]; then return 0; fi
|
||||
log "$INFO" "&" "$1"
|
||||
log "$DEBUG" "~" "$1"
|
||||
}
|
||||
|
||||
function ask {
|
||||
@@ -169,7 +171,7 @@ function install_rc {
|
||||
echo "$SOURCE_CMD" >> "$RC"
|
||||
log_add "Added \"$SOURCE_CMD\" to $RC"
|
||||
else
|
||||
log_info "\"$SOURCE_CMD\" already in $RC"
|
||||
log_debug "\"$SOURCE_CMD\" already in $RC"
|
||||
fi
|
||||
|
||||
# Add the file to the rc file as source $file in root
|
||||
@@ -178,7 +180,7 @@ function install_rc {
|
||||
echo "$SOURCE_CMD" | sudo tee -a "$RC_ROOT"
|
||||
log_add "Added \"$SOURCE_CMD\" to $RC_ROOT"
|
||||
else
|
||||
log_info "\"$SOURCE_CMD\" already in $RC_ROOT"
|
||||
log_debug "\"$SOURCE_CMD\" already in $RC_ROOT"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -198,7 +200,7 @@ function download {
|
||||
if [ -n "$_path" ]; then
|
||||
|
||||
mkdir -p "$(dirname "$_path")"
|
||||
log_info "Downloading $_url to $_path"
|
||||
log_debug "Downloading $_url to $_path"
|
||||
|
||||
case "${_dld}" in
|
||||
curl) _args="-sLo $_path" ;;
|
||||
@@ -354,7 +356,7 @@ function github_download_config {
|
||||
}
|
||||
|
||||
function install_deb_check {
|
||||
CHECK_CURRENT=$(dpkg -s "$1" | grep -E "Status|Version")
|
||||
CHECK_CURRENT=$(dpkg -s "$1" 2>&1 | grep -E "Status|Version")
|
||||
#INSTALLED_CURRENT=$(echo $CHECK_CURRENT | grep -oE "Status: .*" | cut -d ' ' -f 2)
|
||||
VERSION_CURRENT=$(echo $CHECK_CURRENT | grep -oE "Version: .*" | cut -d ' ' -f 2)
|
||||
CHECK_NEW=$(sudo dpkg -I $2 | grep -E "Status|Version")
|
||||
@@ -387,13 +389,16 @@ function install_deb {
|
||||
fi
|
||||
|
||||
INSTALL=$(sudo dpkg -i "$_file")
|
||||
log_debug "$INSTALL"
|
||||
UNPACK=$(echo -n "$INSTALL" | grep -oE "Unpacking .*")
|
||||
PROG=$(echo -n "$UNPACK" | cut -d '(' -f 1 | cut -d ' ' -f 2)
|
||||
CURR_VERSION=$(echo -n "$UNPACK" | cut -d '(' -f 2 | cut -d ')' -f 1)
|
||||
log_debug "Current Version: $CURR_VERSION"
|
||||
PREV_VERSION=$(echo -n "$UNPACK" | cut -d '(' -f 3 | cut -d ')' -f 1)
|
||||
log_debug "Previous Version: $PREV_VERSION"
|
||||
color "$ADD" "[+]"
|
||||
echo -n "Installed $PROG ($CURR_VERSION)"
|
||||
if [ -n "${PREV_VERSION+x}" ]; then
|
||||
if [ ! -z "${PREV_VERSION}" ] && [ "${PREV_VERSION}" != "${CURR_VERSION}" ]; then
|
||||
echo " over ($PREV_VERSION)"
|
||||
else
|
||||
echo ""
|
||||
@@ -485,7 +490,7 @@ function update {
|
||||
|
||||
function show_help_install {
|
||||
show_help_name
|
||||
echo -e "Usage: $NAME install <program> [ opt ]\n"
|
||||
echo -e "Usage: ${INFO}${NAME}${ENDCOLOR} install <program> [ opt ]\n"
|
||||
echo -e "program := {"
|
||||
local _length _space
|
||||
for key in "${!TOOLS[@]}"; do
|
||||
@@ -636,6 +641,14 @@ function p_fzf_tab {
|
||||
install_rc_file "${CONFIG_PATH}/fzf/tools/fzf-tab/fzf-tab.plugin.zsh"
|
||||
}
|
||||
|
||||
function p_zoom {
|
||||
# Install latest release version of zoom
|
||||
local _path_zoom
|
||||
_path_zoom="$TMP_PATH/zoom"
|
||||
download "https://eu01web.zoom.us/client/latest/zoom_amd64.deb" "${_path_zoom}"
|
||||
install_deb "zoom_amd64.deb" "${_path_zoom}"
|
||||
}
|
||||
|
||||
function install {
|
||||
if [ -z "$1" ]; then
|
||||
show_help_install
|
||||
@@ -668,6 +681,7 @@ function install {
|
||||
omp) p_omp; shift ;;
|
||||
zoxide) p_zoxide; shift ;;
|
||||
fzf) p_fzf; shift ;;
|
||||
zoom) p_zoom; shift ;;
|
||||
# If invalid options were passed, then getopt should have reported an error,
|
||||
# which we checked as VALID_ARGUMENTS when getopt was called...
|
||||
*) log_error "Unrecognised program: $1"; shift ;;
|
||||
|
||||
Reference in New Issue
Block a user