dotfiles/gui/install.sh

109 lines
3.6 KiB
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-17 10:24:35 +00:00
2020-11-02 04:08:18 +00:00
DIR=$(readlink -f "$(dirname "$0")")
. "$DIR/../env.sh"
2020-09-17 10:24:35 +00:00
2020-09-17 16:02:24 +00:00
# install basic gui stuff, including fonts/system utilties/keyring etc
2020-09-17 10:24:35 +00:00
case "$PM" in
apt)
2020-09-17 16:02:24 +00:00
# fonts
2020-09-17 10:24:35 +00:00
sudo apt install \
2020-09-29 06:10:29 +00:00
fonts-urw-base35 \
2020-09-29 06:45:00 +00:00
fonts-cascadia-code \
fonts-wqy-microhei \
fonts-symbola \
fonts-dejavu-core \
2020-09-17 10:24:35 +00:00
gucharmap
2020-09-17 16:02:24 +00:00
# network manager
sudo apt install \
network-manager network-manager-gnome
# bluetooth
2020-11-02 04:08:18 +00:00
if has_bluetooth; then
2020-09-17 16:02:24 +00:00
sudo apt install \
bluez bluez-tools blueman pulseaudio-module-bluetooth
2020-09-18 04:16:15 +00:00
sudo systemctl enable bluetooth
sudo systemctl start bluetooth
# system utils
sudo apt install \
exfat-utils \
axel
2020-09-17 16:02:24 +00:00
fi
2020-09-17 10:24:35 +00:00
;;
pacman)
# fonts
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 10:24:35 +00:00
freetype2 \
2020-09-29 06:10:29 +00:00
gsfonts \
2020-09-29 06:45:00 +00:00
ttf-cascadia-code \
ttf-dejavu \
2020-09-17 10:24:35 +00:00
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
2020-11-02 04:08:18 +00:00
[ ! -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
2020-11-02 04:08:18 +00:00
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
2020-09-17 16:02:24 +00:00
# clipboard
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 16:02:24 +00:00
xclip xsel
# keyring
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 16:02:24 +00:00
gnome-keyring libsecret
# network manager
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 16:02:24 +00:00
networkmanager network-manager-applet
# bluetooth
2020-11-02 04:08:18 +00:00
if has_bluetooth; then
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 16:02:24 +00:00
bluez bluez-utils blueman pulseaudio-bluetooth xorg-xbacklight
2020-09-18 04:16:15 +00:00
sudo systemctl enable bluetooth
sudo systemctl start bluetooth
2020-09-17 16:02:24 +00:00
fi
# for setting up default programs: exo-preferred-applications
sudo pacman -S --needed \
exfat-utils \
axel \
exo
2020-09-17 10:24:35 +00:00
;;
esac
2020-09-17 16:02:24 +00:00
2020-09-17 10:24:35 +00:00
# install hermit nerd font
2020-11-02 04:08:18 +00:00
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
2020-11-02 04:08:18 +00:00
fc-list | grep -F "$PATCHED_PAT" | grep -i nerd && return
# clone single branch from gitee
2020-11-02 04:08:18 +00:00
git clone --single-branch --branch "$ORIGIN_NAME" --depth 1 \
https://gitee.com/klesh/nerd-fonts.git \
2020-11-02 04:08:18 +00:00
"$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
2020-11-02 04:08:18 +00:00
rm -rf "$LOCAL_REPO_PATH"
}
2020-11-02 04:08:18 +00:00
#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
2020-09-17 10:24:35 +00:00
2020-09-17 16:02:24 +00:00
# start network
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager
2020-09-17 10:24:35 +00:00
# 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
2020-11-02 04:08:18 +00:00
sudo cp "$DIR/freetype2.sh" "/etc/profile.d/freetype2.sh"
sudo cp "$DIR/local.conf" "/etc/fonts/local.conf"