From 6e20aad6f8b3e85afb16ebdbdee4cbdcfc68fdb0 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Tue, 8 Nov 2022 22:33:13 +0800 Subject: [PATCH] install.sh: --auto --- install.sh | 38 ++++++++++++++++++++++++++++++++++++++ tools/alpine.sh | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 5ac20c8..9ea802e 100755 --- a/install.sh +++ b/install.sh @@ -26,6 +26,43 @@ declare -a HOME_SYMLINKS_DST HOME_SYMLINKS_SRC[0]=".ssh/authorized_keys2" HOME_SYMLINKS_DST[0]=".ssh/authorized_keys2" +install_dependencies() +{ + fmt_info "installing dependencies ..." + case $(get_os_type) in + "linux" ) + case $(get_linux_dist) in + "ubuntu"|"debian" ) + $SUDO apt-get update + $SUDO apt-get install -y git zsh bash tmux vim python3 python3-pip curl inetutils-ping + ;; + "alpine" ) + $SUDO apk update + $SUDO apk add zsh bash git tmux vim curl python3 py3-pip fzf iputils coreutils + ;; + * ) fmt_error "dfs auto-install is not implemented on linux distribution: $(get_linux_dist)" + esac + ;; + "macos" ) + $SUDO brew update + $SUDO brew install git python3 zsh curl tmux vim + ;; + "msys" ) + pacman -Syu + pacman -S tmux git zsh bash curl vim python3 python3-pip + SUDO="" + ;; + * ) fmt_error "dfs auto-install is not implemented on OS: $(get_os_type)" + esac + + if [[ -x $(command -v pip3) ]]; then + $SUDO pip3 install requests + elif [[ -x $(command -v pip) ]]; then + $SUDO pip install requests + else + fmt_error "pip3 and pip not found. is pip correctly installed?" + fi +} preinstall_check() { @@ -214,6 +251,7 @@ while [[ $# > 0 ]]; do -r ) BIN=uninstall ;; -q ) export DFS_QUIET=1 ;; -d ) export DFS_DEV=1 ;; + -a|--auto ) install_dependencies ;; * ) fmt_warning "unknown command \"$1\". available: -i, -r, -q, -d"; exit 1 ;; esac shift diff --git a/tools/alpine.sh b/tools/alpine.sh index 0a99dd5..b98b6e1 100755 --- a/tools/alpine.sh +++ b/tools/alpine.sh @@ -14,7 +14,7 @@ apk_add() apk update # mass installation - apk add zsh git tmux vim curl wget bash python3 htop gcc g++ cmake make fzf perl linux-headers bind-tools iputils man-db coreutils + apk add zsh git tmux vim curl wget bash python3 py3-pip htop gcc g++ cmake make fzf perl linux-headers bind-tools iputils man-db coreutils #for i in {fzf,ripgrep}; do apk add $i -y; done }