.dotfiles/dotman

295 lines
7.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env sh
greeter() {
2020-03-22 22:19:51 +01:00
clear
cat <<EOF
_ _
__| | ___ | |_ _ __ ___ __ _ _ __
/ _\` |/ _ \\| __| '_ \` _ \ / _\` | '_ \
| (_| | (_) | |_| | | | | | (_| | | | |
\__,_|\___/ \__|_| |_| |_|\__,_|_| |_|
EOF
2020-03-22 22:19:51 +01:00
}
# Logs
LOG_DIR="$HOME/.log/dotfiles/$(date +"%d-%m-%Y-%H:%M:%S")/"
2020-03-22 22:19:51 +01:00
mkdir -p "$LOG_DIR"
CACHE="$HOME/.cache/dotfiles"
mkdir -p "$CACHE"
install_repo_packages() {
# Find best mirrors
sudo pacman -S --noconfirm --needed reflector
sudo reflector --latest 200 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
# Update
sudo pacman -Syu --noconfirm
# Packages
FONTS="otf-ipafont noto-fonts-emoji gnu-free-fonts ttf-arphic-uming ttf-indic-otf ttf-joypixels ttf-font-awesome ttf-dejavu ttf-inconsolata"
UTILS="neovim qutebrowser telegram-desktop htop mpd ncmpcpp rofi transmission-cli vlc zsh youtube-dl grc curl wget xclip figlet w3m vifm feh alsa-utils tmux networkmanager maim fzf exfat-utils fuse2 udiskie udisks2 imagemagick i3lock-color man pacman-contrib ncdu mpc neomutt bc clipmenu xdotool syncthing"
WM="dunst bspwm sxhkd picom xorg-server xorg-xinit xorg-xsetroot papirus-icon-theme"
2020-03-22 22:19:51 +01:00
DEV="python-pip yarn gradle ccls eslint flake8 shellcheck prettier python-black hub git"
sudo pacman -S --noconfirm --needed $FONTS $UTILS $WM $DEV
2020-03-22 22:19:51 +01:00
}
install_yay() {
2020-03-22 22:19:51 +01:00
cd "$CACHE" || exit
git clone https://aur.archlinux.org/yay.git
2020-03-22 22:19:51 +01:00
cd yay || exit
makepkg -si --noconfirm
}
2020-03-22 22:19:51 +01:00
install_aur_packages() {
2020-03-22 22:19:51 +01:00
# Install yay when isn't installed
[[ $(which yay) == "yay not found" ]] && install_yay
2020-03-22 22:19:51 +01:00
# Packages
2020-03-25 20:16:41 +01:00
UTILS="minecraft-launcher polybar checkupdates+aur cli-visualizer mimeo"
2020-03-22 22:19:51 +01:00
DEV="clang-format-linter-git github-cli ktlint"
2020-03-19 16:25:43 +01:00
2020-03-22 22:19:51 +01:00
yay -S --noconfirm --needed "$UTILS $DEV"
2020-03-19 16:25:43 +01:00
2020-03-22 22:19:51 +01:00
}
install_pypi_packages() {
# Packages
PKGS="pynvim msgpack grip virtualenv virtualenvwrapper pipx python-language-server"
pip3 install --user -U "$PKGS"
}
install_npm_packages() {
# NPM
NPM="typescript typescript-language-server nvm"
yarn global add "$NPM"
2020-03-09 17:06:32 +01:00
}
2020-03-15 19:54:06 +01:00
install_st() {
2020-03-22 22:19:51 +01:00
cd "$CACHE" || exit
2020-03-17 15:02:47 +01:00
rm -rf st
2020-03-12 20:55:48 +01:00
git clone https://github.com/samedamci/st
2020-03-22 22:19:51 +01:00
cd st || exit
sudo make clean install
2020-03-15 19:54:06 +01:00
}
install_dmenu() {
2020-03-22 22:19:51 +01:00
cd "$CACHE" || exit
2020-03-17 15:02:47 +01:00
rm -rf dmenu
2020-03-14 22:39:25 +01:00
git clone https://github.com/samedamci/dmenu
2020-03-22 22:19:51 +01:00
cd dmenu || exit
2020-03-14 22:39:25 +01:00
sudo make clean install
}
2020-03-22 22:19:51 +01:00
configure_pacman() {
su root -c "cat >/etc/pacman.conf <<EOF
# /etc/pacman.conf
2020-03-15 19:54:06 +01:00
2020-03-22 22:19:51 +01:00
# See the pacman.conf(5) manpage for option and repository directives
# GENERAL OPTIONS
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
ILoveCandy
TotalDownload
CheckSpace
VerbosePkgLists
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
#[multilib]
#Include = /etc/pacman.d/mirrorlist
EOF"
}
2020-03-22 22:19:51 +01:00
configure_udiskie() {
sudo mkdir /media
su root -c "echo 'ENV{ID_FS_USAGE}==\"filesystem|other|crypto\", ENV{UDISKS_FILESYSTEM_SHARED}=\"1\"' > /etc/udev/rules.d/99-udisks2.rules && echo 'D /media 0755 root root 0 -' > /etc/tmpfiles.d/media.conf"
}
copy_configs() {
2020-03-22 22:19:51 +01:00
# .config dir
cd ~/Dotfiles/botfiles/.config || exit
cp -r * ~/.config/
if [ "$HOSTNAME" = "pc" ]; then
echo "Use pc config..."
mv ~/.config/polybar/config.pc ~/.config/polybar/config
mv ~/.config/sxhkd/sxhkdrc.pc ~/.config/sxhkd/sxhkdrc
elif [ "$HOSTNAME" = "laptop" ]; then
echo "Use laptop config..."
mv ~/.config/polybar/config.laptop ~/.config/polybar/config
mv ~/.config/sxhkd/sxhkdrc.laptop ~/.config/sxhkd/sxhkdrc
fi
2020-03-08 11:37:23 +01:00
rm -rf ~/.config/sxhkd/sxhkdrc.*
rm -rf ~/.config/polybar/config.*
2020-03-22 22:19:51 +01:00
# Telegram bindings
cd ~/Dotfiles/botfiles || exit
mkdir -p ~/.local/share/TelegramDesktop/tdata/
cp shortcuts-custom.json ~/.local/share/TelegramDesktop/tdata
2020-03-22 22:19:51 +01:00
# Configs in home dir
2020-03-17 18:16:43 +01:00
cp .zshrc .bash_profile .bashrc .profile .shellrc .zprofile .Xresources .xinitrc ~/
2020-03-22 22:19:51 +01:00
# Scripts
cp -r .scripts/* ~/.scripts
2020-03-22 22:19:51 +01:00
cd ~/.scripts/ || exit
2020-03-11 21:50:49 +01:00
rm -rf rofi-keepassxc
git clone https://github.com/samedamci/rofi-keepassxc
2020-03-16 16:01:18 +01:00
rm -rf mpdmenu
git clone https://github.com/samedamci/mpdmenu
rm -rf rofi-todo
git clone https://github.com/samedamci/rofi-todo
2020-03-23 20:05:09 +01:00
rm -rf kaomoji-rofi
git clone https://gitlab.com/ceda_ei/kaomoji-rofi
2020-04-09 21:38:36 +02:00
rm -rf blaze
git clone https://gitlab.com/Cherrry9/blaze
chmod +x ~/.scripts/*
2020-03-22 22:19:51 +01:00
# Zsh plugins
cd ~/.config/zsh || exit
rm -rf plugins
mkdir plugins
2020-03-22 22:19:51 +01:00
cd plugins || exit
git clone https://github.com/zsh-users/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions
}
sudo -v
greeter
2020-03-22 22:19:51 +01:00
printf "\nDo you want to install packages from repo? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing repo packages"; install_repo_packages &>$LOG_DIR/install_repo_packages.log
fi
2020-03-22 22:19:51 +01:00
greeter
2020-03-22 22:19:51 +01:00
printf "\nDo you want to install packages from AUR? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing AUR packages"; install_aur_packages &>$LOG_DIR/install_aur_packages.log
fi
2020-03-22 22:19:51 +01:00
greeter
2020-03-22 22:19:51 +01:00
printf "\nDo you want to install packages from PyPI? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing PyPI packages"; install_pypi_packages &>$LOG_DIR/install_pypi_packages.log
fi
2020-03-22 22:19:51 +01:00
greeter
2020-03-22 22:19:51 +01:00
printf "\nDo you want to install packages from NPM? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing NPM packages"; install_npm_packages &>$LOG_DIR/install_npm_packages.log
fi
2020-03-22 22:19:51 +01:00
greeter
2020-03-23 20:53:17 +01:00
printf "\nDo you want to build and install st fork? (y/n): "; read CHOICE
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing st..."; install_st &>$LOG_DIR/install_st.log
fi
2020-03-22 22:19:51 +01:00
greeter
printf "\nDo you want to build and install dmenu fork? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Installing dmenu..."; install_dmenu &>/$LOG_DIR/install_dmenu.log
fi
2020-03-22 22:19:51 +01:00
greeter
printf "\nDo you want to configure pacman? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Configuring pacman..."; configure_pacman
fi
2020-03-22 22:19:51 +01:00
greeter
printf "\nDo you want to configure udiskie? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
echo "Configuring udiskie..."; configure_udiskie
fi
greeter
2020-03-22 22:19:51 +01:00
printf "\nDo you want to copy configs? (y/n): "; read CHOICE
2020-03-23 20:53:17 +01:00
if [ "$CHOICE" = "Y" ] || [ "$CHOICE" = "y" ]; then
2020-03-22 22:19:51 +01:00
printf "Moving configs..."
copy_configs &>$LOG_DIR/copy_configs.log
printf "\n"
chsh -s /usr/bin/zsh
fi
2020-03-22 22:19:51 +01:00
clear