mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-01 21:00:29 +08:00
finish combination; get_os_name; macos.sh
This commit is contained in:
parent
104d1b1db3
commit
df8eddf846
22
install.sh
22
install.sh
@ -29,30 +29,20 @@ HOME_SYMLINKS_DST[0]=".ssh/authorized_keys2"
|
||||
install_dependencies()
|
||||
{
|
||||
fmt_note "installing dependencies ..."
|
||||
case $(get_os_type) in
|
||||
"linux" )
|
||||
case $(get_linux_dist) in
|
||||
case $(get_os_name) in
|
||||
"ubuntu"|"debian" )
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils
|
||||
DFS_LITE=$DFS_LITE $SUDO $DOTFILES/tools/ubuntu.sh apt-install
|
||||
;;
|
||||
"alpine" )
|
||||
$SUDO apk update
|
||||
$SUDO apk add zsh bash git tmux vim curl fzf iputils coreutils util-linux
|
||||
;;
|
||||
* ) fmt_error "dfs auto-install is not implemented on linux distribution: $(get_linux_dist)"
|
||||
esac
|
||||
DFS_LITE=$DFS_LITE $SUDO $DOTFILES/tools/alpine.sh apk-add
|
||||
;;
|
||||
"macos" )
|
||||
$SUDO brew update
|
||||
$SUDO brew install git zsh curl tmux vim util-linux
|
||||
DFS_LITE=$DFS_LITE $SUDO $DOTFILES/tools/macos.sh brew-install
|
||||
;;
|
||||
"msys" )
|
||||
pacman -Syu
|
||||
pacman -S tmux git zsh bash curl vim
|
||||
SUDO=""
|
||||
DFS_LITE=$DFS_LITE $SUDO $DOTFILES/tools/msys2.sh pacman-S
|
||||
;;
|
||||
* ) fmt_error "dfs auto-install is not implemented on OS: $(get_os_type)"
|
||||
* ) fmt_error "dfs auto-install is not implemented on OS: $(get_os_name)"
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,13 @@ apk_add()
|
||||
{
|
||||
apk update
|
||||
|
||||
# mass installation
|
||||
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 util-linux
|
||||
#for i in {fzf,ripgrep}; do apk add $i -y; done
|
||||
# lite
|
||||
apk add zsh bash git tmux vim curl fzf iputils coreutils util-linux
|
||||
|
||||
# full
|
||||
if [[ -z "$DFS_LITE" ]]; then
|
||||
apk add wget python3 py3-pip htop gcc g++ cmake make perl linux-headers bind-tools man-db
|
||||
fi
|
||||
}
|
||||
|
||||
set_timezone()
|
||||
|
@ -172,7 +172,8 @@ apost_beacon()
|
||||
post_beacon "$@" 1>/dev/null &
|
||||
}
|
||||
|
||||
get_os_type() {
|
||||
get_os_type()
|
||||
{
|
||||
local ans="unknown"
|
||||
case "$(uname -s)" in
|
||||
Darwin*) ans="MacOS";;
|
||||
@ -184,7 +185,8 @@ get_os_type() {
|
||||
echo $ans | tr '[:upper:]' '[:lower:]'
|
||||
}
|
||||
|
||||
get_linux_dist() {
|
||||
get_linux_dist()
|
||||
{
|
||||
local ans="unknown"
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
@ -206,6 +208,15 @@ get_linux_dist() {
|
||||
echo $ans | tr '[:upper:]' '[:lower:]'
|
||||
}
|
||||
|
||||
get_os_name()
|
||||
{
|
||||
local ans=$(get_os_type)
|
||||
if [[ "$ans" == "linux" ]]; then
|
||||
ans=$(get_linux_dist)
|
||||
fi
|
||||
echo $ans
|
||||
}
|
||||
|
||||
# if bash-ed, else source-d
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
$1 "${@:2}"
|
||||
|
19
tools/macos.sh
Normal file
19
tools/macos.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
brew_install()
|
||||
{
|
||||
brew update
|
||||
brew install git zsh curl tmux vim util-linux
|
||||
}
|
||||
|
||||
router()
|
||||
{
|
||||
case $1 in
|
||||
brew_install ) brew_install ;;
|
||||
* ) echo unknown command "$1". available: brew_install;;
|
||||
esac
|
||||
}
|
||||
|
||||
router $@
|
@ -13,7 +13,12 @@ set_mirror()
|
||||
pacman_S()
|
||||
{
|
||||
pacman -Syu
|
||||
pacman -S tmux git zsh curl vim wget base-devel mingw-w64-x86_64-toolchain make cmake gcc zip unzip python3 python3-pip man-pages-posix
|
||||
# lite
|
||||
pacman -S tmux git zsh bash curl vim
|
||||
# full
|
||||
if [[ -z "$DFS_LITE" ]]; then
|
||||
pacman -S wget base-devel mingw-w64-x86_64-toolchain make cmake gcc zip unzip python3 python3-pip man-pages-posix
|
||||
fi
|
||||
}
|
||||
|
||||
router()
|
||||
|
@ -11,17 +11,15 @@ set_mirror()
|
||||
|
||||
apt_install()
|
||||
{
|
||||
# basic packages
|
||||
apt-get update
|
||||
for i in {man-db,vim,ca-certificates}; do apt-get install $i -y; done
|
||||
apt-get update -y
|
||||
|
||||
# lite
|
||||
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils
|
||||
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils ca-certificates
|
||||
|
||||
# full
|
||||
if [[ -z "$DFS_LITE" ]]; then
|
||||
apt-get install wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron openssh-client openssh-server htop gcc g++ cmake make zip
|
||||
for i in {fzf,ripgrep}; do apt-get install -y $i; done
|
||||
for i in {fzf,ripgrep,man-db}; do apt-get install -y $i; done
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user