.dotfiles/dotman
2020-03-13 20:21:00 +01:00

181 lines
5.0 KiB
Bash
Executable File

#!/usr/bin/env sh
greeter() {
cat <<EOF
_ _
__| | ___ | |_ _ __ ___ __ _ _ __
/ _\` |/ _ \\| __| '_ \` _ \ / _\` | '_ \
| (_| | (_) | |_| | | | | | (_| | | | |
\__,_|\___/ \__|_| |_| |_|\__,_|_| |_|
EOF
}
# Logs
LOG_DIR="$HOME/.log/dotfiles/$(date +"%d-%m-%Y-%H:%M:%S")/"
mkdir -p $LOG_DIR
install_yay() {
sudo pacman -S --noconfirm --needed git
mkdir -p ~/.cache/dotfiles/
cd ~/.cache/dotfiles/
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
}
install_packages() {
yay -S --noconfirm --needed reflector
sudo reflector --latest 200 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
yay -S --noconfirm --needed neovim qutebrowser telegram-desktop minecraft-launcher dunst bspwm sxhkd htop mpd ncmpcpp picom ranger rofi transmission-cli vlc zsh youtube-dl grc curl wget dmenu xclip figlet w3m xorg-server xorg-xinit ttf-font-awesome ttf-dejavu vifm feh xorg-xsetroot lxappearance python-pip alsa-utils tmux networkmanager maim fzf exfat-utils fuse2 udiskie udisks2 imagemagick i3lock-color man checkupdates+aur pacman-contrib polybar ccls clang eslint flake8 shellcheck clang-format-linter-git prettier python-black github-cli ncdu mpc neomutt bc cli-visualizer clipmenu
pip3 install --user -U pynvim msgpack
sudo pip install -U grip
}
install_st() {
cd ~/.cache/dotfiles/
git clone https://github.com/samedamci/st
cd st
sudo make clean install
}
config_pacman() {
su root -c "cat >/etc/pacman.conf <<EOF
#
# /etc/pacman.conf
#
# 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"
}
copy_configs() {
cd ~/Dotfiles/botfiles/.config
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
cd ~/Dotfiles/botfiles
mkdir -p ~/.local/share/TelegramDesktop/tdata/
cp shortcuts-custom.json ~/.local/share/TelegramDesktop/tdata
cp .zshrc .aliases .zprofile .Xresources .xinitrc ~/
cp -r .scripts ~/
cd ~/.scripts/
rm -rf rofi-keepassxc
git clone https://github.com/samedamci/rofi-keepassxc
chmod +x ~/.scripts/*
cd ~/.config/zsh
rm -rf plugins
mkdir plugins
cd plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions
sudo mkdir /media
}
sudo -v
clear
greeter
printf "\nDo you want to install yay? (Y/n): "; read CHOICE
if [ "$CHOICE" = "Y" ]; then echo "Installing yay..." && install_yay &>$LOG_DIR/install_yay.log; fi
clear
greeter
printf "\nDo you want to install packages? (Y/n): "; read CHOICE
if [ "$CHOICE" = "Y" ]; then echo "Installing packages..." && install_packages &>$LOG_DIR/install_packages.log; fi
clear
greeter
printf "\nDo you want to compile nad install st? (Y/n): "; read CHOICE
if [ "$CHOICE" = "Y" ]; then echo "Compiling and nstalling st..." && install_st &>$LOG_DIR/install_st.log; fi
clear
greeter
printf "\nDo you want to copy configs? (Y/n): "; read CHOICE
if [ "$CHOICE" = "Y" ]; then
printf "Moving configs...\n"
copy_configs &>$LOG_DIR/copy_configs.log
printf "\n"
chsh -s /usr/bin/zsh
printf "\nConfiguring udiskie.\n"
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"
printf "\nConfiguring pacman.\n"
config_pacman
fi
clear
greeter