Improved install scripts

Due to unforeseen events :/
This commit is contained in:
Geoffrey Frogeye 2020-01-05 15:06:23 +01:00
parent 8ec06d3618
commit 73cbcbb3f5
9 changed files with 176 additions and 96 deletions

View File

@ -9,5 +9,6 @@ pulsectl==18.8.0
pyinotify==0.9.6
python-mpd2==1.0.0
python-uinput==0.11.2
taskw==1.2.0
yoke==0.1.1
zeroconf==0.21.3

View File

@ -10,7 +10,7 @@
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "~/Musiques"
music_directory "~/Musique"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use

View File

@ -10,8 +10,11 @@ then
exit 1
fi
# TODO Verify if scheme is known
mkdir -p $HOME/.local/bin
# Shell (allows to use all colors in Vim while still having nice colors in the rest of the terminal)
curl "https://raw.githubusercontent.com/chriskempson/base16-shell/master/scripts/base16-${scheme}.sh" > ~/.local/bin/colorSchemeApply
chmod +x ~/.local/bin/colorSchemeApply
@ -20,6 +23,7 @@ chmod +x ~/.local/bin/colorSchemeApply
curl "https://raw.githubusercontent.com/chriskempson/base16-xresources/master/xresources/base16-${scheme}-256.Xresources" > ~/.config/Xresources/theme
# Vim
mkdir -p $HOME/.cache/vim
echo -e "let base16colorspace=256\n\"set termguicolors\ncolorscheme base16-${scheme}" > ~/.cache/vim/colorscheme.vim
# FZF
@ -27,16 +31,16 @@ curl "https://raw.githubusercontent.com/nicodebo/base16-fzf/master/bash/base16-$
chmod +x ~/.local/bin/colorSchemeApplyFzf
# qutebrowser
curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/4a17eea8a39f722c2cee95fb44d4a87f5eb2518f/themes/base16-${scheme}.config.py" > ~/.config/qutebrowser/theme.py
mkdir -p $HOME/.config/qutebrowser
curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/master/themes/base16-${scheme}.config.py" > ~/.config/qutebrowser/theme.py
# rofi
mkdir -p $HOME/.config/rofi
curl "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-${scheme}.rasi" > ~/.config/rofi/theme.rasi
curl "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-${scheme}.config" > ~/.config/rofi/theme.config
# qutebrowser
curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/master/themes/base16-${scheme}.config.py" > ~/.config/qutebrowser/theme.py
# Tridactyl
mkdir -p $HOME/.config/tridactyl/themes
curl "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-${scheme}.css" > ~/.config/tridactyl/themes/theme.css
# TODO dunst (template online, but not to my liking)

View File

@ -17,6 +17,7 @@ CACHE_DIR="${XDG_CACHE_DIR:-$HOME/.cache}/installSoftware"
INSTALLERS_DIR="${CACHE_DIR}/installers"
INSTALLERS_LIST="${CACHE_DIR}/installers.list"
# TODO Package groups
# INSTALLER SPECIFIC FUNCTIONS
@ -84,7 +85,7 @@ installable_aur() {
}
installable_Rpacman() {
pacman -Ss "$1" > /dev/null
pacman -Si "$1" &> /dev/null
}
installable_Ryay() {

View File

@ -1,105 +1,157 @@
#!/usr/bin/env bash
# Setups an Arch Linux system the way I like it
# (requires sudo)
if ! which pacman &> /dev/null; then
echo "This is not an Arch Linux system (or pacman isn't installed)"
exit 1
fi
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
# Don't ask for things that are already there
if which aurman &> /dev/null; then
AURMAN=1
fi
if [ -z $AURMAN ]; then
prompt "Do you want aurman on this machine?"
AURMAN=$?
fi
# COMMON
# Install packages if they aren't installed
function inst {
# Could also use --needed but, meh
for pkg in $*; do
pacman -Q $pkg &> /dev/null
if [ $? == 1 ]; then
sudo pacman -S $pkg --noconfirm
fi
done
}
# Install package from PKGBUILD file
function installPKGBUILD { # url
# TODO Download snapshots
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si --noconfirm
cd -
rm -rf "$TMP_DIR"
}
# SYSTEM
inst wget
# Aur
pacman -Q aurman &> /dev/null
if [[ $AURMAN == 1 && $? == 1 ]]; then
gpg --recv-keys 465022E743D71E39
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=aurman"
fi
# Git for /etc
inst etckeeper
sudo etckeeper init
sudo pacman -S etckeeper --needed
(cd /etc/; sudo git config user.name "etckeeper on $(cat /etc/hostname)"; sudo git config user.email "etckeeper@$(cat /etc/hostname)")
sudo etckeeper commit "~/.dotfiles/scripts/install-arch commit"
[ ! -d /etc/.git ] && sudo etckeeper init
sudo etckeeper commit "install-arch script: begin"
# Install yay
if ! pacman -Q yay &> /dev/null
then
mkdir -p $HOME/.cache/yay/yay
cd $HOME/.cache/yay/yay
curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz | tar xzvf
makepkg -si
fi
# Keyboard layout
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us_qwerty-fr"
EndSection
' | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
# Backlight (for Intel Devices)
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "Backlight" "intel_backlight"
EndSection
' | sudo tee /etc/X11/xorg.conf.d/20-intel.conf
# Touchpad
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
EndSection
' | sudo tee /etc/X11/xorg.conf.d/30-touchpad.conf
# Disable joystick as mouse
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
Section "InputClass"
Identifier "joystick catchall"
MatchIsJoystick "on"
MatchDevicePath "/dev/input/event*"
Driver "joystick"
Option "StartKeysEnabled" "False" #Disable mouse
Option "StartMouseEnabled" "False" #support
EndSection
' | sudo tee /etc/X11/xorg.conf.d/50-joystick.conf
# Install same rules with nvidia-xrun
if -d /etc/X11/nvidia-xorg.conf
then
function link { # filename
ln -s /etc/X11/nvidia-xorg.conf/$1 ../xorg.conf.d/$1
}
link 00-keyboard.conf
link 20-intel.conf # Yep
link 30-touchpad.conf
link 50-joystick.conf
fi
# Uninstall Manjaro's pamac
if pacman -Q pamac &> /dev/null ; then
if pacman -Q pamac &> /dev/null
then
sudo pacman -Rsc pamac --noconfirm
fi
# Ccache
inst ccache
sudo pacman -S ccache --needed
sudo sed 's|BUILDENV=\(.\+\)!ccache\(.\+\)|BUILDENV=\1ccache\2|' /etc/makepkg.conf -i
# Makepkg config
sudo sed 's|BUILDENV=\(.\+\)!color\(.\+\)|BUILDENV=\1color\2|' /etc/makepkg.conf -i
# Pacman config
sudo sed 's|#Color|Color\nILoveCandy|' /etc/pacman.conf -i
# TLP
inst tlp
sudo sed 's|SATA_LINKPWR_ON_BAT=min_power|SATA_LINKPWR_ON_BAT=max_performance|' /etc/default/tlp -i
sudo systemctl enable tlp.service tlp-sleep.service
sudo pacman -S tlp --needed
# sudo sed 's|SATA_LINKPWR_ON_BAT=min_power|SATA_LINKPWR_ON_BAT=max_performance|' /etc/default/tlp -i
sudo systemctl enable tlp.service tlp-sleep.service --now
sudo systemctl disable systemd-rfkill.service systemd-rfkill.socket
sudo tlp start
# Numlock on boot
echo -e "[Service]\nExecStartPre=/bin/sh -c 'setleds +num < /dev/%I'" | sudo systemctl edit getty\@.service
echo "# File wrote by ~/.dotfiles/config/scripts/install-arch
[Service]
ExecStartPre=/bin/sh -c 'setleds +num < /dev/%I'
" | sudo tee /etc/systemd/system/getty@.service.d/override.conf
# Makeflags
sudo sed "s|#MAKEFLAGS=\"-j2\"|MAKEFLAGS=\"-j$(nproc)\"|" /etc/makepkg.conf -i
# I'd rather have updates not take my whole CPU
# sudo sed "s|#MAKEFLAGS=\"-j2\"|MAKEFLAGS=\"-j$(nproc)\"|" /etc/makepkg.conf -i
# DHCPCD
sudo pacman -S dhcpcd --needed
sudo systemctl enable dhcpcd --now
# Time synchronisation
inst ntp
sudo systemctl start ntpd
sudo systemctl enable ntpd
sudo pacman -S chrony --needed
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
# MANUAL
server 0.europe.pool.ntp.org offline
server 1.europe.pool.ntp.org offline
server 2.europe.pool.ntp.org offline
server 3.europe.pool.ntp.org offline
driftfile /etc/chrony.drift
rtconutc
rtcsync' | sudo tee /etc/chrony.conf
sudo systemctl enable chronyd --now
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
# Hibernation
# Add resume=UUID=<UUID-of-swap-partition> to GRUB_CMDLINE_LINUX_DEFAULT and run `sudo grub-mkconfig -o /boot/grub/grub.cfg`
if $if_up; then
chronyc online
elif $if_down; then
chronyc offline
fi
' | sudo tee /etc/dhcpcd.exit-hook
# Grub other OS
sudo pacman -S os-prober --needed
sudo grub-mkconfig -o /boot/grub/grub.cfg
# Manual
echo '
# Hibernation:
sudo blkid | grep 'TYPE="swap"'
sudoedit /etc/default/grub
# Add resume=UUID=<UUID-of-swap-partition> to GRUB_CMDLINE_LINUX_DEFAULT
sudo grub-mkconfig -o /boot/grub/grub.cfg
'
echo '
# wpa_supplicant (Wi-Fi)
sudo pacman -S wpa_supplicant
ip link
[ ! -f /etc/wpa_supplicant/wpa_supplicant.conf ] && wpa_passphrase 'DUMMY' 'JustToHaveAConfigFiel' > /etc/wpa_supplicant/wpa_supplicant.conf
# Replace wlo1 with the correct interface
sudo systemctl start wpa_supplicant@wlo1.service
sudo ln -s wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlo1.conf
'
sudo etckeeper commit "install-arch script: end"

View File

@ -6,13 +6,17 @@
# This holds stuff that have not been migrated yet.
# TODO A lot of stuff
cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1
. softwareList
mkdir -p $HOME/.cache
mkdir -p $HOME/.cache/zsh
mkdir -p $HOME/.cache/mpd
mkdir -p $HOME/.ssh
. $HOME/.config/scripts/softwareList
echo "Doing stuff cuz"
$HOME/.config/Xresources/configure
changeColors monokai
pip install --user --requirement $HOME/.config/lemonbar/requirements.txt
vim +PlugUpgrade +PlugUpdate +PlugInstall +qall
### RECYCLE BIN

View File

@ -50,12 +50,17 @@ urldecode() { # string
function _machines-api {
route=$1
shift
wget "$MACHINES_API/$route" --content-on-error --quiet --output-document=- "$@"
temp=$(mktemp)
wget "$MACHINES_API/$route" --content-on-error --quiet --output-document=$temp "$@"
result=$?
if [ $result != 0 ]; then
echo "[ERROR] wget returned $result for route $route" 1>&2;
cat $temp 1>&2;
rm $temp
exit 2
fi
cat $temp
rm $temp
}
function _machines-apiToken {

View File

@ -4,7 +4,6 @@
# Oh and it asks the category you want to install on
# the running machine too.
# TODO Not really tested in conditions
# TODO Not tested with Debian derivate
# TODO Not tested on home folder
@ -61,7 +60,7 @@ uservar INSTALL_VIDEO "Play/edit videos?"
echo "(you can change those answers later in $CONFIG_FILE)"
# Preparing installers
. ./installSoftware
. $HOME/.config/scripts/common/installSoftware
resetInstallers
$SUPERUSER && addSystemInstallers
@ -120,6 +119,7 @@ i pv # Allow to show progress in pipe
i progress # Show progress of functions
# Network utilities
i openssh # SSH connections
i proxytunnel # Proxy connections through HTTPS
i curl # Transfer URL
i wget # Download URL
@ -177,6 +177,8 @@ then
i optipng # Optimize PNG files
i jpegtran libjpeg-turbo # Compress JPEG files
i reflac # Recompress FLAC files
i pacman-contrib # Pactree and more
i shred # Delete sensititve data
fi
@ -188,6 +190,7 @@ i git
if $INSTALL_DEV
then
# Misc/Reusable
i man # Documentation
i strace # Tracer
i ctags universal-ctags exuberant-ctags # Tags generator
@ -221,6 +224,7 @@ if $INSTALL_UTILITIES
then
i visidata # CSV file reader
i insect # Unit calculator
i zbar # Read QR codes
fi
@ -248,7 +252,8 @@ fi
if $INSTALL_MUSIC
then
i mpv # Audio/Video player
i puddletag # Musig tag editor
i puddletag-qt5-git puddletag # Musig tag editor
# (remove -qt5 once it has been merged upstream)
i mpd # Music player daemon
i mpc # CLI MPD client
i vimpc-git # CLI UI MPD client
@ -274,10 +279,20 @@ fi
if $INSTALL_GUI
then
i firefox # Web browser
i firefox-dark-reader # Firefox extension: dark theme everywhere
i firefox-decentraleyes # Firefox extension: fetch CDN resources locally
i firefox-tridactyl # Firefox extension: Navigate with keyboard
i firefox-ublock-origin # Firefox extension: Ad and tracker blocker
# I still need to download manually: container extensions, No Tab
i xkb-qwerty-fr # French QWERTY disposition
i thunar # Directory browser (just in case)
i gedit # Visual editor (just in case)
i feh # Background / Image viewer
i zathura && i zathura-pdf-mupdf # PDF viewer
i ttf-twemoji # Emoji fonts
i sox # For beeps and stuff
i meld # For comparison
if $INSTALL_X
then
@ -287,6 +302,7 @@ then
i numlockx # Numlock auto-unlock
i rofi # HUD selector
i rxvt-unicode # Terminal emulator
i urxvt-resize-font-git # Resize fonts for urxvt
i scrot # Screenshot taker
i trayer # Tray icons (just in case)
i unclutter # Auto mask mouse

View File

@ -86,9 +86,6 @@ set searchurls.yt https://www.youtube.com/results?search_query=%s
" Firefox GUI
" This can still be shown with F6!
guiset_quiet gui none
" Thse don't seem to be affected by "gui"
guiset_quiet hoverlink none
guiset_quiet statuspanel none
" Never autofocus
set allowautofocus false