refactory
This commit is contained in:
parent
17c51fb00e
commit
71dac50e70
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -1,15 +1 @@
|
||||||
config/mpv/watch_later/
|
|
||||||
fish/config/fishd.*
|
|
||||||
fish/config/conf.d/
|
|
||||||
fish/config/fish_variables
|
|
||||||
fish/config/conf.d/virtualfish-loader.fish
|
|
||||||
ranger/config/bookmarks
|
|
||||||
ranger/config/history
|
|
||||||
ranger/config/tagged
|
|
||||||
ranger/config/plugins
|
|
||||||
Thunar/config/accels.scm
|
|
||||||
nvim/config/autoload
|
|
||||||
nvim/config/plugged
|
|
||||||
nvim/config/.*
|
|
||||||
repos/
|
repos/
|
||||||
repo/
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
|
|
||||||
# install office utilities
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo apt install -y \
|
|
||||||
google-chrome-stable \
|
|
||||||
zathura zathura-pdf-poppler sxiv \
|
|
||||||
flameshot \
|
|
||||||
gimp
|
|
||||||
# libreoffice
|
|
||||||
sudo add-apt-repository -y ppa:libreoffice/libreoffice-7-0
|
|
||||||
sudo apt-get update
|
|
||||||
libreoffice \
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
chromium \
|
|
||||||
zathura zathura-pdf-mupdf sxiv\
|
|
||||||
flameshot \
|
|
||||||
libreoffice-fresh \
|
|
||||||
gimp
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# symlink configuration
|
|
||||||
lnsf "$DIR/config/zathura/zathurarc" "$XDG_CONFIG_HOME/zathura/zathurarc"
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
|
|
||||||
# install nextcloud
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo add-apt-repository -y ppa:phoerious/keepassxc
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt install -y keepassxc
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed keepassxc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
|
|
||||||
# install nextcloud
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo add-apt-repository -y ppa:nextcloud-devs/client
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt install -y nextcloud-client
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed nextcloud-client
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
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" | \
|
|
||||||
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
||||||
fi
|
|
|
@ -1,4 +0,0 @@
|
||||||
[Service]
|
|
||||||
ExecStart=
|
|
||||||
#ExecStart=-/usr/bin/agetty --autologin USERNAME --noclear %I $TERM
|
|
||||||
ExecStart=-/sbin/agetty --autologin USERNAME --noclear %I $TERM
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Lock on suspend
|
|
||||||
Before=sleep.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/loginctl lock-sessions
|
|
||||||
ExecStartPost=/usr/bin/sleep 2
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sleep.target
|
|
|
@ -1,25 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
# install fish shell
|
log 'Setting up shell'
|
||||||
echo Installing fish shell
|
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
! command -v pip3 && "$PDIR/python/install.sh"
|
! command -v pip3 && "$PDIR/python/install.sh"
|
||||||
sudo add-apt-repository ppa:fish-shell/release-3 -y
|
sudo add-apt-repository ppa:fish-shell/release-3 -y
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install fish libnotify-bin xdotool silversearcher-ag dash bat -y
|
sudo apt install fish silversearcher-ag dash bat -y
|
||||||
[ ! -d "$HOME/.fzf" ] && git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME/.fzf"
|
|
||||||
~/.fzf/install --all
|
|
||||||
lnsf /usr/bin/batcat "$HOME/.local/bin/bat"
|
lnsf /usr/bin/batcat "$HOME/.local/bin/bat"
|
||||||
|
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
|
||||||
|
./install --all
|
||||||
|
exitrepo
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed --needed fish xdotool fzf the_silver_searcher dash bat
|
sudo pacman -S --noconfirm --needed fish the_silver_searcher dash bat fzf
|
||||||
# prevent bash upgradation relink /bin/sh
|
# prevent bash upgradation relink /bin/sh
|
||||||
sudo mkdir -p /etc/pacman.d/hooks
|
sudo mkdir -p /etc/pacman.d/hooks
|
||||||
cat <<' EOT' | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook
|
echo "
|
||||||
[Trigger]
|
[Trigger]
|
||||||
Type = Package
|
Type = Package
|
||||||
Operation = Install
|
Operation = Install
|
||||||
|
@ -31,34 +33,31 @@ case "$PM" in
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
|
Exec = /usr/bin/ln -sfT dash /usr/bin/sh
|
||||||
Depends = dash
|
Depends = dash
|
||||||
EOT
|
" | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook >/dev/null
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# install bat theme
|
log 'Setting up bat'
|
||||||
BAT_THEMES="$(bat --config-dir)/themes"
|
BAT_THEMES="$(bat --config-dir)/themes"
|
||||||
BAT_GRUVBOX="$BAT_THEMES/gruvbox"
|
BAT_GRUVBOX="$BAT_THEMES/gruvbox"
|
||||||
if [ ! -d "$BAT_GRUVBOX" ]; then
|
if [ ! -d "$BAT_GRUVBOX" ]; then
|
||||||
mkdir -p "$BAT_THEMES"
|
mkdir -p "$BAT_THEMES"
|
||||||
git clone --depth 1 https://github.com/peaceant/gruvbox.git "$BAT_GRUVBOX"
|
git_clone https://github.com/peaceant/gruvbox.git "$BAT_GRUVBOX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use dash as default shell because it much faster and will be used vim-fugitive,
|
log 'Setting up dash as default shell'
|
||||||
# leads to a much faster responsive speed
|
|
||||||
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
||||||
[ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ] && chsh -s /bin/sh
|
[ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ] && chsh -s /bin/sh
|
||||||
|
|
||||||
|
|
||||||
# symlink config
|
log 'Setting up fish'
|
||||||
[ -L "$XDG_CONFIG_HOME/fish" ] && rm -rf "$XDG_CONFIG_HOME/fish"
|
lnsf "$DIR/fish/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
|
||||||
|
lnsf "$DIR/fish/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_prompt.fish"
|
||||||
lnsf "$DIR/config/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
|
lnsf "$DIR/fish/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
|
||||||
lnsf "$DIR/config/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_prompt.fish"
|
lnsf "$DIR/fish/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||||
lnsf "$DIR/config/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
|
lnsf "$DIR/fish/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish"
|
||||||
lnsf "$DIR/config/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
lnsf "$DIR/fish/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish"
|
||||||
lnsf "$DIR/config/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish"
|
lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"
|
||||||
lnsf "$DIR/config/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish"
|
|
||||||
lnsf "$DIR/config/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"
|
|
||||||
|
|
||||||
# install plugins
|
# install plugins
|
||||||
# for better keybinding: C-o open file with $EDITOR / C-r search history / C-g open with xdg-open
|
# for better keybinding: C-o open file with $EDITOR / C-r search history / C-g open with xdg-open
|
||||||
|
@ -92,4 +91,4 @@ set -U fish_pager_color_completion normal
|
||||||
set -U fish_pager_color_description B3A06D yellow
|
set -U fish_pager_color_description B3A06D yellow
|
||||||
set -U fish_pager_color_prefix white --bold --underline
|
set -U fish_pager_color_prefix white --bold --underline
|
||||||
set -U fish_pager_color_progress brwhite --background=cyan
|
set -U fish_pager_color_progress brwhite --background=cyan
|
||||||
'
|
' > /dev/null
|
11
cli/install.sh
Executable file
11
cli/install.sh
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
. "$DIR/mirrors.sh"
|
||||||
|
. "$DIR/fish.sh"
|
||||||
|
. "$DIR/vim.sh"
|
||||||
|
. "$DIR/ranger.sh"
|
||||||
|
. "$DIR/tmux.sh"
|
44
cli/mirrors.sh
Executable file
44
cli/mirrors.sh
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up mirror list'
|
||||||
|
|
||||||
|
! in_china && echo 'Skip mirrors configuration' && return
|
||||||
|
|
||||||
|
# setup package mirror for CHINA
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
# backup original sources.list
|
||||||
|
[ ! -f /etc/apt/sources.list.bak ] && \
|
||||||
|
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||||
|
# replace with aliyun mirror
|
||||||
|
awk '$0 ~ /^deb/ {$2="https://mirrors.aliyun.com/ubuntu/"; print}' /etc/apt/sources.list.bak \
|
||||||
|
| sudo tee /etc/apt/sources.list
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
COUNTRY=China
|
||||||
|
[ ! -f /etc/pacman.d/mirrorlist.bak ] && \
|
||||||
|
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
||||||
|
awk '
|
||||||
|
{
|
||||||
|
if (NR < 7) {
|
||||||
|
print
|
||||||
|
} else if ($0 == "## '$COUNTRY'") {
|
||||||
|
print
|
||||||
|
matched = 1
|
||||||
|
} else if (matched == 1) {
|
||||||
|
print
|
||||||
|
matched = 0
|
||||||
|
} else {
|
||||||
|
buffer = buffer "\n" $0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END { print buffer }
|
||||||
|
' /etc/pacman.d/mirrorlist.bak | sudo tee /etc/pacman.d/mirrorlist >/dev/null
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
33
cli/ranger.sh
Executable file
33
cli/ranger.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up ranger'
|
||||||
|
|
||||||
|
# install ranger
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
# atool/p7zip-full for archive previewing/extracting etc
|
||||||
|
sudo apt install -y atool p7zip-full unrar
|
||||||
|
! has_cmd pip3 && "$PDIR/devel/python.sh"
|
||||||
|
sudo pip3 install ranger-fm ueberzug
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -S --noconfirm --needed atool p7zip unrar
|
||||||
|
! has_cmd pip && "$PDIR/devel/python.sh"
|
||||||
|
sudo pip install ranger-fm ueberzug
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# linking configuration files
|
||||||
|
lnsf "$DIR/ranger/commands.py" "$XDG_CONFIG_HOME/ranger/commands.py"
|
||||||
|
lnsf "$DIR/ranger/rc.conf" "$XDG_CONFIG_HOME/ranger/rc.conf"
|
||||||
|
lnsf "$DIR/ranger/scope.sh" "$XDG_CONFIG_HOME/ranger/scope.sh"
|
||||||
|
lnsf "$DIR/ranger/colorschemes/solarizedmod.py" "$XDG_CONFIG_HOME/ranger/colorschemes/solarizedmod.py"
|
||||||
|
|
||||||
|
# install devicons
|
||||||
|
DEVICONS_DIR=$HOME/.config/ranger/plugins/ranger_devicons
|
||||||
|
[ ! -d "$DEVICONS_DIR" ] && \
|
||||||
|
git clone https://gitee.com/klesh/ranger_devicons.git "$DEVICONS_DIR"
|
|
@ -1,8 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up ssh server'
|
||||||
|
|
||||||
# install sshd
|
# install sshd
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
|
@ -10,7 +13,7 @@ case "$PM" in
|
||||||
openssh-server
|
openssh-server
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
openssh
|
openssh
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
|
@ -4,12 +4,12 @@ set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
TMUX_VER=3.1b
|
log 'Setting up tmux'
|
||||||
|
|
||||||
# install ranger
|
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
if command -v tmux 2>/dev/null && [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
|
TMUX_VER=3.1b
|
||||||
|
if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
|
||||||
sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y
|
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
|
TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz
|
||||||
if in_china; then
|
if in_china; then
|
||||||
|
@ -28,11 +28,11 @@ case "$PM" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed tmux bc
|
sudo pacman -S --noconfirm --needed tmux bc
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# symlink configuration
|
# symlink configuration
|
||||||
lnsf "$DIR/tmux.conf" ~/.tmux.conf
|
lnsf "$DIR/tmux/tmux.conf" "$HOME/.tmux.conf"
|
||||||
lnsf "$DIR/config/tmux2.8.conf" "$XDG_CONFIG_HOME/tmux/tmux2.8.conf"
|
lnsf "$DIR/tmux/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/tmux2.9.conf" "$XDG_CONFIG_HOME/tmux/tmux2.9.conf"
|
|
@ -64,9 +64,6 @@ bind M \
|
||||||
|
|
||||||
set -g @yank_action 'copy-pipe'
|
set -g @yank_action 'copy-pipe'
|
||||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||||
#set -g @plugin 'kristijanhusak/tmux-simple-git-status'
|
|
||||||
set -g @plugin 'klesh/tmux-open'
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-copycat'
|
|
||||||
if "test ! -d ~/.tmux/plugins/tpm" \
|
if "test ! -d ~/.tmux/plugins/tpm" \
|
||||||
"run 'git clone --depth 1 https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
"run 'git clone --depth 1 https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
||||||
# prefix + I
|
# prefix + I
|
33
cli/vim.sh
Executable file
33
cli/vim.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up vim'
|
||||||
|
|
||||||
|
# check dependencies
|
||||||
|
if [ "$VIM_MODE" = "enhanced" ]; then
|
||||||
|
! has_cmd npm && "$PDIR/devel/nodejs.sh"
|
||||||
|
! has_cmd pip && "$PDIR/devel/python.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install nvim
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/stable -y
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y neovim
|
||||||
|
[ "$VIM_MODE" = "enhanced" ] && sudo pip3 install pyvim neovim
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -S --noconfirm --needed neovim
|
||||||
|
[ "$VIM_MODE" = "enhanced" ] && sudo pip install pyvim neovim
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# symlink configuration
|
||||||
|
lnsf "$DIR/vim/init.vim" "$XDG_CONFIG_HOME/nvim/init.vim"
|
||||||
|
lnsf "$DIR/vim/coc-settings.json" "$XDG_CONFIG_HOME/nvim/coc-settings.json"
|
||||||
|
lnsf "$DIR/vim/coc-settings.json" "$HOME/.vim/coc-settings.json"
|
||||||
|
lnsf "$DIR/vim/init.vim" "$HOME/.vimrc"
|
|
@ -9,12 +9,12 @@ case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
# snap docker will intefere native docker.io, must be dealt with
|
# snap docker will intefere native docker.io, must be dealt with
|
||||||
sudo snap remove --purge docker
|
sudo snap remove --purge docker
|
||||||
sudo apt install -y docker.io docker-compose
|
sudo apt install -y docker.io
|
||||||
! command -v pip3 && "$PDIR/python/install.sh"
|
! has_cmd pip && . "$PDIR/python/install.sh"
|
||||||
sudo pip3 install docker-compose
|
sudo pip3 install docker-compose
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed docker docker-compose
|
sudo pacman -S --noconfirm --needed docker docker-compose
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
22
devel/ftgfw.sh
Executable file
22
devel/ftgfw.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f /tmp/docker.zip ]; then
|
||||||
|
echo "Please enter nextcloud hostname:"
|
||||||
|
read -r HOSTNAME
|
||||||
|
|
||||||
|
echo "Please enter nextcloud account:"
|
||||||
|
read -r ACCOUNT
|
||||||
|
|
||||||
|
echo "Please enter nextcloud password:"
|
||||||
|
stty -echo
|
||||||
|
read -r PASSWORD
|
||||||
|
stty echo
|
||||||
|
|
||||||
|
curl -u "$ACCOUNT:$PASSWORD" -Lo /tmp/docker.zip "https://$HOSTNAME:8443/index.php/apps/files/ajax/download.php?dir=%2F&files=docker"
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEST_DIR=$HOME/Nextcloud
|
||||||
|
mkdir -p "$DEST_DIR"
|
||||||
|
7z x -o"$DEST_DIR" /tmp/docker.zip
|
||||||
|
|
88
devel/nodejs.sh
Executable file
88
devel/nodejs.sh
Executable file
|
@ -0,0 +1,88 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
|
||||||
|
FILES_PATH=$PREFIX/nodejs
|
||||||
|
NODE_BIN=$PREFIX/bin/node
|
||||||
|
NODE_URL=https://nodejs.org/dist
|
||||||
|
NODE_VERSION=v14.15.1
|
||||||
|
in_china && NODE_URL=https://npm.taobao.org/mirrors/node
|
||||||
|
|
||||||
|
log "Setting up nodejs"
|
||||||
|
|
||||||
|
lspkgs() {
|
||||||
|
curl -s $NODE_URL/index.json \
|
||||||
|
| jq '.[] | "\(.version) \(if .lts then "(lts)" else "" end)"' -r
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall() {
|
||||||
|
[ -f "$FILES_PATH" ] \
|
||||||
|
&& tac "$FILES_PATH" | grep -v '/$' | xargs sudo rm -f
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
VERSION=$1
|
||||||
|
ARCH=x86
|
||||||
|
[ -x "$NODE_BIN" ] && [ "$("$NODE_BIN" --version)" = "$VERSION" ] && exit 0
|
||||||
|
case "$(uname -m)" in
|
||||||
|
x86_64)
|
||||||
|
ARCH=x64
|
||||||
|
;;
|
||||||
|
armv6|armv6l)
|
||||||
|
ARCH=armv6l
|
||||||
|
;;
|
||||||
|
armv7|armv7l)
|
||||||
|
ARCH=armv7l
|
||||||
|
;;
|
||||||
|
armv8|armv8l|aarch64)
|
||||||
|
ARCH=arm64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
NAME=node-$VERSION-linux-$ARCH.tar.gz
|
||||||
|
# download package
|
||||||
|
echo wget -O "/tmp/$NAME" "$NODE_URL/$VERSION/$NAME"
|
||||||
|
wget -O "/tmp/$NAME" "$NODE_URL/$VERSION/$NAME"
|
||||||
|
# remove previous installed
|
||||||
|
uninstall
|
||||||
|
# install and save extracted paths
|
||||||
|
sudo tar zxvf "/tmp/$NAME" --strip 1 -C "$PREFIX" \
|
||||||
|
| sed -r "s|^[^/]+/|$PREFIX/|" \
|
||||||
|
| sudo tee "$FILES_PATH" >/dev/null
|
||||||
|
# remove download path
|
||||||
|
rm "/tmp/$NAME"
|
||||||
|
in_china && sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
ls|list)
|
||||||
|
lspkgs | less
|
||||||
|
;;
|
||||||
|
uninstall)
|
||||||
|
uninstall
|
||||||
|
;;
|
||||||
|
'')
|
||||||
|
install "$NODE_VERSION"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
install "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#yarnpkg config set registry https://registry.npm.taobao.org --global && \
|
||||||
|
#yarnpkg config set disturl https://npm.taobao.org/dist --global && \
|
||||||
|
#yarnpkg config set sass_binary_site https://npm.taobao.org/mirrors/node-sass --global && \
|
||||||
|
#yarnpkg config set electron_mirror https://npm.taobao.org/mirrors/electron/ --global && \
|
||||||
|
#yarnpkg config set puppeteer_download_host https://npm.taobao.org/mirrors --global && \
|
||||||
|
#yarnpkg config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver --global && \
|
||||||
|
#yarnpkg config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver --global && \
|
||||||
|
#yarnpkg config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs --global && \
|
||||||
|
#yarnpkg config set selenium_cdnurl https://npm.taobao.org/mirrors/selenium --global && \
|
||||||
|
#yarnpkg config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/ --global && \
|
||||||
|
#yarnpkg config set profiler_binary_host_mirror https://npm.taobao.org/mirrors/node-inspector/ --global && \
|
||||||
|
#yarnpkg config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver --global && \
|
||||||
|
#yarnpkg config set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector --global && \
|
||||||
|
#yarnpkg config set sentrycli_cdnurl https://npm.taobao.org/mirrors/sentry-cli
|
39
devel/python.sh
Executable file
39
devel/python.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log "Setting up python3"
|
||||||
|
|
||||||
|
if in_china; then
|
||||||
|
|
||||||
|
# config pip mirror for CHINA
|
||||||
|
mkdir -p "$HOME/.pip"
|
||||||
|
echo "
|
||||||
|
[global]
|
||||||
|
index-url = https://mirrors.aliyun.com/pypi/simple
|
||||||
|
" | sed -r 's/^ *//' | sudo tee "/etc/pip.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install python3
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
#for older ubuntu distro
|
||||||
|
#sudo add-apt-repository ppa:deadsnakes/ppa
|
||||||
|
#sudo apt-get update
|
||||||
|
#sudo apt-get install python3.8
|
||||||
|
#sudo apt install python3.8-distutils
|
||||||
|
#sudo python3.8 -m pip install --upgrade pip setuptools wheel
|
||||||
|
sudo apt install python3 python3-pip python-is-python3
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
sudo pacman -S --noconfirm --needed python python-pip
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# enable auto_activation plugin for virtualfish
|
||||||
|
if has_fish; then
|
||||||
|
sudo pip install virtualfish
|
||||||
|
fish -c "yes | vf install && vf addplugins auto_activation"
|
||||||
|
fi
|
||||||
|
|
35
devel/rust.sh
Executable file
35
devel/rust.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log "Setting up rust"
|
||||||
|
|
||||||
|
if in_china; then
|
||||||
|
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
|
||||||
|
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
|
||||||
|
|
||||||
|
if command -v fish >/dev/null; then
|
||||||
|
echo "
|
||||||
|
set -x RUSTUP_DIST_SERVER $RUSTUP_DIST_SERVER
|
||||||
|
set -x RUSTUP_UPDATE_ROOT $RUSTUP_UPDATE_ROOT
|
||||||
|
" | sed 's/^ *//' > "$XDG_CONFIG_HOME/fish/conf.d/rustup.fish"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setup cargo mirrors
|
||||||
|
[ ! -f "$HOME/.cargo/config" ] && mkdir -p "$HOME/.cargo" && echo "
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = 'ustc'
|
||||||
|
|
||||||
|
[source.ustc]
|
||||||
|
registry = \"git://mirrors.ustc.edu.cn/crates.io-index\"
|
||||||
|
" | sed 's/^ *//' > "$HOME/.cargo/config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ ! -f "$HOME/.cargo/bin/rustup" ] \
|
||||||
|
&& curl -sSf https://cdn.jsdelivr.net/gh/rust-lang-nursery/rustup.rs/rustup-init.sh | sh
|
||||||
|
|
||||||
|
command -v fish >/dev/null && echo "
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
" | sed 's/^ *//' > "$XDG_CONFIG_HOME/fish/conf.d/cargo.fish"
|
83
env.sh
83
env.sh
|
@ -1,40 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
[ "$ENVSHED" = "yes" ] && return
|
||||||
|
ENVSHED=yes
|
||||||
PM=n/a
|
PM=n/a
|
||||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME-"$HOME/.config"}
|
XDG_CONFIG_HOME=${XDG_CONFIG_HOME-"$HOME/.config"}
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
PDIR=$(dirname "${DIR-$0}")
|
PDIR=$(dirname "${DIR-$0}")
|
||||||
GITHUB_PROXY=${GITHUB_PROXY-$HTTPS_PROXY}
|
GITHUB_PROXY=${GITHUB_PROXY-$HTTPS_PROXY}
|
||||||
echo "dir: $DIR"
|
|
||||||
echo "parent dir: $PDIR"
|
|
||||||
echo "prefix dir: $PREFIX"
|
|
||||||
|
|
||||||
sudo mkdir -p $PREFIX
|
in_china() {
|
||||||
|
|
||||||
if command -v pacman > /dev/null; then
|
|
||||||
PM=pacman
|
|
||||||
elif command -v apt > /dev/null; then
|
|
||||||
PM=apt
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PM" = "n/a" ]; then
|
|
||||||
echo "Unsupported Package Manager"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
in_china () {
|
|
||||||
if [ -z "$IS_CHINA" ]; then
|
if [ -z "$IS_CHINA" ]; then
|
||||||
IS_CHINA=no
|
IS_CHINA=no
|
||||||
if curl -q myip.ipip.net | grep '中国' > /dev/null; then
|
if curl -s myip.ipip.net | grep -qF '中国' > /dev/null; then
|
||||||
IS_CHINA=yes
|
IS_CHINA=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ "$IS_CHINA" = "no" ] && return 1
|
[ "$IS_CHINA" = "no" ] && echo "in_china: no" && return 1
|
||||||
|
echo "in_china: yes"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lnsf () {
|
lnsf() {
|
||||||
[ "$#" -ne 2 ] && echo "lnsf <target> <symlink>" && return 1
|
[ "$#" -ne 2 ] && echo "lnsf <target> <symlink>" && return 1
|
||||||
TARGET=$(readlink -f "$1") || (echo failed: readlink -f "$1" ; return 1)
|
TARGET=$(readlink -f "$1") || (echo failed: readlink -f "$1" ; return 1)
|
||||||
SYMLNK=$2
|
SYMLNK=$2
|
||||||
|
@ -48,11 +35,11 @@ lnsf () {
|
||||||
ln -sf "$TARGET" "$SYMLNK"
|
ln -sf "$TARGET" "$SYMLNK"
|
||||||
}
|
}
|
||||||
|
|
||||||
has_bluetooth () {
|
has_bluetooth() {
|
||||||
dmesg | grep -i bluetooth
|
dmesg | grep -i bluetooth
|
||||||
}
|
}
|
||||||
|
|
||||||
eqv () {
|
eqv() {
|
||||||
VERSION_PATH=$1
|
VERSION_PATH=$1
|
||||||
VERSION=$2
|
VERSION=$2
|
||||||
[ ! -f "$VERSION_PATH" ] && return 1
|
[ ! -f "$VERSION_PATH" ] && return 1
|
||||||
|
@ -60,24 +47,51 @@ eqv () {
|
||||||
[ "$VERSION" = "$VERSION2" ]
|
[ "$VERSION" = "$VERSION2" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git_clone() {
|
||||||
|
mkdir -p "$(dirname "$2")"
|
||||||
|
[ -d "$2" ] && return
|
||||||
|
echo "$1" | grep -qF 'github.com' && HTTPS_PROXY=$GITHUB_PROXY git clone --depth 1 "$1" "$2"
|
||||||
|
git clone --depth 1 "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
intorepo() {
|
intorepo() {
|
||||||
ODIR=$(pwd)
|
ODIR=$(pwd)
|
||||||
REPO=$2
|
REPO=$2
|
||||||
if [ ! -d "$REPO" ]; then
|
git_clone "$1" "$REPO"
|
||||||
HTTPS_PROXY=$GITHUB_PROXY git clone --depth 1 "$1" "$REPO"
|
|
||||||
cd "$REPO"
|
cd "$REPO"
|
||||||
else
|
|
||||||
cd "$REPO"
|
|
||||||
git pull
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exitrepo() {
|
exitrepo() {
|
||||||
cd "$ODIR"
|
cd "$ODIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf "\n\033[32m%s\033[0m\n" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# install basic common utilities
|
has_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
has_fish() {
|
||||||
|
has_cmd "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sudo mkdir -p $PREFIX
|
||||||
|
|
||||||
|
if has_cmd pacman; then
|
||||||
|
PM=pacman
|
||||||
|
elif has_cmd apt; then
|
||||||
|
PM=apt
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PM" = "n/a" ]; then
|
||||||
|
echo "Unsupported Package Manager"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing basic utilities"
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
|
@ -88,14 +102,14 @@ case "$PM" in
|
||||||
man sudo
|
man sudo
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
base-devel \
|
base-devel \
|
||||||
unzip p7zip \
|
unzip p7zip \
|
||||||
openssh \
|
openssh \
|
||||||
curl wget \
|
curl wget \
|
||||||
man sudo
|
man sudo
|
||||||
# install yay
|
# install yay
|
||||||
if ! command -v yay; then
|
if ! command -v yay >/dev/null; then
|
||||||
git clone --depth 1 https://aur.archlinux.org/yay.git /tmp/yay
|
git clone --depth 1 https://aur.archlinux.org/yay.git /tmp/yay
|
||||||
cd /tmp/yay
|
cd /tmp/yay
|
||||||
makepkg -si
|
makepkg -si
|
||||||
|
@ -104,3 +118,10 @@ case "$PM" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
log "Environments"
|
||||||
|
echo " PM : $PM"
|
||||||
|
echo " DIR : $DIR"
|
||||||
|
echo " PDIR : $PDIR"
|
||||||
|
echo " PREFIX : $PREFIX"
|
||||||
|
echo " GITHUB_PROXY : $GITHUB_PROXY"
|
||||||
|
|
19
gui/autologin.sh
Executable file
19
gui/autologin.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
echo 'Please enter autologin username (empty to skip): '
|
||||||
|
read -r LOGIN
|
||||||
|
if [ -z "$LOGIN" ]; then
|
||||||
|
echo skip autologin setup
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
|
||||||
|
echo "
|
||||||
|
[Service]
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=-/sbin/agetty --autologin $LOGIN --noclear %I \$TERM
|
||||||
|
" | sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null
|
71
gui/font.sh
Executable file
71
gui/font.sh
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up fonts'
|
||||||
|
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
# fonts
|
||||||
|
sudo apt install -y \
|
||||||
|
fonts-urw-base35 \
|
||||||
|
fonts-cascadia-code \
|
||||||
|
fonts-wqy-microhei \
|
||||||
|
fonts-symbola \
|
||||||
|
fonts-dejavu-core \
|
||||||
|
gucharmap
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
# fonts
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
freetype2 \
|
||||||
|
gsfonts \
|
||||||
|
ttf-cascadia-code \
|
||||||
|
ttf-dejavu \
|
||||||
|
gucharmap
|
||||||
|
# official wqy-microhei package doesn't fix the Korean Glyphs stacking bug
|
||||||
|
# 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
|
||||||
|
[ ! -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 /
|
||||||
|
# install symbola for plain emojis(no-color) for st
|
||||||
|
! fc-list | grep -qi symbola && yay -S --noconfirm --needed ttf-symbola-free
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# install hermit nerd font
|
||||||
|
install_nerdfont () {
|
||||||
|
grep -F "$*" /usr/local/share/fonts/nerdfont && return
|
||||||
|
ORIGIN_NAME=$1
|
||||||
|
PATCHED_PAT=$2
|
||||||
|
VERSION=$3
|
||||||
|
NAME=$ORIGIN_NAME-$VERSION.zip
|
||||||
|
LOCAL_REPO_PATH=/tmp/nerd-font/$ORIGIN_NAME
|
||||||
|
# shortcircuit if font already in system
|
||||||
|
fc-list | grep -F "$PATCHED_PAT" | grep -i nerd && return
|
||||||
|
# clone single branch from gitee
|
||||||
|
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
|
||||||
|
sudo chmod +rx /usr/local/share/fonts
|
||||||
|
echo "$*" | sudo tee -a /usr/local/share/fonts/nerdfont
|
||||||
|
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
|
||||||
|
|
||||||
|
log 'Setting up font rendering'
|
||||||
|
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/font/freetype2.sh" "/etc/profile.d/freetype2.sh"
|
||||||
|
sudo cp "$DIR/font/local.conf" "/etc/fonts/local.conf"
|
125
gui/install.sh
125
gui/install.sh
|
@ -1,111 +1,26 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
# install basic gui stuff, including fonts/system utilties/keyring etc
|
if [ "$PM" = "apt" ]; then
|
||||||
case "$PM" in
|
sudo systemctl disable systemd-networkd-wait-online
|
||||||
apt)
|
sudo systemctl mask systemd-networkd-wait-online
|
||||||
# fonts
|
sudo systemctl disable cloud-init
|
||||||
sudo apt install \
|
sudo systemctl mask cloud-init
|
||||||
fonts-urw-base35 \
|
sudo systemctl disable cloud-config
|
||||||
fonts-cascadia-code \
|
sudo systemctl mask cloud-config
|
||||||
fonts-wqy-microhei \
|
sudo systemctl disable gdm3
|
||||||
fonts-symbola \
|
sudo systemctl mask gdm3
|
||||||
fonts-dejavu-core \
|
fi
|
||||||
dunst \
|
|
||||||
gucharmap
|
|
||||||
# network manager
|
|
||||||
sudo apt install \
|
|
||||||
network-manager network-manager-gnome
|
|
||||||
# bluetooth
|
|
||||||
if has_bluetooth; then
|
|
||||||
sudo apt install \
|
|
||||||
bluez bluez-tools blueman pulseaudio-module-bluetooth
|
|
||||||
sudo systemctl enable bluetooth
|
|
||||||
sudo systemctl start bluetooth
|
|
||||||
# system utils
|
|
||||||
sudo apt install \
|
|
||||||
exfat-utils \
|
|
||||||
axel
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
# fonts
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
freetype2 \
|
|
||||||
gsfonts \
|
|
||||||
ttf-cascadia-code \
|
|
||||||
ttf-dejavu \
|
|
||||||
dunst \
|
|
||||||
gucharmap
|
|
||||||
# official wqy-microhei package doesn't fix the Korean Glyphs stacking bug
|
|
||||||
# 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
|
|
||||||
[ ! -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 /
|
|
||||||
# install symbola for plain emojis(no-color) for st
|
|
||||||
! fc-list | grep -qi symbola && yay -S --needed ttf-symbola-free
|
|
||||||
# clipboard
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
xclip xsel
|
|
||||||
# keyring
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
gnome-keyring libsecret
|
|
||||||
# network manager
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
networkmanager network-manager-applet
|
|
||||||
# bluetooth
|
|
||||||
if has_bluetooth; then
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
bluez bluez-utils blueman pulseaudio-bluetooth xorg-xbacklight
|
|
||||||
sudo systemctl enable bluetooth
|
|
||||||
sudo systemctl start bluetooth
|
|
||||||
fi
|
|
||||||
# for setting up default programs: exo-preferred-applications
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
exfat-utils \
|
|
||||||
axel \
|
|
||||||
exo
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
. "$DIR/autologin.sh"
|
||||||
# install hermit nerd font
|
. "$DIR/suspendlock.sh"
|
||||||
install_nerdfont () {
|
. "$DIR/font.sh"
|
||||||
grep -F "$*" /usr/local/share/fonts/nerdfont && return
|
. "$DIR/sysutils.sh"
|
||||||
ORIGIN_NAME=$1
|
. "$DIR/picom.sh"
|
||||||
PATCHED_PAT=$2
|
. "$DIR/office.sh"
|
||||||
VERSION=$3
|
. "$DIR/player.sh"
|
||||||
NAME=$ORIGIN_NAME-$VERSION.zip
|
. "$DIR/theme.sh"
|
||||||
LOCAL_REPO_PATH=/tmp/nerd-font/$ORIGIN_NAME
|
. "$DIR/suckless.sh"
|
||||||
# shortcircuit if font already in system
|
|
||||||
fc-list | grep -F "$PATCHED_PAT" | grep -i nerd && return
|
|
||||||
# clone single branch from gitee
|
|
||||||
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
|
|
||||||
sudo chmod +rx /usr/local/share/fonts
|
|
||||||
echo "$*" | sudo tee -a /usr/local/share/fonts/nerdfont
|
|
||||||
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
|
|
||||||
|
|
||||||
# start network
|
|
||||||
sudo systemctl enable NetworkManager
|
|
||||||
sudo systemctl start NetworkManager
|
|
||||||
|
|
||||||
# configuration
|
|
||||||
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/content/freetype2.sh" "/etc/profile.d/freetype2.sh"
|
|
||||||
sudo cp "$DIR/content/local.conf" "/etc/fonts/local.conf"
|
|
||||||
lnsf "$DIR/content/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
36
gui/office.sh
Executable file
36
gui/office.sh
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Settingup office tools: libreoffice keepassxc nextcloud chrome zathura gimp sxiv'
|
||||||
|
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
sudo add-apt-repository -y ppa:libreoffice/libreoffice-7-0
|
||||||
|
sudo add-apt-repository -y ppa:phoerious/keepassxc
|
||||||
|
sudo add-apt-repository -y ppa:nextcloud-devs/client
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y \
|
||||||
|
google-chrome-stable \
|
||||||
|
zathura zathura-pdf-poppler sxiv \
|
||||||
|
gimp \
|
||||||
|
libreoffice \
|
||||||
|
keepassxc \
|
||||||
|
nextcloud-client
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
# fonts
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
chromium \
|
||||||
|
zathura zathura-pdf-mupdf sxiv \
|
||||||
|
gimp \
|
||||||
|
libreoffice-fresh \
|
||||||
|
keepassxc \
|
||||||
|
nextcloud-client
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
lnsf "$DIR/zathura/zathurarc" "$XDG_CONFIG_HOME/zathura/zathurarc"
|
||||||
|
rm -f "$HOME/.local/share/applications/chrome-*.desktop"
|
|
@ -4,29 +4,30 @@ set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up picom'
|
||||||
|
|
||||||
# install dpes
|
# install dpes
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
# install build tools
|
# install build tools
|
||||||
! command -v pip3 && "$PDIR/python/install.sh"
|
! has_cmd pip3 && . "$PDIR/python/install.sh"
|
||||||
sudo pip3 install meson
|
sudo pip3 install meson
|
||||||
# install dependencies
|
# 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
|
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
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed uthash ninja meson
|
sudo pacman -S --noconfirm --needed uthash ninja meson
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# build and install picom
|
# build and install picom
|
||||||
intorepo https://github.com/yshui/picom.git "$DIR/repo"
|
intorepo https://github.com/klesh/picom.git "$DIR/repos/picom"
|
||||||
meson --buildtype=release . build
|
meson --buildtype=release . build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
exitrepo
|
exitrepo
|
||||||
sudo cp -f "$DIR/content/picomdaemon" "$PREFIX/bin"
|
sudo cp -f "$DIR/picom/picomdaemon" "$PREFIX/bin"
|
||||||
sudo chmod +x "$PREFIX/bin/picomdaemon"
|
sudo chmod +x "$PREFIX/bin/picomdaemon"
|
||||||
echo 'picom installed'
|
echo 'picom installed'
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
lnsf "$DIR/content/picom.conf" "$XDG_CONFIG_HOME/picom/picom.conf"
|
lnsf "$DIR/picom/picom.conf" "$XDG_CONFIG_HOME/picom/picom.conf"
|
|
@ -1,8 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up player: mpv mpd'
|
||||||
|
|
||||||
# install music and video player
|
# install music and video player
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
|
@ -10,16 +12,16 @@ case "$PM" in
|
||||||
sudo apt install -y mpd mpc ncmpcpp mpv
|
sudo apt install -y mpd mpc ncmpcpp mpv
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed mpd mpc ncmpcpp mpv
|
sudo pacman -S --noconfirm --needed mpd mpc ncmpcpp mpv
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# symlink configuration
|
# symlink configuration
|
||||||
lnsf "$DIR/config/mpd/mpd.conf" "$XDG_CONFIG_HOME/mpd/mpd.conf"
|
lnsf "$DIR/mpd/mpd.conf" "$XDG_CONFIG_HOME/mpd/mpd.conf"
|
||||||
lnsf "$DIR/config/mpv/mpv.conf" "$XDG_CONFIG_HOME/mpv/mpv.conf"
|
lnsf "$DIR/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/mpv/scripts/organize.lua" "$XDG_CONFIG_HOME/mpv/scripts/organize.lua"
|
||||||
lnsf "$DIR/config/ncmpcpp/bindings" "$XDG_CONFIG_HOME/ncmpcpp/bindings"
|
lnsf "$DIR/ncmpcpp/bindings" "$XDG_CONFIG_HOME/ncmpcpp/bindings"
|
||||||
lnsf "$DIR/config/ncmpcpp/config" "$XDG_CONFIG_HOME/ncmpcpp/config"
|
lnsf "$DIR/ncmpcpp/config" "$XDG_CONFIG_HOME/ncmpcpp/config"
|
||||||
|
|
||||||
# prevent system-wide mpd
|
# prevent system-wide mpd
|
||||||
sudo systemctl disable mpd
|
sudo systemctl disable mpd
|
|
@ -4,34 +4,16 @@ set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
"$PDIR/fish/install.sh"
|
log 'Setting up suckless'
|
||||||
"$PDIR/gui/install.sh"
|
|
||||||
"$PDIR/picom/install.sh"
|
|
||||||
"$PDIR/dunst/install.sh"
|
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
xorg libx11-dev libxft-dev libxinerama-dev libxcursor-dev \
|
|
||||||
libxrandr-dev arandr autorandr \
|
|
||||||
ibus ibus-table ibus-table-wubi \
|
|
||||||
pavucontrol \
|
|
||||||
gnome-keyring \
|
|
||||||
xss-lock \
|
|
||||||
nitrogen \
|
|
||||||
trayer
|
trayer
|
||||||
sudo apt remove gdm3
|
sudo apt remove gdm3
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
xorg-server xorg-xinit xorg-xrandr xorg-xev xorg-xprop \
|
|
||||||
alsa-firmware alsa-utils alsa-plugins pulseaudio-alsa pulseaudio pavucontrol \
|
|
||||||
arandr autorandr \
|
|
||||||
ibus ibus-table ibus-table-chinese \
|
|
||||||
gnome-keyring \
|
|
||||||
xss-lock \
|
|
||||||
nitrogen \
|
|
||||||
trayer
|
trayer
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -47,11 +29,10 @@ installrepo () {
|
||||||
installrepo https://gitee.com/klesh/st.git st
|
installrepo https://gitee.com/klesh/st.git st
|
||||||
installrepo https://gitee.com/klesh/dmenu.git dmenu
|
installrepo https://gitee.com/klesh/dmenu.git dmenu
|
||||||
installrepo https://gitee.com/klesh/slock.git slock
|
installrepo https://gitee.com/klesh/slock.git slock
|
||||||
installrepo https://github.com/klesh/dict.sh.git dict.sh
|
|
||||||
installrepo https://gitee.com/klesh/dwm.git dwm
|
installrepo https://gitee.com/klesh/dwm.git dwm
|
||||||
|
installrepo https://github.com/klesh/dict.sh.git dict.sh
|
||||||
|
|
||||||
# config xinit to start for dwm
|
# config xinit to start for dwm
|
||||||
rm ~/.xinitrc
|
|
||||||
cat <<EOT > ~/.xinitrc
|
cat <<EOT > ~/.xinitrc
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
@ -76,7 +57,7 @@ while :; do
|
||||||
done
|
done
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
cat <<'EOT' | sed "s/__DIR__/$DIR/g" > ~/.profile
|
cat <<'EOT' | sed "s|__DIR__|$DIR|g" > ~/.profile
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
export PATH=__DIR__/bin:$HOME/.local/bin:$PATH
|
export PATH=__DIR__/bin:$HOME/.local/bin:$PATH
|
||||||
|
@ -91,5 +72,5 @@ EOT
|
||||||
|
|
||||||
# config dwm
|
# config dwm
|
||||||
mkdir -p "$XDG_CONFIG_HOME/dwm"
|
mkdir -p "$XDG_CONFIG_HOME/dwm"
|
||||||
lnsf "$DIR/config/dwm/autostart" "$XDG_CONFIG_HOME/dwm/autostart"
|
lnsf "$DIR/dwm/autostart" "$XDG_CONFIG_HOME/dwm/autostart"
|
||||||
lnsf "$DIR/config/autorandr/postswitch" "$XDG_CONFIG_HOME/autorandr/postswitch"
|
lnsf "$DIR/autorandr/postswitch" "$XDG_CONFIG_HOME/autorandr/postswitch"
|
22
gui/suspendlock.sh
Executable file
22
gui/suspendlock.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up lock on suspend'
|
||||||
|
|
||||||
|
echo "
|
||||||
|
[Unit]
|
||||||
|
Description=Lock on suspend
|
||||||
|
Before=sleep.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/loginctl lock-sessions
|
||||||
|
ExecStartPost=/usr/bin/sleep 2
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sleep.target
|
||||||
|
" | sudo tee /etc/systemd/system/suspendlock.service >/dev/null
|
||||||
|
|
||||||
|
sudo systemctl enable suspendlock
|
67
gui/sysutils.sh
Executable file
67
gui/sysutils.sh
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
|
log 'Setting up system utilities X11 ibus keyring dunst clipboard screenshot thunar network bluetooth'
|
||||||
|
|
||||||
|
case "$PM" in
|
||||||
|
apt)
|
||||||
|
sudo apt install -y \
|
||||||
|
xorg libx11-dev libxft-dev libxinerama-dev libxcursor-dev \
|
||||||
|
libxrandr-dev arandr autorandr \
|
||||||
|
pavucontrol \
|
||||||
|
ibus ibus-table ibus-table-wubi \
|
||||||
|
gnome-keyring \
|
||||||
|
xss-lock \
|
||||||
|
nitrogen \
|
||||||
|
network-manager network-manager-gnome \
|
||||||
|
exfat-utils \
|
||||||
|
dunst \
|
||||||
|
xclip xsel xdotool \
|
||||||
|
libnotify-bin \
|
||||||
|
flameshot scrot \
|
||||||
|
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
|
||||||
|
# bluetooth
|
||||||
|
if has_bluetooth; then
|
||||||
|
sudo apt install \
|
||||||
|
bluez bluez-tools blueman pulseaudio-module-bluetooth
|
||||||
|
sudo systemctl enable bluetooth
|
||||||
|
sudo systemctl start bluetooth
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
pacman)
|
||||||
|
# for setting up default programs: exo-preferred-applications
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
xorg-server xorg-xinit xorg-xrandr xorg-xev xorg-xprop \
|
||||||
|
arandr autorandr \
|
||||||
|
alsa-firmware alsa-utils alsa-plugins pulseaudio-alsa pulseaudio pavucontrol \
|
||||||
|
ibus ibus-table ibus-table-chinese \
|
||||||
|
gnome-keyring \
|
||||||
|
xss-lock \
|
||||||
|
nitrogen \
|
||||||
|
networkmanager network-manager-applet \
|
||||||
|
exfat-utils \
|
||||||
|
exo \
|
||||||
|
dunst \
|
||||||
|
xclip xsel xdotool \
|
||||||
|
gnome-keyring libsecret \
|
||||||
|
flameshot scrot \
|
||||||
|
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler
|
||||||
|
# bluetooth
|
||||||
|
if has_bluetooth; then
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
bluez bluez-utils blueman pulseaudio-bluetooth xorg-xbacklight
|
||||||
|
sudo systemctl enable bluetooth
|
||||||
|
sudo systemctl start bluetooth
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# start network
|
||||||
|
sudo systemctl enable NetworkManager
|
||||||
|
sudo systemctl start NetworkManager
|
||||||
|
|
||||||
|
lnsf "$DIR/dunst/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
|
||||||
|
lnsf "$DIR/thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
|
|
@ -4,7 +4,8 @@ set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
# for better looking
|
log 'Setting up theme'
|
||||||
|
|
||||||
case "$PM" in
|
case "$PM" in
|
||||||
apt)
|
apt)
|
||||||
sudo apt install -y \
|
sudo apt install -y \
|
||||||
|
@ -17,7 +18,7 @@ case "$PM" in
|
||||||
cd -
|
cd -
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
sudo pacman -S --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
lxappearance arc-gtk-theme arc-icon-theme qt5ct qt5-styleplugins
|
lxappearance arc-gtk-theme arc-icon-theme qt5ct qt5-styleplugins
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
# install specific version
|
|
||||||
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
|
|
||||||
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"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# install from distribution repo
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo apt install -y nodejs npm yarnpkg
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed nodejs npm yarn
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# install nvm
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# config mirrors for CHINA
|
|
||||||
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 && \
|
|
||||||
yarnpkg config set sass_binary_site https://npm.taobao.org/mirrors/node-sass --global && \
|
|
||||||
yarnpkg config set electron_mirror https://npm.taobao.org/mirrors/electron/ --global && \
|
|
||||||
yarnpkg config set puppeteer_download_host https://npm.taobao.org/mirrors --global && \
|
|
||||||
yarnpkg config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver --global && \
|
|
||||||
yarnpkg config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver --global && \
|
|
||||||
yarnpkg config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs --global && \
|
|
||||||
yarnpkg config set selenium_cdnurl https://npm.taobao.org/mirrors/selenium --global && \
|
|
||||||
yarnpkg config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/ --global && \
|
|
||||||
yarnpkg config set profiler_binary_host_mirror https://npm.taobao.org/mirrors/node-inspector/ --global && \
|
|
||||||
yarnpkg config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver --global && \
|
|
||||||
yarnpkg config set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector --global && \
|
|
||||||
yarnpkg config set sentrycli_cdnurl https://npm.taobao.org/mirrors/sentry-cli
|
|
||||||
fi
|
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
# check dependencies
|
|
||||||
! command -v yarnpkg && "$PDIR/nodejs/install.sh"
|
|
||||||
! command -v pip && "$PDIR/python/install.sh"
|
|
||||||
|
|
||||||
# install nvim
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/stable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y neovim
|
|
||||||
sudo pip3 install pyvim neovim
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed neovim
|
|
||||||
sudo pip install pyvim neovim
|
|
||||||
;;
|
|
||||||
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/coc-settings.json" ~/.vim/coc-settings.json
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
|
|
||||||
! in_china && echo 'Skip mirrors configuration' && exit
|
|
||||||
|
|
||||||
# setup package mirror for CHINA
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
# backup original sources.list
|
|
||||||
[ ! -f /etc/apt/sources.list.bak ] && \
|
|
||||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
|
||||||
# replace with aliyun mirror
|
|
||||||
awk '$0 ~ /^deb/ {$2="https://mirrors.aliyun.com/ubuntu/"; print}' /etc/apt/sources.list.bak | sudo tee /etc/apt/sources.list
|
|
||||||
sudo apt update
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
echo TODO
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
sudo systemctl disable systemd-networkd-wait-online
|
|
||||||
sudo systemctl mask systemd-networkd-wait-online
|
|
||||||
sudo systemctl disable cloud-init
|
|
||||||
sudo systemctl mask cloud-init
|
|
||||||
sudo systemctl disable cloud-config
|
|
||||||
sudo systemctl mask cloud-config
|
|
||||||
sudo systemctl disable gdm3
|
|
||||||
sudo systemctl mask gdm3
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
# config pip mirror for CHINA
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
sudo mkdir -p /root/.pip
|
|
||||||
sudo cp python/pip.conf /root/.pip/pip.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install python3
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo apt install python3 python3-pip python-is-python3
|
|
||||||
command -v fish 2>/dev/null && sudo pip3 install virtualfish
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed python python-pip
|
|
||||||
command -v fish 2>/dev/null && sudo pip install virtualfish
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# enable auto_activation plugin for virtualfish
|
|
||||||
command -v fish 2>/dev/null && fish -c "yes | vf install && vf addplugins auto_activation"
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[global]
|
|
||||||
index-url = https://mirrors.aliyun.com/pypi/simple
|
|
||||||
#index-url = https://pypi.doubanio.com/simple
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# install python3.8
|
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install python3.8
|
|
||||||
|
|
||||||
# install pip and other distutils
|
|
||||||
sudo apt install python3.8-distutils
|
|
||||||
sudo python3.8 -m pip install --upgrade pip setuptools wheel
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
DIR=$(dirname "$(readlink -f "$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
|
|
||||||
! command -v pip3 && "$PDIR/python/install.sh"
|
|
||||||
sudo pip3 install ranger-fm ueberzug
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed atool p7zip unrar highlight
|
|
||||||
sudo pip install ranger-fm ueberzug
|
|
||||||
;;
|
|
||||||
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/colorschemes/solarizedmod.py" "$XDG_CONFIG_HOME/ranger/colorschemes/solarizedmod.py"
|
|
||||||
|
|
||||||
# install devicons
|
|
||||||
[ ! -d ~/.config/ranger/plugins/ranger_devicons ] && \
|
|
||||||
git clone --depth 1 https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
|
||||||
. "$DIR/../env.sh"
|
|
||||||
|
|
||||||
# install ranger
|
|
||||||
case "$PM" in
|
|
||||||
apt)
|
|
||||||
sudo apt install -y \
|
|
||||||
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo pacman -S --needed \
|
|
||||||
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# symlink configuration
|
|
||||||
lnsf "$DIR/Thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
|
|
Loading…
Reference in New Issue
Block a user