[misc] posix-compliant
This commit is contained in:
parent
fba122e122
commit
757e2c547b
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
set -e
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# let docker be able to build arm image on x86
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install docker
|
||||
|
@ -10,7 +10,7 @@ case "$PM" in
|
|||
# snap docker will intefere native docker.io, must be dealt with
|
||||
sudo snap remove --purge docker
|
||||
sudo apt install -y docker.io docker-compose
|
||||
! which pip3 && $ROOT/python/install.sh
|
||||
! command -v pip3 && "$ROOT/python/install.sh"
|
||||
sudo pip3 install docker-compose
|
||||
;;
|
||||
pacman)
|
||||
|
@ -24,18 +24,18 @@ sudo systemctl start docker
|
|||
|
||||
|
||||
# configuration
|
||||
sudo usermod -aG docker $USER
|
||||
sudo usermod -aG docker "$USER"
|
||||
|
||||
# completion
|
||||
case "$DEFAULT_SHELL" in
|
||||
$FISH)
|
||||
curl -sLo $HOME/.config/fish/completions/docker.fish --create-dirs \
|
||||
curl -sLo "$HOME/.config/fish/completions/docker.fish" --create-dirs \
|
||||
'https://github.com/docker/cli/raw/master/contrib/completion/fish/docker.fish'
|
||||
;;
|
||||
esac
|
||||
|
||||
# set mirror
|
||||
if in-china && [[ -d /etc/docker ]]; then
|
||||
if in_china && [ -d /etc/docker ]; then
|
||||
if [ -f /etc/docker/daemon.json ]; then
|
||||
# backup
|
||||
[ ! -f /etc/docker/daemon.bak.json ] && \
|
||||
|
@ -43,7 +43,7 @@ if in-china && [[ -d /etc/docker ]]; then
|
|||
# read
|
||||
dj=$(cat /etc/docker/daemon.json)
|
||||
fi
|
||||
[[ -z $dj ]] && dj='{}'
|
||||
[ -z "$dj" ] && dj='{}'
|
||||
echo $dj | jq '. + {"registry-mirrors": ["https://izuhlbap.mirror.aliyuncs.com"]}' | \
|
||||
sudo tee /etc/docker/daemon.json
|
||||
sudo systemctl restart docker
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install office utilities
|
||||
|
@ -28,4 +28,4 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/zathura/zathurarc $XDG_CONFIG_HOME/zathura/zathurarc
|
||||
lnsf "$DIR/config/zathura/zathurarc" "$XDG_CONFIG_HOME/zathura/zathurarc"
|
||||
|
|
10
apps/k8s.sh
10
apps/k8s.sh
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install docker
|
||||
|
@ -17,8 +17,8 @@ esac
|
|||
# completion for fish
|
||||
case "$DEFAULT_SHELL" in
|
||||
"$FISH")
|
||||
[[ ! -f $HOME/.config/fish/completions/docker.fish ]] && \
|
||||
curl -Lo $HOME/.config/fish/completions/docker.fish --create-dirs \
|
||||
[ ! -f "$HOME/.config/fish/completions/docker.fish" ] && \
|
||||
curl -Lo "$HOME/.config/fish/completions/docker.fish" --create-dirs \
|
||||
'https://github.com/docker/cli/raw/master/contrib/completion/fish/docker.fish'
|
||||
fish -c "fisher add evanlucas/fish-kubectl-completions"
|
||||
;;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install nextcloud
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install nextcloud
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
read -p 'Please enter autologin username (empty to skip): ' username
|
||||
echo 'Please enter autologin username (empty to skip): '
|
||||
read -r username
|
||||
if [ -z "$username" ]; then
|
||||
echo skip autologin setup
|
||||
else
|
||||
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
|
||||
sed -r "s/USERNAME/$username/g" $DIR/systemd/getty1-override.conf | \
|
||||
sed -r "s/USERNAME/$username/g" "$DIR/systemd/getty1-override.conf" | \
|
||||
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf
|
||||
fi
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
$ROOT/python/install.sh
|
||||
"$ROOT/python/install.sh"
|
||||
|
||||
# install deep learning tools
|
||||
case "$PM" in
|
||||
apt)
|
||||
# cuda
|
||||
source /etc/lsb-release
|
||||
. /etc/lsb-release
|
||||
if [ "$DISTRIB_RELEASE" = "18.04" ] && [ "$(uname -m)" = 'x86_64' ]; then
|
||||
sudo apt install linux-headers-$(uname -r)
|
||||
sudo apt install "linux-headers-$(uname -r)"
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
|
||||
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
|
||||
sudo apt-key adv --fetch-keys \
|
||||
|
@ -24,20 +24,20 @@ case "$PM" in
|
|||
sudo apt install nvidia-cuda-toolkit
|
||||
else
|
||||
echo 'Unsupported release'
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# nvidia docker
|
||||
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
|
||||
distribution="$ID$VERSION_ID"
|
||||
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
|
||||
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
|
||||
curl -s -L "https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list" | \
|
||||
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
|
||||
sudo apt update
|
||||
sudo apt install -y nvidia-docker2
|
||||
;;
|
||||
pacman)
|
||||
echo TODO
|
||||
exit -1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install nvim
|
||||
case "$PM" in
|
||||
|
@ -14,5 +14,5 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/dunstrc $XDG_CONFIG_HOME/dunst/dunstrc
|
||||
lnsf $DIR/config/launch.sh $XDG_CONFIG_HOME/dunst/launch.sh
|
||||
lnsf "$DIR/config/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
|
||||
lnsf "$DIR/config/launch.sh" "$XDG_CONFIG_HOME/dunst/launch.sh"
|
||||
|
|
53
env.sh
53
env.sh
|
@ -1,61 +1,56 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
ROOT=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
||||
ROOT=$(readlink -f "$(dirname "$0")")
|
||||
PM=n/a
|
||||
DEFAULT_SHELL=$(getent passwd $USER | cut -d: -f7)
|
||||
FISH=$(which fish)
|
||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME-"$HOME/.config"}
|
||||
echo "dotfiles path: $ROOT"
|
||||
|
||||
if which pacman > /dev/null; then
|
||||
if command -v pacman > /dev/null; then
|
||||
PM=pacman
|
||||
elif which apt > /dev/null; then
|
||||
elif command -v apt > /dev/null; then
|
||||
PM=apt
|
||||
fi
|
||||
|
||||
if [ "$PM" = "n/a" ]; then
|
||||
echo "Unsupported Package Manager"
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
in-china () {
|
||||
in_china () {
|
||||
if [ -z "$IS_CHINA" ]; then
|
||||
IS_CHINA=no
|
||||
if curl -q myip.ipip.net | grep '中国' > /dev/null; then
|
||||
IS_CHINA=yes
|
||||
fi
|
||||
fi
|
||||
[ "$IS_CHINA" = "no" ] && return -1
|
||||
[ "$IS_CHINA" = "no" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
lnsf () {
|
||||
[ "$#" -ne 2 ] && echo "lnsf <target> <symlink>" && return -1
|
||||
local TARGET=$(readlink -f $1)
|
||||
local SYMLNK=$2
|
||||
[ -z "$TARGET" ] && echo "$1 not exists" && return -1
|
||||
local SYMDIR=$(dirname $SYMLNK)
|
||||
if [[ -n $SYMDIR && -L $SYMDIR ]]; then
|
||||
rm -rf $SYMDIR
|
||||
[ "$#" -ne 2 ] && echo "lnsf <target> <symlink>" && return 1
|
||||
TARGET=$(readlink -f "$1")
|
||||
SYMLNK=$2
|
||||
[ -z "$TARGET" ] && echo "$1 not exists" && return 1
|
||||
SYMDIR=$(dirname "$SYMLNK")
|
||||
if [ -n "$SYMDIR" && -L "$SYMDIR" ]; then
|
||||
rm -rf "$SYMDIR"
|
||||
fi
|
||||
mkdir -p $SYMDIR
|
||||
[ ! -L $SYMLNK ] && rm -rf $SYMLNK
|
||||
ln -sf $TARGET $SYMLNK
|
||||
mkdir -p "$SYMDIR"
|
||||
[ ! -L "$SYMLNK" ] && rm -rf "$SYMLNK"
|
||||
ln -sf "$TARGET" "$SYMLNK"
|
||||
}
|
||||
|
||||
fish-is-default-shell () {
|
||||
[ "$DEFAULT_SHELL" = "$FISH" ]
|
||||
}
|
||||
|
||||
has-bluetooth () {
|
||||
has_bluetooth () {
|
||||
dmesg | grep -i bluetooth
|
||||
}
|
||||
|
||||
eqv () {
|
||||
local VERSION_PATH=$1
|
||||
local VERSION=$2
|
||||
[ ! -f $VERSION_PATH ] && return -1
|
||||
local VERSION2=$(cat "$VERSION_PATH")
|
||||
VERSION_PATH=$1
|
||||
VERSION=$2
|
||||
[ ! -f "$VERSION_PATH" ] && return 1
|
||||
VERSION2="$(cat "$VERSION_PATH")"
|
||||
[ "$VERSION" = "$VERSION2" ]
|
||||
}
|
||||
|
||||
|
@ -78,7 +73,7 @@ case "$PM" in
|
|||
curl wget \
|
||||
man sudo
|
||||
# install yay
|
||||
if ! which yay; then
|
||||
if ! command -v yay; then
|
||||
git clone --depth 1 https://aur.archlinux.org/yay.git /tmp/yay
|
||||
cd /tmp/yay
|
||||
makepkg -si
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install fish shell
|
||||
echo Installing fish shell
|
||||
case "$PM" in
|
||||
apt)
|
||||
! which pip3 && $ROOT/python/install.sh
|
||||
! command -v pip3 && "$ROOT/python/install.sh"
|
||||
sudo add-apt-repository ppa:fish-shell/release-3 -y
|
||||
sudo apt update
|
||||
sudo apt install fish libnotify-bin xdotool silversearcher-ag dash -y
|
||||
if apt show fzf &>/dev/null; then
|
||||
sudo apt install fzf
|
||||
elif ! which fzf &>/dev/null; then
|
||||
if apt show fzf 2>/dev/null; then
|
||||
sudo apt install -y fzf
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
~/.fzf/install
|
||||
fi
|
||||
;;
|
||||
pacman)
|
||||
! which pip && $ROOT/python/install.sh
|
||||
sudo pacman -S --needed --needed fish xdotool fzf the_silver_searcher dash
|
||||
# prevent bash upgradation relink /bin/sh
|
||||
sudo mkdir -p /etc/pacman.d/hooks
|
||||
|
@ -40,18 +38,18 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# use dash as default shell because it much faster and will be used vim-fugitive,
|
||||
# which leads to a much faster responsive speed
|
||||
# leads to a much faster responsive speed
|
||||
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
||||
chsh -s /bin/sh
|
||||
|
||||
|
||||
# symlink config
|
||||
[ -L $XDG_CONFIG_HOME/fish ] && rm -rf $XDG_CONFIG_HOME/fish
|
||||
[ -L "$XDG_CONFIG_HOME/fish" ] && rm -rf "$XDG_CONFIG_HOME/fish"
|
||||
|
||||
lnsf $DIR/config/config.fish $XDG_CONFIG_HOME/fish/config.fish
|
||||
lnsf $DIR/config/functions/fish_prompt.fish $XDG_CONFIG_HOME/fish/functions/fish_prompt.fish
|
||||
lnsf $DIR/config/functions/fish_right_prompt.fish $XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish
|
||||
lnsf $DIR/config/functions/fisher.fish $XDG_CONFIG_HOME/fish/functions/fisher.fish
|
||||
lnsf "$DIR/config/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
|
||||
lnsf "$DIR/config/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_prompt.fish"
|
||||
lnsf "$DIR/config/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
|
||||
lnsf "$DIR/config/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
|
||||
# install plugins
|
||||
fish -c "fisher add jethrokuan/fzf"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install basic gui stuff, including fonts/system utilties/keyring etc
|
||||
case "$PM" in
|
||||
|
@ -18,7 +18,7 @@ case "$PM" in
|
|||
sudo apt install \
|
||||
network-manager network-manager-gnome
|
||||
# bluetooth
|
||||
if has-bluetooth; then
|
||||
if has_bluetooth; then
|
||||
sudo apt install \
|
||||
bluez bluez-tools blueman pulseaudio-module-bluetooth
|
||||
sudo systemctl enable bluetooth
|
||||
|
@ -41,10 +41,9 @@ case "$PM" in
|
|||
# https://code.google.com/p/chromium/issues/detail?id=233851
|
||||
# use debian package instead
|
||||
DEB_PKG_NAME=fonts-wqy-microhei_0.2.0-beta-3_all.deb
|
||||
PAC_PKG_NAME=fonts-wqy-microhei_0.2.0-beta-3_all.pkg
|
||||
[[ ! -f /tmp/$DEB_PKG_NAME ]] && \
|
||||
[ ! -f "/tmp/$DEB_PKG_NAME" ] && \
|
||||
wget http://mirrors.163.com/debian/pool/main/f/fonts-wqy-microhei/$DEB_PKG_NAME -O /tmp/$DEB_PKG_NAME
|
||||
ar p /tmp/$DEB_PKG_NAME data.tar.xz | sudo tar Jxv -C /
|
||||
ar p "/tmp/$DEB_PKG_NAME" data.tar.xz | sudo tar Jxv -C /
|
||||
# install symbola for plain emojis(no-color) for st
|
||||
! fc-list | grep -qi symbola && yay -S --needed ttf-symbola-free
|
||||
# clipboard
|
||||
|
@ -57,7 +56,7 @@ case "$PM" in
|
|||
sudo pacman -S --needed \
|
||||
networkmanager network-manager-applet
|
||||
# bluetooth
|
||||
if has-bluetooth; then
|
||||
if has_bluetooth; then
|
||||
sudo pacman -S --needed \
|
||||
bluez bluez-utils blueman pulseaudio-bluetooth xorg-xbacklight
|
||||
sudo systemctl enable bluetooth
|
||||
|
@ -73,7 +72,7 @@ esac
|
|||
|
||||
|
||||
# install hermit nerd font
|
||||
install-nerdfont () {
|
||||
install_nerdfont () {
|
||||
grep -F "$*" /usr/local/share/fonts/nerdfont && return
|
||||
ORIGIN_NAME=$1
|
||||
PATCHED_PAT=$2
|
||||
|
@ -81,22 +80,21 @@ install-nerdfont () {
|
|||
NAME=$ORIGIN_NAME-$VERSION.zip
|
||||
LOCAL_REPO_PATH=/tmp/nerd-font/$ORIGIN_NAME
|
||||
# shortcircuit if font already in system
|
||||
fc-list | grep -F $0 | grep -i nerd && return
|
||||
fc-list | grep -F "$PATCHED_PAT" | grep -i nerd && return
|
||||
# clone single branch from gitee
|
||||
git clone --single-branch --branch $ORIGIN_NAME --depth 1 \
|
||||
git clone --single-branch --branch "$ORIGIN_NAME" --depth 1 \
|
||||
https://gitee.com/klesh/nerd-fonts.git \
|
||||
$LOCAL_REPO_PATH
|
||||
sudo 7z x -x!'*Windows*' -aoa $LOCAL_REPO_PATH/$NAME -o/usr/local/share/fonts
|
||||
"$LOCAL_REPO_PATH"
|
||||
sudo 7z x -x!'*Windows*' -aoa "$LOCAL_REPO_PATH/$NAME" -o/usr/local/share/fonts
|
||||
sudo chmod +rx /usr/local/share/fonts
|
||||
echo "$*" | sudo tee -a /usr/local/share/fonts/nerdfont
|
||||
echo $LOCAL_REPO_PATH
|
||||
rm -rf $LOCAL_REPO_PATH
|
||||
rm -rf "$LOCAL_REPO_PATH"
|
||||
}
|
||||
|
||||
#install-nerdfont Hermit Hurmit v2.1.0
|
||||
install-nerdfont Agave agave v2.1.0
|
||||
#install-nerdfont CascadiaCode Caskaydia v2.1.0
|
||||
#install-nerdfont DaddyTimeMono DaddyTimeMono v2.1.0
|
||||
#install_nerdfont Hermit Hurmit v2.1.0
|
||||
install_nerdfont Agave agave v2.1.0
|
||||
#install_nerdfont CascadiaCode Caskaydia v2.1.0
|
||||
#install_nerdfont DaddyTimeMono DaddyTimeMono v2.1.0
|
||||
|
||||
# start network
|
||||
sudo systemctl enable NetworkManager
|
||||
|
@ -106,5 +104,5 @@ sudo systemctl start NetworkManager
|
|||
sudo ln -sf /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d
|
||||
sudo ln -sf /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d
|
||||
sudo ln -sf /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d
|
||||
sudo cp $DIR/freetype2.sh /etc/profile.d/freetype2.sh
|
||||
sudo cp $DIR/local.conf /etc/fonts/local.conf
|
||||
sudo cp "$DIR/freetype2.sh" "/etc/profile.d/freetype2.sh"
|
||||
sudo cp "$DIR/local.conf" "/etc/fonts/local.conf"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install sshd
|
||||
case "$PM" in
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
set -e
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# for better looking
|
||||
case "$PM" in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# tips
|
||||
# 1. to relocate default pool
|
||||
|
@ -26,4 +26,4 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# configuration
|
||||
sudo usermod -aG libvirt $USER
|
||||
sudo usermod -aG libvirt "$USER"
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install specific version
|
||||
if [[ -n $1 ]]; then
|
||||
if which node &>/dev/null && [[ "$1" != "$(node -v)" ]]; then
|
||||
if [ -n "$1" ]; then
|
||||
if command -v node 1>/dev/null 2>&1 && [ "$1" != "$(node -v)" ]; then
|
||||
NODE_URL=https://nodejs.org/dist
|
||||
in-china && NODE_URL=https://npm.taobao.org/mirrors/node
|
||||
if [[ $1 == 'ls' ]]; then
|
||||
in_china && NODE_URL=https://npm.taobao.org/mirrors/node
|
||||
if [ "$1" = 'ls' ]; then
|
||||
curl -s $NODE_URL/index.json | jq '.[] | "\(.version) \(if .lts then "(lts)" else "" end)"' -r | less
|
||||
exit
|
||||
else
|
||||
FN=node-$1-linux-x64.tar.gz
|
||||
wget -O /tmp/$FN $NODE_URL/$1/$FN
|
||||
sudo tar zxvf /tmp/$FN --strip 1 -C /usr/local/
|
||||
rm /tmp/$FN
|
||||
wget -O "/tmp/$FN" "$NODE_URL/$1/$FN"
|
||||
sudo tar zxvf "/tmp/$FN" --strip 1 -C /usr/local/
|
||||
rm "/tmp/$FN"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ fi
|
|||
|
||||
|
||||
# install nvm
|
||||
if which fish 2>/dev/null; then
|
||||
if command -v fish 2>/dev/null; then
|
||||
fish -c "fisher add jorgebucaran/nvm.fish"
|
||||
else
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
|
@ -40,7 +40,7 @@ fi
|
|||
|
||||
|
||||
# config mirrors for CHINA
|
||||
if in-china; then
|
||||
if in_china; then
|
||||
sudo npm install cnpm -g --registry=https://r.npm.taobao.org
|
||||
yarnpkg config set registry https://registry.npm.taobao.org --global && \
|
||||
yarnpkg config set disturl https://npm.taobao.org/dist --global && \
|
||||
|
|
|
@ -2,5 +2,8 @@
|
|||
"npm.binPath": "yarnpkg",
|
||||
"python.linting.enable": true,
|
||||
"python.linting.flake8Enabled": true,
|
||||
"python.linting.pylintEnabled": false
|
||||
"python.linting.pylintEnabled": false,
|
||||
"diagnostic-languageserver.filetypes": {
|
||||
"sh": ["shellcheck", "-e", "SC1090"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# check dependencies
|
||||
! which yarnpkg && $ROOT/nodejs/install.sh
|
||||
! command -v yarnpkg && "$ROOT/nodejs/install.sh"
|
||||
|
||||
# install nvim
|
||||
case "$PM" in
|
||||
|
@ -19,6 +19,6 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/init.vim $XDG_CONFIG_HOME/nvim/init.vim
|
||||
lnsf $DIR/config/coc-settings.json $XDG_CONFIG_HOME/nvim/coc-settings.json
|
||||
lnsf $DIR/config/init.vim ~/.vimrc
|
||||
lnsf "$DIR/config/init.vim" "$XDG_CONFIG_HOME/nvim/init.vim"
|
||||
lnsf "$DIR/config/coc-settings.json" "$XDG_CONFIG_HOME/nvim/coc-settings.json"
|
||||
lnsf "$DIR/config/init.vim" ~/.vimrc
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
! in-china && echo 'Skip mirrors configuration' && exit
|
||||
! in_china && echo 'Skip mirrors configuration' && exit
|
||||
|
||||
# setup package mirror for CHINA
|
||||
case "$PM" in
|
||||
|
@ -18,7 +18,7 @@ case "$PM" in
|
|||
;;
|
||||
pacman)
|
||||
echo TODO
|
||||
exit -1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
sudo systemctl disable systemd-networkd-wait-online
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
|
||||
PICOM_VER=v8.1
|
||||
set -e
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install ranger
|
||||
case "$PM" in
|
||||
apt)
|
||||
# install build tools
|
||||
! which pip3 && $ROOT/python/install.sh
|
||||
! command -v pip3 && "$ROOT/python/install.sh"
|
||||
sudo pip3 install meson
|
||||
# install dependencies
|
||||
sudo apt install -y ninja-build libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-xinerama0-dev libxcb-glx0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl1-mesa-dev libpcre3-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev
|
||||
|
@ -29,16 +28,16 @@ if [ "$VERSION" = "next" ] || ! eqv "$VERSION_PATH" "$VERSION"; then
|
|||
curl "https://github.com/yshui/picom/archive/$VERSION.zip" -Lo /tmp/picom-$VERSION.zip
|
||||
unzip /tmp/picom-$VERSION.zip -d /tmp
|
||||
FD=$(unzip -l /tmp/picom-$VERSION.zip | awk 'NR==5{print $4}')
|
||||
pushd /tmp/$FD
|
||||
cd "/tmp/$FD"
|
||||
meson --buildtype=release . build
|
||||
sudo ninja -C build install
|
||||
popd
|
||||
mkdir -p $(dirname $VERSION_PATH)
|
||||
cd -
|
||||
mkdir -p "$(dirname "$VERSION_PATH")"
|
||||
echo "$VERSION" > "$VERSION_PATH"
|
||||
sudo rm -rf /tmp/picom-$VERSION*
|
||||
fi
|
||||
|
||||
# configuration
|
||||
lnsf $DIR/config/launch.sh $XDG_CONFIG_HOME/picom/launch.sh
|
||||
lnsf $DIR/config/toggle.sh $XDG_CONFIG_HOME/picom/toggle.sh
|
||||
lnsf $DIR/config/picom.conf $XDG_CONFIG_HOME/picom/picom.conf
|
||||
lnsf "$DIR/config/launch.sh" "$XDG_CONFIG_HOME/picom/launch.sh"
|
||||
lnsf "$DIR/config/toggle.sh" "$XDG_CONFIG_HOME/picom/toggle.sh"
|
||||
lnsf "$DIR/config/picom.conf" "$XDG_CONFIG_HOME/picom/picom.conf"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
|
||||
# install music and video player
|
||||
|
@ -15,16 +15,16 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/mpd/mpd.conf $XDG_CONFIG_HOME/mpd/mpd.conf
|
||||
lnsf $DIR/config/mpv/mpv.conf $XDG_CONFIG_HOME/mpv/mpv.conf
|
||||
lnsf $DIR/config/mpv/scripts/organize.lua $XDG_CONFIG_HOME/mpv/scripts/organize.lua
|
||||
lnsf $DIR/config/ncmpcpp/bindings $XDG_CONFIG_HOME/ncmpcpp/bindings
|
||||
lnsf $DIR/config/ncmpcpp/config $XDG_CONFIG_HOME/ncmpcpp/config
|
||||
lnsf "$DIR/config/mpd/mpd.conf" "$XDG_CONFIG_HOME/mpd/mpd.conf"
|
||||
lnsf "$DIR/config/mpv/mpv.conf" "$XDG_CONFIG_HOME/mpv/mpv.conf"
|
||||
lnsf "$DIR/config/mpv/scripts/organize.lua" "$XDG_CONFIG_HOME/mpv/scripts/organize.lua"
|
||||
lnsf "$DIR/config/ncmpcpp/bindings" "$XDG_CONFIG_HOME/ncmpcpp/bindings"
|
||||
lnsf "$DIR/config/ncmpcpp/config" "$XDG_CONFIG_HOME/ncmpcpp/config"
|
||||
|
||||
# prevent system-wide mpd
|
||||
sudo systemctl disable mpd
|
||||
sudo systemctl stop mpd
|
||||
mkdir -p $HOME/.mpd/playlists
|
||||
mkdir -p "$HOME/.mpd/playlists"
|
||||
|
||||
# enable for current user
|
||||
systemctl --user enable mpd
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# config pip mirror for CHINA
|
||||
if in-china; then
|
||||
lnsf $DIR/pip.conf ~/.pip/pip.conf
|
||||
if in_china; then
|
||||
lnsf "$DIR/pip.conf" ~/.pip/pip.conf
|
||||
if sudo [ ! -f /root/.pip/pip.conf ]; then
|
||||
sudo mkdir -p /root/.pip
|
||||
sudo cp $DIR/pip.conf /root/.pip/pip.conf
|
||||
sudo cp "$DIR/pip.conf" /root/.pip/pip.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -16,15 +16,15 @@ fi
|
|||
case "$PM" in
|
||||
apt)
|
||||
sudo apt install python3 python3-pip python-is-python3
|
||||
which fish 2>/dev/null && sudo pip3 install virtualfish
|
||||
command -v fish 2>/dev/null && sudo pip3 install virtualfish
|
||||
;;
|
||||
pacman)
|
||||
sudo pacman -S --needed python python-pip
|
||||
which fish 2>/dev/null && sudo pip install virtualfish
|
||||
command -v fish 2>/dev/null && sudo pip install virtualfish
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable auto_activation plugin for virtualfish
|
||||
which fish 2>/dev/null && fish -c "yes | vf install && vf addplugins auto_activation"
|
||||
command -v fish 2>/dev/null && fish -c "yes | vf install && vf addplugins auto_activation"
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install ranger
|
||||
case "$PM" in
|
||||
apt)
|
||||
# atool/p7zip-full for archive previewing/extracting etc
|
||||
sudo apt install -y atool p7zip-full unrar highlight
|
||||
! which pip3 && $ROOT/python/install.sh
|
||||
! command -v pip3 && "$ROOT/python/install.sh"
|
||||
sudo pip3 install ranger-fm ueberzug
|
||||
;;
|
||||
pacman)
|
||||
|
@ -18,9 +18,9 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# linking configuration files
|
||||
lnsf $DIR/config/commands.py $XDG_CONFIG_HOME/ranger/commands.py
|
||||
lnsf $DIR/config/rc.conf $XDG_CONFIG_HOME/ranger/rc.conf
|
||||
lnsf $DIR/config/scope.sh $XDG_CONFIG_HOME/ranger/scope.sh
|
||||
lnsf "$DIR/config/commands.py" "$XDG_CONFIG_HOME/ranger/commands.py"
|
||||
lnsf "$DIR/config/rc.conf" "$XDG_CONFIG_HOME/ranger/rc.conf"
|
||||
lnsf "$DIR/config/scope.sh" "$XDG_CONFIG_HOME/ranger/scope.sh"
|
||||
|
||||
# install devicons
|
||||
git clone --depth 1 https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
$ROOT/fish/install.sh
|
||||
$ROOT/gui/install.sh
|
||||
$ROOT/picom/install.sh
|
||||
$ROOT/dunst/install.sh
|
||||
"$ROOT/fish/install.sh"
|
||||
"$ROOT/gui/install.sh"
|
||||
"$ROOT/picom/install.sh"
|
||||
"$ROOT/dunst/install.sh"
|
||||
|
||||
# install dependencies
|
||||
case "$PM" in
|
||||
|
@ -86,8 +86,8 @@ EOT
|
|||
|
||||
|
||||
# config dwm
|
||||
[[ -L $XDG_CONFIG_HOME/dwm/autostart ]] && rm $XDG_CONFIG_HOME/dwm/autostart
|
||||
mkdir -p $XDG_CONFIG_HOME/dwm
|
||||
cp $DIR/config/dwm/autostart $XDG_CONFIG_HOME/dwm/autostart
|
||||
lnsf $DIR/config/dwm/statusbar $XDG_CONFIG_HOME/dwm/statusbar
|
||||
lnsf $DIR/config/autorandr/postswitch $XDG_CONFIG_HOME/autorandr/postswitch
|
||||
[ -L "$XDG_CONFIG_HOME/dwm/autostart" ] && rm "$XDG_CONFIG_HOME/dwm/autostart"
|
||||
mkdir -p "$XDG_CONFIG_HOME/dwm"
|
||||
cp "$DIR/config/dwm/autostart" "$XDG_CONFIG_HOME/dwm/autostart"
|
||||
lnsf "$DIR/config/dwm/statusbar" "$XDG_CONFIG_HOME/dwm/statusbar"
|
||||
lnsf "$DIR/config/autorandr/postswitch" "$XDG_CONFIG_HOME/autorandr/postswitch"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
# install ranger
|
||||
case "$PM" in
|
||||
|
@ -16,4 +16,4 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/Thunar/uca.xml $XDG_CONFIG_HOME/Thunar/uca.xml
|
||||
lnsf "$DIR/Thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DIR=$(readlink -f $(dirname $0))
|
||||
. $DIR/../env.sh
|
||||
set -e
|
||||
DIR=$(readlink -f "$(dirname "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
TMUX_VER=3.1b
|
||||
|
||||
# install ranger
|
||||
case "$PM" in
|
||||
apt)
|
||||
if which tmux &>/dev/null && [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
|
||||
if command -v tmux &>/dev/null && [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
|
||||
sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y
|
||||
TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz
|
||||
if in-china; then
|
||||
TMUX_SRC_URL=https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz
|
||||
if in_china; then
|
||||
TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz"
|
||||
fi
|
||||
[ ! -f /tmp/tmux.tar.gz ] && curl -L $TMUX_SRC_URL -o /tmp/tmux.tar.gz
|
||||
[ ! -f /tmp/tmux.tar.gz ] && curl -L "$TMUX_SRC_URL" -o /tmp/tmux.tar.gz
|
||||
rm -rf /tmp/tmux
|
||||
mkdir -p /tmp/tmux
|
||||
tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1
|
||||
pushd /tmp/tmux
|
||||
cd /tmp/tmux
|
||||
[ -f autogen.sh ] && sh autogen.sh
|
||||
./configure && make
|
||||
sudo make install
|
||||
popd
|
||||
cd -
|
||||
rm -rf /tmp/tmux*
|
||||
fi
|
||||
;;
|
||||
|
@ -32,6 +33,6 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/tmux.conf ~/.tmux.conf
|
||||
lnsf $DIR/config/tmux2.8.conf $XDG_CONFIG_HOME/tmux/tmux2.8.conf
|
||||
lnsf $DIR/config/tmux2.9.conf $XDG_CONFIG_HOME/tmux/tmux2.9.conf
|
||||
lnsf "$DIR/tmux.conf" ~/.tmux.conf
|
||||
lnsf "$DIR/config/tmux2.8.conf" "$XDG_CONFIG_HOME/tmux/tmux2.8.conf"
|
||||
lnsf "$DIR/config/tmux2.9.conf" "$XDG_CONFIG_HOME/tmux/tmux2.9.conf"
|
||||
|
|
Loading…
Reference in New Issue
Block a user