diff --git a/.bash_profile b/.bash_profile index f318769..56b2f93 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,3 +1,3 @@ #!/bin/bash -[[ -f ~/.profile ]] && . ~/.profile +[[ -f "$HOME/.profile" ]] && . "$HOME/.profile" diff --git a/.bashrc b/.bashrc index 087052d..10dd428 100644 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -[[ -f ~/.shrc ]] && . ~/.shrc +[[ -f "$HOME/.shrc" ]] && . "$HOME/.shrc" # If not running interactively, don't do anything [[ $- != *i* ]] && return diff --git a/.config/samba/smb.conf b/.config/samba/smb.conf new file mode 100644 index 0000000..209022a --- /dev/null +++ b/.config/samba/smb.conf @@ -0,0 +1,15 @@ +[global] + server string = %h + use sendfile = yes + min receivefile size = 16384 + +[homes] + writable = yes + +[printers] + guest ok = yes + printable = yes + +[media] + path = /media + writable = yes diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index ed466b2..8840b58 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -1 +1,3 @@ -[ -f $HOME/.profile ] && source $HOME/.profile +#!/usr/bin/env zsh + +[[ -f "$HOME/.profile" ]] && source "$HOME/.profile" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 8594536..053d5b6 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,4 +1,6 @@ -[ -f $HOME/.shrc ] && source $HOME/.shrc +#!/usr/bin/env zsh + +[[ -f "$HOME/.shrc" ]] && source "$HOME/.shrc" # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. # Initialization code that may require console input (password prompts, [y/n] @@ -24,19 +26,8 @@ zmodload zsh/complist compinit _comp_options+=(globdots) # Include hidden files. -# vi mode -bindkey -v -export KEYTIMEOUT=1 - -# Use vim keys in tab complete menu: -bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'k' vi-up-line-or-history -bindkey -M menuselect 'l' vi-forward-char -bindkey -M menuselect 'j' vi-down-line-or-history -bindkey -v '^?' backward-delete-char - # Change cursor shape for different vi modes. -function zle-keymap-select { +zle-keymap-select() { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne '\e[1 q' @@ -56,38 +47,30 @@ zle -N zle-line-init echo -ne '\e[5 q' # Use beam shape cursor on startup. preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. -# Use lf to switch directories and bind it to ctrl-o -lfcd () { +# Use lf to switch directories +lfcd() { tmp="$(mktemp)" lf -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then + if [[ -f "$tmp" ]]; then dir="$(cat "$tmp")" rm -f "$tmp" - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + [[ -d "$dir" ]] && [[ "$dir" != "$(pwd)" ]] && cd "$dir" fi } -bindkey -s '^o' 'lfcd\n' -# Edit line in vim with ctrl-e: -autoload edit-command-line; zle -N edit-command-line -bindkey '^e' edit-command-line +# Edit line in vim +autoload edit-command-line +zle -N edit-command-line # fzf -[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh -[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh +[[ -f "/usr/share/fzf/completion.zsh" ]] && source "/usr/share/fzf/completion.zsh" +[[ -f "/usr/share/fzf/key-bindings.zsh" ]] && source "/usr/share/fzf/key-bindings.zsh" # Plugins -source $ZDOTDIR/plugins.zsh - -# zsh-history-substring-search -bindkey '^[[A' history-substring-search-up -bindkey '^[[B' history-substring-search-down -bindkey -M vicmd 'k' history-substring-search-up -bindkey -M vicmd 'j' history-substring-search-down +source "$ZDOTDIR/plugins.zsh" -# zsh-autosuggestions -bindkey '^ ' autosuggest-accept -bindkey '^@' autosuggest-accept +# Key bindings +[[ ! -f "$ZDOTDIR/key-bindings.zsh" ]] || source "$ZDOTDIR/key-bindings.zsh" # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. -[[ ! -f $ZDOTDIR/p10k.zsh ]] || source $ZDOTDIR/p10k.zsh +[[ ! -f "$ZDOTDIR/p10k.zsh" ]] || source "$ZDOTDIR/p10k.zsh" diff --git a/.config/zsh/key-bindings.zsh b/.config/zsh/key-bindings.zsh new file mode 100644 index 0000000..e5a3bd8 --- /dev/null +++ b/.config/zsh/key-bindings.zsh @@ -0,0 +1,41 @@ +# vi mode +bindkey -v +export KEYTIMEOUT=1 + +# Use vim keys in tab complete menu: +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -v '^?' backward-delete-char + +# Use lf to switch directories +bindkey -s '^o' 'lfcd\n' + +# Edit line in vim +bindkey '^e' edit-command-line + +# fzf - Paste the selected file path(s) into the command line +bindkey -M emacs '^T' fzf-file-widget +bindkey -M vicmd '^T' fzf-file-widget +bindkey -M viins '^T' fzf-file-widget + +# fzf - cd into the selected directory +bindkey -M emacs '\ec' fzf-cd-widget +bindkey -M vicmd '\ec' fzf-cd-widget +bindkey -M viins '\ec' fzf-cd-widget + +# fzf - Paste the selected command from history into the command line +bindkey -M emacs '^R' fzf-history-widget +bindkey -M vicmd '^R' fzf-history-widget +bindkey -M viins '^R' fzf-history-widget + +# zsh-history-substring-search +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down + +# zsh-autosuggestions +bindkey '^ ' autosuggest-accept +bindkey '^@' autosuggest-accept diff --git a/.config/zsh/plugins.zsh b/.config/zsh/plugins.zsh index 3314ca1..b037536 100644 --- a/.config/zsh/plugins.zsh +++ b/.config/zsh/plugins.zsh @@ -1,38 +1,24 @@ -# plugins directory -ZPLUGINDIR=$HOME/.local/share/zsh/plugins -[ -d $ZPLUGINDIR ] || mkdir -p $ZPLUGINDIR +ZPLUGINDIR="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins" +[[ -d "$ZPLUGINDIR" ]] || mkdir -p "$ZPLUGINDIR" -# antidote.lite loader -if [[ ! -d $ZPLUGINDIR/zsh_unplugged ]]; then - git clone --quiet https://github.com/mattmc3/zsh_unplugged $ZPLUGINDIR/zsh_unplugged +if [[ ! -d "$ZPLUGINDIR/zsh_unplugged" ]]; then + git clone --quiet https://github.com/mattmc3/zsh_unplugged "$ZPLUGINDIR/zsh_unplugged" fi -source $ZPLUGINDIR/zsh_unplugged/zsh_unplugged.zsh - repos=( - # load order! romkatv/powerlevel10k + # deferred romkatv/zsh-defer - zsh-users/zsh-history-substring-search zsh-users/zsh-autosuggestions - - #zsh-users/zsh-syntax-highlighting zdharma-continuum/fast-syntax-highlighting ) -# Load all plugins +# antidote.lite loader +source "$ZPLUGINDIR/zsh_unplugged/antidote.lite.zsh" +plugin-clone $repos plugin-load $repos plugins-update() { plugin-update $repos } - -plugins-list() { - ls $ZPLUGINDIR -} - -plugins-clean() { - rm -rfi $ZPLUGINDIR - exec zsh -} diff --git a/.local/bin/alhp-install b/.local/bin/alhp-install deleted file mode 100755 index 5ffd9d4..0000000 --- a/.local/bin/alhp-install +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi - - -ARCH="" - -if ! [ -f "/lib/ld-linux-x86-64.so.2" ]; then - echo "Not supported" - exit 1 -fi - -if /lib/ld-linux-x86-64.so.2 --help | grep -q 'x86-64-v3 (supported, searched)'; then ARCH='x86-64-v3' -elif /lib/ld-linux-x86-64.so.2 --help | grep -q 'x86-64-v2 (supported, searched)'; then ARCH='x86-64-v2' -else echo "Architecture is not supported"; exit 1 -fi - -echo "Supported architecture: $ARCH" - -# shellcheck disable=SC2068 -aur_install() { - if [ -x "$(command -v paru)" ]; then - paru -Sy --noconfirm --needed --sudoloop --skipreview $@ - return $? - elif [ -x "$(command -v yay)" ]; then - yay -Sy --noconfirm --needed --sudoloop $@ - return $? - else - sudo pacman -Sy --noconfirm --needed git base-devel || return 1 - - for package in $@; do - git clone https://aur.archlinux.org/"$package".git || return 1 - cd "$package" || return 1 - makepkg -cis --noconfirm --needed || return 1 - cd .. - rm -rdf "$package" - done - fi -} - -ALHP_PACKAGES="alhp-keyring alhp-mirrorlist" - -# shellcheck disable=SC2086 -if ! pacman -Q $ALHP_PACKAGES > /dev/null 2>&1; then - if ! aur_install "$ALHP_PACKAGES"; then - echo "Can't install: $ALHP_PACKAGES" - exit 1 - fi -fi - - -PACMAN_CONF="/etc/pacman.conf" - -grep -qxF "[core-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[core\]/i [core-$ARCH]\nInclude = /etc/pacman.d/alhp-mirrorlist\n" $PACMAN_CONF -grep -qxF "[extra-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[extra\]/i [extra-$ARCH]\nInclude = /etc/pacman.d/alhp-mirrorlist\n" "$PACMAN_CONF" -grep -qxF "[multilib-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[multilib\]/i [multilib-$ARCH]\nInclude = /etc/pacman.d/alhp-mirrorlist\n" "$PACMAN_CONF" - - -sudo pacman -Suy --noconfirm -echo "alhp-install done." diff --git a/.local/bin/dotfiles-post-install b/.local/bin/dotfiles-post-install deleted file mode 100755 index 3006a81..0000000 --- a/.local/bin/dotfiles-post-install +++ /dev/null @@ -1,332 +0,0 @@ -#!/bin/sh - - -NOCONFIRM=false - -_confirm() { - if $NOCONFIRM; then - return 0 - fi - - while true; do - printf '%s ' "$1" - read -r yn - case ${yn:-"$2"} in - [Yy]* ) return 0;; - [Nn]* ) return 1;; - * ) echo "Please answer yes or no.";; - esac - done -} - -confirm() { - _confirm "$1 [y/n]" -} - -confirm_yes() { - _confirm "$1 [Y/n]" "Y" -} - -confirm_no() { - _confirm "$1 [y/N]" "N" -} - - -# -# confirm -# - -confirm_yes "Want to continue?" || exit 0 - -if confirm_no "Run everything without confirmation?"; then - NOCONFIRM=true -else - NOCONFIRM=false -fi - - -# -# symlinks -# - -_symlink() { - [ "$(readlink -f "$2")" = "$1" ] && return 0 - - if [ -f "$2" ]; then - echo "File $2 already exists, can't create symlink to $1" - return 1 - fi - - echo "Creating symlink $2 > $1" - confirm_yes "Create $2 symlink?" && $3 ln -s "$1" "$2" - return $? -} - -symlink() { - _symlink "$1" "$2" - return $? -} - -sudo_symlink() { - _symlink "$1" "$2" sudo - return $? -} - - -# -# package manager -# - -PACKAGE_MANAGER=false - -if [ -x "$(command -v pacman)" ]; then - PACKAGE_MANAGER="pacman" -elif [ -x "$(command -v apk)" ]; then - PACKAGE_MANAGER="apk" -elif [ -x "$(command -v apt-get)" ]; then - PACKAGE_MANAGER="apt-get" -else - echo "WARNING: Supported package manager not found." -fi - -pkg_update() { - case $PACKAGE_MANAGER in - "pacman") sudo pacman -Sy ;; - "apk") sudo apk update ;; - "apt-get") sudo apt-get update ;; - *) return 1 - esac - return $? -} - -# shellcheck disable=SC2068 -pkg_install() { - case $PACKAGE_MANAGER in - "pacman") sudo pacman -S --noconfirm --needed $@ ;; - "apk") sudo apk add $@ ;; - "apt-get") sudo apt-get install -y $@ ;; - *) return 1 - esac - return $? -} - - -AUR_PACKAGE_MANAGER=false - -if [ "$PACKAGE_MANAGER" = "pacman" ]; then - if [ -x "$(command -v paru)" ]; then - AUR_PACKAGE_MANAGER="paru" - elif [ -x "$(command -v yay)" ]; then - AUR_PACKAGE_MANAGER="yay" - else - echo "WARNING: Supported AUR package manager not found." - fi -fi - -# shellcheck disable=SC2068 -aur_install() { - # check binary cache - if pacman -Si $@ > /dev/null 2>&1; then - sudo pacman -S --noconfirm --needed $@ - return $? - fi - - case $AUR_PACKAGE_MANAGER in - "paru") paru -S --noconfirm --needed --sudoloop --skipreview $@ ;; - "yay") yay -S --noconfirm --needed --sudoloop $@ ;; - *) return 1 - esac - return $? -} - - -DO_PKG_UPDATE=true - -install() { - if [ $PACKAGE_MANAGER = false ]; then - echo "Supported package manager not found." - echo "Can't install: $*" - return 1 - fi - - if [ $DO_PKG_UPDATE = true ]; then - echo "Update $PACKAGE_MANAGER cache" - - if pkg_update; then - DO_PKG_UPDATE=false - else - echo "Can't update $PACKAGE_MANAGER cache" - return 1 - fi - fi - - if pkg_install "$@"; then - return 0 - else - echo "Can't install: $*" - return 1 - fi -} - - - -# -# start here -# - -# create symlinks - -[ -d "/usr/share/libinput" ] && sudo_symlink "$HOME"/.local/share/libinput/local-overrides.quirks /usr/share/libinput/local-overrides.quirks - - -# packages - -ESSENTIAL_PACKAGES="man-db tldr zsh fzf lf neovim" -NETWORK_PACKAGES="bind nmap iperf3 proxychains-ng youtube-dl" - -MULTIMEDIA_PACKAGES="mpv gimp" -KDE_EXTRA_PACKAGES="partitionmanager gwenview okular spectacle kcalc dolphin-plugins kio-gdrive krfb ktorrent kdeconnect kmail" - -run_packages() { - - # Essential packages - confirm_yes "Install essential packages ($ESSENTIAL_PACKAGES)?" && install "$ESSENTIAL_PACKAGES" - - # Network packages - confirm_yes "Install network packages ($NETWORK_PACKAGES)?" && install "$NETWORK_PACKAGES" - - # GUI - if [ -n "$XDG_SESSION_TYPE" ] && [ "$XDG_SESSION_TYPE" != "tty" ]; then - - # Multimedia packages - confirm_yes "Install multimedia packages ($MULTIMEDIA_PACKAGES)?" && install "$MULTIMEDIA_PACKAGES" - - # Noto Fonts - confirm_yes "Install Noto Fonts?" && install noto-fonts noto-fonts-cjk noto-fonts-emoji - - # Telegram - confirm_yes "Install Telegram Desktop?" && install telegram-desktop - - # Remmina - confirm_yes "Install Remmina?" && install remmina libvncserver freerdp - - - # Wayland - if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - confirm_yes "Install wl-clipboard?" && install wl-clipboard - fi - - # KDE - if [ "$XDG_CURRENT_DESKTOP" = "KDE" ]; then - confirm_yes "Install KDE extra packages ($KDE_EXTRA_PACKAGES)?" && install "$KDE_EXTRA_PACKAGES" - fi - fi - - # pacman - if [ "$PACKAGE_MANAGER" = "pacman" ]; then - - PARALLEL_DOWNLOADS=10 - confirm_yes "Set parralel downloads to $PARALLEL_DOWNLOADS?" && sudo sed -i "s/ParallelDownloads.*/ParallelDownloads = $PARALLEL_DOWNLOADS/" /etc/pacman.conf - - # AUR package manager - if [ "$AUR_PACKAGE_MANAGER" = false ]; then - if confirm_yes "Install paru?"; then - paru-install && AUR_PACKAGE_MANAGER="paru" - elif confirm_yes "Install yay?"; then - yay-install && AUR_PACKAGE_MANAGER="yay" - fi - fi - - confirm_yes "Install ALHP repo?" && alhp-install - confirm_yes "Install Chaotic repo?" && chaotic-aur-install - confirm_yes "Install archlinuxcn repo?" && archlinuxcn-install - - LINUX_HEADERS="" - - # using archlinux default supported kernels - pacman -Q linux 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-headers" - pacman -Q linux-hardened 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-hardened-headers" - pacman -Q linux-lts 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-lts-headers" - pacman -Q linux-rt 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-rt-headers" - pacman -Q linux-rt-lts 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-rt-lts-headers" - pacman -Q linux-zen 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-zen-headers" - - # broadcom wl dkms - lspci -vnn -d 14e4: | grep -q "wl" > /dev/null && confirm_yes "Install broadcom Wi-Fi drivers?" && install broadcom-wl-dkms "$LINUX_HEADERS" - - # AUR - if [ "$AUR_PACKAGE_MANAGER" != false ]; then - # power managment - if [ -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors" ]; then - # auto-cpufreq - confirm_yes "Install auto-cpufreq?" && aur_install auto-cpufreq - sudo systemctl enable --now auto-cpufreq - fi - - # wluma - if [ -d "/sys/bus/iio/devices/iio:device0" ]; then - confirm_yes "Install wluma?" && aur_install wluma - sudo usermod -a -G video "$(id -u -n)" - systemctl --user enable --now wluma - fi - fi - - - # GUI - if [ -n "$XDG_SESSION_TYPE" ] && [ "$XDG_SESSION_TYPE" != "tty" ]; then - # intel gpu - INTEL_GPU_PACKAGES="libva-utils intel-gpu-tools" - lspci | grep 'VGA.*Intel' > /dev/null && confirm_yes "Install intel gpu utils?" install "$INTEL_GPU_PACKAGES" && vainfo - - # nerd-fonts - NERD_FONTS="ttf-firacode-nerd" - confirm_yes "Install Nerd-Fonts ($NERD_FONTS)?" && install "$NERD_FONTS" - - # spotify - confirm_yes "Install Spotify?" && install spotify-launcher - - # QEMU - QEMU_PACKAGES="qemu-full libvirt virt-manager" - [ -c "/dev/kvm" ] && confirm_yes "Install QEMU?" && install "$QEMU_PACKAGES" - - # AUR - if [ "$AUR_PACKAGE_MANAGER" != false ]; then - # shadowsocks-electron - confirm_yes "Install Shadowsocks electron?" && aur_install shadowsocks-electron-bin - # sonixd - confirm_yes "Install Sonixd?" && aur_install sonixd-bin electron22-bin - fi - fi - fi - - - # bluetooth - if sudo dmesg | grep -i blue > /dev/null && confirm_yes "Install bluetooth?"; then - install bluez bluez-utils - sudo systemctl enable --now bluetooth - fi -} - -[ $PACKAGE_MANAGER != false ] && run_packages - - -# shell - -PREFERED_SHELL="/usr/bin/zsh" - -if [ "$SHELL" != "$PREFERED_SHELL" ] && [ -f "$PREFERED_SHELL" ] && confirm_yes "Current shell is $SHELL, change to $PREFERED_SHELL?"; then - echo "Changing current shell $SHELL to $PREFERED_SHELL" - chsh -s /usr/bin/zsh -fi - - -# mitigations - -if [ -d "/boot/loader/entries/" ]; then - echo "systemd-boot supported, use: 'mitigations [on/off]' to switch kernel boot parameter" -fi - - -# done - -echo "dotfiles-post-install done." diff --git a/.local/bin/paru-install b/.local/bin/paru-install deleted file mode 100755 index c63d7aa..0000000 --- a/.local/bin/paru-install +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi - -sudo pacman -Sy --noconfirm --needed git base-devel || exit 1 -git clone https://aur.archlinux.org/paru-bin.git || exit 1 -cd paru-bin || exit 1 -makepkg -cis --noconfirm --needed || exit 1 -cd .. -rm -rdf paru-bin - -echo "paru-install done." diff --git a/.local/bin/yay-install b/.local/bin/yay-install deleted file mode 100755 index ce0e732..0000000 --- a/.local/bin/yay-install +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi - -sudo pacman -Sy --noconfirm --needed git base-devel || exit 1 -git clone https://aur.archlinux.org/yay-bin.git || exit 1 -cd yay-bin || exit 1 -makepkg -cis --noconfirm --needed || exit 1 -cd .. -rm -rdf yay-bin - -echo "yay-install done." - diff --git a/.profile b/.profile index fa5c7e6..6c01f30 100644 --- a/.profile +++ b/.profile @@ -7,6 +7,8 @@ export HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/history" [ -z "$PATH_ORIG" ] && export PATH_ORIG="$PATH" export PATH="$PATH_ORIG:$HOME/.local/bin" +[ -f "$HOME/.scripts/env" ] && . "$HOME/.scripts/env" + if [ -x "$(command -v nvim)" ]; then export EDITOR="nvim" export VISUAL="nvim" @@ -20,7 +22,3 @@ if [ -f "/usr/bin/ksshaskpass" ]; then export SSH_ASKPASS='/usr/bin/ksshaskpass' export SSH_ASKPASS_REQUIRE=prefer fi - -if [ -x "$(grep -q WSL /proc/sys/kernel/osrelease)" ]; then - export WSL=true -fi diff --git a/.scripts/arch/alhp-install b/.scripts/arch/alhp-install new file mode 100755 index 0000000..a09fa35 --- /dev/null +++ b/.scripts/arch/alhp-install @@ -0,0 +1,32 @@ +#!/bin/sh -e + +if ! [ -f "/lib/ld-linux-x86-64.so.2" ]; then + echo "Architecture is not x86-64." + exit 1 +fi + +ARCH="" + +if /lib/ld-linux-x86-64.so.2 --help | grep -q 'x86-64-v3 (supported, searched)'; then + ARCH='x86-64-v3' +elif /lib/ld-linux-x86-64.so.2 --help | grep -q 'x86-64-v2 (supported, searched)'; then + ARCH='x86-64-v2' +else + echo "Architecture is not supported." + exit 1 +fi + +echo "Supported architecture: $ARCH" + +pkgs sync +pkgs install alhp-keyring alhp-mirrorlist + +PACMAN_CONF="/etc/pacman.conf" +ALHP_MIRRORLIST="/etc/pacman.d/alhp-mirrorlist" + +grep -qxF "[core-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[core\]/i [core-$ARCH]\nInclude = $ALHP_MIRRORLIST\n" $PACMAN_CONF +grep -qxF "[extra-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[extra\]/i [extra-$ARCH]\nInclude = $ALHP_MIRRORLIST\n" "$PACMAN_CONF" +grep -qxF "[multilib-$ARCH]" "$PACMAN_CONF" || sudo sed -i "/^[^#]*\[multilib\]/i [multilib-$ARCH]\nInclude = $ALHP_MIRRORLIST\n" "$PACMAN_CONF" + +sudo pacman -Suy --noconfirm +echo "alhp-install done." diff --git a/.local/bin/archlinuxcn-install b/.scripts/arch/archlinuxcn-install similarity index 72% rename from .local/bin/archlinuxcn-install rename to .scripts/arch/archlinuxcn-install index e44ab8c..0cef304 100755 --- a/.local/bin/archlinuxcn-install +++ b/.scripts/arch/archlinuxcn-install @@ -1,14 +1,7 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi +#!/bin/sh -e PACMAN_CONF="/etc/pacman.conf" - grep -qxF "[archlinuxcn]" "$PACMAN_CONF" || sudo sed -i '$a\\n[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$arch' $PACMAN_CONF - sudo pacman -Sy --noconfirm --needed archlinuxcn-keyring echo "archlinuxcn-install done." diff --git a/.scripts/arch/base-setup b/.scripts/arch/base-setup new file mode 100644 index 0000000..e6547dd --- /dev/null +++ b/.scripts/arch/base-setup @@ -0,0 +1,51 @@ +#!/bin/sh -e + +PACKAGES=" \ +man-db tldr \ +zsh tmux neovim \ +fzf lf \ +" + +PREFERED_SHELL="/usr/bin/zsh" + +pkgs sync +pkgs install "$PACKAGES" + +if [ "$SHELL" != "$PREFERED_SHELL" ] && [ -f "$PREFERED_SHELL" ]; then + echo "Changing current shell $SHELL to $PREFERED_SHELL" + chsh -s "$PREFERED_SHELL" +fi + +# bluetooth +if sudo dmesg | grep -i blue > /dev/null; then + pkgs install bluez bluez-utils + sudo systemctl enable --now bluetooth +fi + +LINUX_HEADERS="" +pacman -Q linux 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-headers" +pacman -Q linux-hardened 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-hardened-headers" +pacman -Q linux-lts 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-lts-headers" +pacman -Q linux-rt 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-rt-headers" +pacman -Q linux-rt-lts 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-rt-lts-headers" +pacman -Q linux-zen 2> /dev/null && LINUX_HEADERS="$LINUX_HEADERS linux-zen-headers" + +# broadcom-wl +lspci -vnn -d 14e4: | grep -q "wl" > /dev/null && pkgs install broadcom-wl-dkms "$LINUX_HEADERS" + +# auto-cpufreq +if [ -d "/sys/class/power_supply/BAT0" ] && [ -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors" ]; then + pkgs install auto-cpufreq + sudo systemctl enable --now auto-cpufreq +fi + +# Intel +lspci | grep 'VGA.*Intel' > /dev/null && pkgs install intel-gpu-tools + +if lspci | grep 'VGA.*JasperLake' > /dev/null; then + pkgs install intel-media-sdk + # https://wiki.archlinux.org/title/intel_graphics#Enable_GuC_/_HuC_firmware_loading + echo "options i915 enable_guc=2" | sudo tee /etc/modprobe.d/i915.conf +fi + +echo "base-setup done." diff --git a/.local/bin/chaotic-aur-install b/.scripts/arch/chaotic-aur-install similarity index 67% rename from .local/bin/chaotic-aur-install rename to .scripts/arch/chaotic-aur-install index 2f1177a..8b9cd0c 100755 --- a/.local/bin/chaotic-aur-install +++ b/.scripts/arch/chaotic-aur-install @@ -1,25 +1,11 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi - +#!/bin/sh -e sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com sudo pacman-key --lsign-key 3056513887B78AEB sudo pacman -U --noconfirm --needed 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' -# setup check -if ! pacman -Q chaotic-keyring chaotic-mirrorlist > /dev/null; then - echo "alhp-keyring alhp-mirrorlist not installed" - exit 1 -fi - - PACMAN_CONF="/etc/pacman.conf" - grep -qxF "[chaotic-aur]" "$PACMAN_CONF" || sudo sed -i '$a\\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' $PACMAN_CONF - sudo pacman -Sy + echo "chaotic-aur-install done." diff --git a/.scripts/arch/cups-install b/.scripts/arch/cups-install new file mode 100644 index 0000000..017249d --- /dev/null +++ b/.scripts/arch/cups-install @@ -0,0 +1,17 @@ +#!/bin/sh -e + +PACKAGES=" \ +cups \ +avahi \ +foomatic-db-engine \ +foomatic-db \ +foomatic-db-ppds \ +foomatic-db-nonfree \ +foomatic-db-nonfree-ppds \ +" + +pkgs sync +pkgs install "$PACKAGES" +sudo systemctl enable --now cups.service avahi-daemon.service + +echo "cups-install done. Web interface available on: http://localhost:631/" diff --git a/.scripts/arch/desktop-setup b/.scripts/arch/desktop-setup new file mode 100644 index 0000000..4949fbe --- /dev/null +++ b/.scripts/arch/desktop-setup @@ -0,0 +1,41 @@ +#!/bin/sh -e + +PACKAGES=" \ +flatpak appimagelauncher \ +xclip wl-clipboard \ +xdg-desktop-portal xdg-desktop-portal-hyprland \ +bspwm sxhkd polybar dmenu xorg-xsetroot \ +noto-fonts noto-fonts-cjk noto-fonts-emoji ttf-firacode-nerd \ +libva-utils corectrl \ +firefox \ +telegram-desktop webkit2gtk \ +qbittorrent shadowsocks-electron-bin \ +barrier remmina libvncserver freerdp \ +gimp krita xp-pen-tablet \ +mpv spotify-launcher sonixd-bin electron22-bin jellyfin-media-player \ +" + +FLATPAK_PACKAGES=" \ +discord \ +" + +pkgs sync +pkgs install "$PACKAGES" + +flatpak install "$FLATPAK_PACKAGES" + +[ -c "/dev/kvm" ] && pkgs install qemu-full libvirt virt-manager + +# SDDM +pkgs install sddm sddm-slice-git +sudo systemctl enable sddm +sddm-theme sddm-slice + +# Wluma +if [ -d "/sys/bus/iio/devices/iio:device0" ]; then + pkgs install wluma + sudo usermod -a -G video "$(id -u -n)" + systemctl --user enable --now wluma +fi + +echo "desktop-setup done." diff --git a/.scripts/arch/extra-install b/.scripts/arch/extra-install new file mode 100644 index 0000000..bdd10e6 --- /dev/null +++ b/.scripts/arch/extra-install @@ -0,0 +1,47 @@ +#!/bin/sh -e + +NET_PACKAGES=" \ +openssh \ +bind nmap \ +wget yt-dlp \ +proxychains-ng \ +iperf3 speedtest-cli \ +" + +DEV_PACKAGES=" \ +lazygit \ +docker \ +sqlite \ +nodejs npm ts-node \ +php xdebug \ +go \ +python-pip python-virtualenv \ +" + +echo "extra-install done." +case "$1" in + net) + pkgs sync + pkgs install "$NET_PACKAGES" + ;; + dev) + pkgs sync + pkgs install "$DEV_PACKAGES" + ;; + all) + pkgs sync + pkgs install "$NET_PACKAGES $DEV_PACKAGES" + ;; + *) +cat << 'EOF' +Usage: extra-install [net|dev|all] +Install extra packages. + + net - network packages. + dev - development packages. + all - all packages. +EOF + exit 1 ;; +esac + +echo "extra-install done." diff --git a/.scripts/arch/full-setup b/.scripts/arch/full-setup new file mode 100644 index 0000000..1efb414 --- /dev/null +++ b/.scripts/arch/full-setup @@ -0,0 +1,12 @@ +#!/bin/sh -e + +repos-install + +base-setup +desktop-setup + +extra-install all +cups-install +obs-install + +echo "full-setup done." diff --git a/.scripts/arch/obs-install b/.scripts/arch/obs-install new file mode 100644 index 0000000..689cb92 --- /dev/null +++ b/.scripts/arch/obs-install @@ -0,0 +1,21 @@ +#!/bin/sh -e + +PACKAGES=" \ +obs-studio-git \ +obs-vaapi \ +obs-kmsgrab wlrobs \ +obs-pipewire-audio-capture-bin \ +obs-vkcapture \ +obs-ndi-bin \ +obs-vban \ +obs-audio-monitor \ +obs-backgroundremoval \ +obs-plugin-tuna-bin \ +obs-streamfx \ +" + +pkgs sync +pkgs install "$PACKAGES" +sudo systemctl enable --now avahi-daemon.service + +echo "obs-install done." diff --git a/.scripts/arch/paru-install b/.scripts/arch/paru-install new file mode 100755 index 0000000..6ad8480 --- /dev/null +++ b/.scripts/arch/paru-install @@ -0,0 +1,10 @@ +#!/bin/sh -e + +sudo pacman -Sy --noconfirm --needed git base-devel +git clone https://aur.archlinux.org/paru-bin.git +cd paru-bin +makepkg -cis --noconfirm --needed +cd .. +rm -rdf paru-bin + +echo "paru-install done." diff --git a/.scripts/arch/pkgs b/.scripts/arch/pkgs new file mode 100755 index 0000000..99e98a1 --- /dev/null +++ b/.scripts/arch/pkgs @@ -0,0 +1,47 @@ +#!/bin/sh -e +# shellcheck disable=SC2068 + +OPERATION="$1" +if [ $# -gt 1 ]; then + shift + SHIFTED=true +fi + +case "$OPERATION" in + sync) + sudo pacman -Fy + ;; + install) + if [ -z "$SHIFTED" ]; then +cat << 'EOF' +error: no targets specified +usage: pkgs install +EOF + exit 1 + fi + + if pacman -Si $@ > /dev/null 2>&1; then + sudo pacman -S --noconfirm --needed $@ + elif [ -x "$(command -v paru)" ]; then + paru -S --noconfirm --needed --sudoloop --skipreview $@ + elif [ -x "$(command -v yay)" ]; then + yay -S --noconfirm --needed --sudoloop $@ + else + echo "Can't install: " $@ +cat << 'EOF' + +paru or yay not installed. +run `paru-install` to install paru. +EOF + exit 1 + fi + ;; + *) +cat << 'EOF' +usage: pkgs [...] +operations: + pkgs sync + pkgs install +EOF + exit 1 ;; +esac diff --git a/.local/bin/mirrorlist-update b/.scripts/arch/rankmirrors-update similarity index 66% rename from .local/bin/mirrorlist-update rename to .scripts/arch/rankmirrors-update index 4e78bf7..95ea0b5 100755 --- a/.local/bin/mirrorlist-update +++ b/.scripts/arch/rankmirrors-update @@ -1,12 +1,6 @@ -#!/bin/sh - -if ! [ -x "$(command -v pacman)" ]; then - echo "pacman is not installed." - exit 1 -fi +#!/bin/sh -e if ! [ -x "$(command -v rankmirrors)" ]; then - echo "rankmirrors required. Installing pacman-contrib" sudo pacman -Sy --noconfirm --needed pacman-contrib fi @@ -16,4 +10,4 @@ echo "Using source: $SOURCE" echo "Starting rankmirrors, it can take a while" curl -s "$SOURCE" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors - | sudo tee /etc/pacman.d/mirrorlist -echo "mirrorlist-update done." +echo "rankmirrors-update done." diff --git a/.scripts/arch/repos-install b/.scripts/arch/repos-install new file mode 100644 index 0000000..33b0c8d --- /dev/null +++ b/.scripts/arch/repos-install @@ -0,0 +1,14 @@ +#!/bin/sh -e + +PARALLEL_DOWNLOADS="10" +sudo sed -i "s/ParallelDownloads.*/ParallelDownloads = $PARALLEL_DOWNLOADS/" /etc/pacman.conf + +rankmirrors-update + +paru-install + +alhp-install +chaotic-aur-install +archlinuxcn-install + +echo "repos-install done." diff --git a/.scripts/arch/server-setup b/.scripts/arch/server-setup new file mode 100644 index 0000000..c731293 --- /dev/null +++ b/.scripts/arch/server-setup @@ -0,0 +1,45 @@ +#!/bin/sh -e + +USER=$(whoami) +MEDIA_GROUP="media" +MEDIA_PATH="/media" + +BARRIER_SERVER="192.168.2.10" + +sudo groupadd "$MEDIA_GROUP" +sudo usermod -aG "$MEDIA_GROUP" "$USER" +sudo chown "$USER:$MEDIA_GROUP" -R "$MEDIA_PATH" + +pkgs sync + +# SSH Server +pkgs install openssh +sudo systemctl enable --now sshd + +# Samba +pkgs install samba avahi wsdd2 +sudo smbpasswd -a "$USER" + +SMB_CONF="$HOME/.config/samba/smb.conf" +[ -f "$SMB_CONF" ] && sudo ln -sb "$SMB_CONF" /etc/samba/smb.conf + +sudo systemctl enable --now smb.service avahi-daemon.service wsdd2.service + +# qBittorrent +pkgs install qbittorrent-nox +sudo systemctl enable --now "qbittorrent-nox@$USER.service" + +# Jellyfin +pkgs install jellyfin-server jellyfin-web +sudo usermod -aG "$MEDIA_GROUP" jellyfin +sudo systemctl enable --now jellyfin.service + +# Barrier (if already installed) +SDDM_XSETUP="/usr/share/sddm/scripts/Xsetup" +BARRIERC="/usr/bin/barrierc" + +if [ -f "$SDDM_XSETUP" ] && [ -f "$BARRIERC" ] && ! grep -qF "$BARRIERC" "$SDDM_XSETUP"; then + echo "$BARRIERC --disable-crypto $BARRIER_SERVER" | sudo tee -a "$SDDM_XSETUP" +fi + +echo "server-setup done." diff --git a/.local/bin/dotfiles-install b/.scripts/common/dotfiles-install similarity index 60% rename from .local/bin/dotfiles-install rename to .scripts/common/dotfiles-install index ddabff9..191e7ef 100755 --- a/.local/bin/dotfiles-install +++ b/.scripts/common/dotfiles-install @@ -1,19 +1,13 @@ -#!/bin/sh - -if ! [ -x "$(command -v git)" ]; then - echo "git is not installed." - exit 1 -fi +#!/bin/sh -e GIT_URI="https://github.com/biocoderh/dotfiles.git" STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}" -mkdir -p "$STATE_DIR" - GIT_DIR="$STATE_DIR/dotfiles" BACKUP_DIR="$STATE_DIR/dotfiles-backup" WORK_TREE_DIR="$HOME" +mkdir -p "$STATE_DIR" git clone --bare "$GIT_URI" "$GIT_DIR" dotfiles() { @@ -31,13 +25,21 @@ fi dotfiles config status.showUntrackedFiles no - -# shellcheck disable=SC1091 [ -f "$HOME/.profile" ] && . "$HOME/.profile" +chmod +x -R "$HOME/.local/bin" "$HOME/.scripts" + +cat << EOF +dotfiles-install done. -chmod +x -R "$HOME/.local/bin" +Some additional scripts: + dotfiles-link - link system files. + mitigations [on/off] - set kernel boot mitigations param. -echo "running dotfiles-post-install" -dotfiles-post-install +Environment (only Arch Linux): + full-setup - setup everything except server env. + base-setup - base environment with some tweaks. + desktop-setup - graphical environment. + server-setup - server environment. -echo "dotfiles-install done." +Check out README.md or ~/.scripts for more. +EOF diff --git a/.scripts/common/dotfiles-link b/.scripts/common/dotfiles-link new file mode 100644 index 0000000..8b7ec73 --- /dev/null +++ b/.scripts/common/dotfiles-link @@ -0,0 +1,10 @@ +#!/bin/sh + +sudo_symlink() { + sudo ln -sb "$1" "$2" +} + +[ -d "/usr/share/libinput" ] && sudo_symlink "$HOME/.local/share/libinput/local-overrides.quirks" /usr/share/libinput/local-overrides.quirks +[ -d "/etc/samba" ] && sudo_symlink "$HOME/.config/samba/smb.conf" /etc/samba/smb.conf + +echo "dotfiles-link done." diff --git a/.local/bin/mitigations b/.scripts/common/mitigations similarity index 78% rename from .local/bin/mitigations rename to .scripts/common/mitigations index 52c2938..4adbf26 100755 --- a/.local/bin/mitigations +++ b/.scripts/common/mitigations @@ -1,7 +1,13 @@ -#!/bin/sh +#!/bin/sh -e if ! { [ "$1" = "on" ] || [ "$1" = "off" ]; }; then echo "Usage: mitigations [on/off]" +cat << 'EOF' +Usage: mitigations [on/off] +Set kernel boot mitigations param. + +Note: only systemd-boot supported. +EOF exit 1 fi diff --git a/.scripts/common/sddm-theme b/.scripts/common/sddm-theme new file mode 100644 index 0000000..63d8e9b --- /dev/null +++ b/.scripts/common/sddm-theme @@ -0,0 +1,23 @@ +#!/bin/sh -e + +if [ -z "$1" ]; then +cat << 'EOF' +Usage: sddm-theme THEME +Set SDDM theme to conf. +EOF + exit 1 +fi + +if [ ! -d "/usr/share/sddm/themes/$1" ]; then + echo "Theme $1 not found." + exit 1 +fi + +CONF_FILE="/etc/sddm.conf.d/theme.conf" +sudo mkdir -p "$(dirname $CONF_FILE)" +sudo tee "$CONF_FILE" << "END" +[Theme] +Current=$1 +END + +echo "Theme $1 set in $CONF_FILE" diff --git a/.local/bin/ssh-clone-id b/.scripts/common/ssh-copy-keys similarity index 81% rename from .local/bin/ssh-clone-id rename to .scripts/common/ssh-copy-keys index ecb52d3..e8a751f 100755 --- a/.local/bin/ssh-clone-id +++ b/.scripts/common/ssh-copy-keys @@ -1,12 +1,9 @@ -#!/bin/sh - -set -e +#!/bin/sh -e if [ -z "$1" ] || [ -z "$2" ]; then cat << EOF -Clone ssh private and public keys to remote host. - -Usage: ssh-clone-id [key] [remote] +Usage: ssh-clone-id KEY REMOTE +Copy private and public keys to remote host, also add them to ssh agent. Example: ssh-clone-id .ssh/id_ed25519 biocoder@192.168.1.3 EOF @@ -33,3 +30,5 @@ CMD="$CMD ; chmod 400 $REMOTE_KEY_PATH $REMOTE_PUBKEY_PATH" CMD="$CMD ; ssh-add $REMOTE_KEY_PATH" ssh -tt -o StrictHostKeyChecking=no "$REMOTE" "$CMD" + +echo "ssh-copy-keys done." diff --git a/.scripts/env b/.scripts/env new file mode 100755 index 0000000..16a1c94 --- /dev/null +++ b/.scripts/env @@ -0,0 +1,10 @@ +#!/bin/sh + +SCRIPTS_PATH="$HOME/.scripts/common" + +case $(grep ^ID= /etc/os-release | cut -d= -f2) in + arch) SCRIPTS_PATH="$SCRIPTS_PATH:$HOME/.scripts/arch" ;; + *) ;; +esac + +export PATH="$PATH:$SCRIPTS_PATH" diff --git a/.shrc b/.shrc index 24294a9..c1d9b80 100644 --- a/.shrc +++ b/.shrc @@ -1,11 +1,13 @@ +#!/bin/sh + alias ls='ls --color=auto' alias grep='grep --color=auto' -alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' +alias dotfiles='/usr/bin/git --git-dir=${XDG_STATE_HOME:-$HOME/.local/state}/dotfiles/ --work-tree=$HOME' alias pipewire-restart='systemctl --user restart wireplumber pipewire pipewire-pulse' -if [ -n "$WSL" ]; then +if [ -x "$(grep -q WSL /proc/sys/kernel/osrelease)" ]; then alias ssh='ssh.exe' fi diff --git a/.zshenv b/.zshenv index 826714b..e98c9be 100644 --- a/.zshenv +++ b/.zshenv @@ -1 +1,3 @@ +#!/usr/bin/env zsh + export ZDOTDIR="$HOME/.config/zsh" diff --git a/README.md b/README.md index fd2a7f6..ef323a7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,136 @@ +# dotfiles + [![ShellCheck](https://github.com/biocoderh/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/biocoderh/dotfiles/actions/workflows/shellcheck.yml) -# dotfiles +dotfiles bare repo with environment setup scripts. + +- [Install](#install) +- [Fork](#fork) +- [Shell](#shell) +- [Scripts](#scripts) + + +## Install + +Requirements: +- curl +- git -dotfiles bare repo -Install script: ```sh -/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/biocoderh/.dotfiles/master/.local/bin/dotfiles-install)" +/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/biocoderh/dotfiles/master/.scripts/common/dotfiles-install)" ``` + +All conflicting files would be moved to **.local/state/dotfiles-backup** folder. + + +## Fork + +To properly fork this repo change **GIT_URI** value in [dotfiles-install](../blob/master/.scripts/common/dotfiles-install#L3) file. + + +## Shell + +Prefered shell is zsh, but for compatibility, environment variables and aliases separated to files: + +- [.profile](../blob/master/.profile) - environment variables. +- [.shrc](../blob/master/.shrc) - aliases. + +### [ZSH](../tree/master/.config/zsh) + +- [.zshrc](../blob/master/.config/zsh/.zshrc) - config. +- [plugins.zsh](../blob/master/.config/zsh/plugins.zsh) - plugins. +- [key-bindings.zsh](../blob/master/.config/zsh/key-bindings.zsh) - key bindings. + +lf and fzf integrated. + +Plugin manager - [antidote.lite](https://github.com/mattmc3/zsh_unplugged/blob/main/antidote.lite.zsh). \ +Plugins: + +- [romkatv/powerlevel10k](https://github.com/romkatv/powerlevel10k) - to customize prompt, run `p10k configure` +- [romkatv/zsh-defer](https://github.com/romkatv/zsh-defer) +- [zsh-users/zsh-history-substring-search](https://github.com/zsh-users/zsh-history-substring-search) +- [zsh-users/zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) +- [zdharma-continuum/fast-syntax-highlighting](https://github.com/zdharma-continuum/fast-syntax-highlighting) + + +## [Scripts](../tree/master/.scripts) + +- [env](../blob/master/.scripts/env) - set **PATH** environment variable depend on OS. In **~/.profile**: + +```sh +[ -f "$HOME/.scripts/env" ] && . "$HOME/.scripts/env" +``` + +### [common](../tree/master/.scripts/common) + +Common scripts, loaded by default. + +#### Dotfiles + +- [dotfiles-install](../blob/master/.scripts/common/dotfiles-install) - install dotfiles bare repo. +- [dotfiles-link](../blob/master/.scripts/common/dotfiles-link) - symlink system wide configs. + +#### Tools + +- [ssh-copy-keys](../blob/master/.scripts/common/ssh-clone-id) - copy private and public keys to remote host, also add them to ssh agent. +```sh +Usage: ssh-clone-id KEY REMOTE +Example: ssh-clone-id .ssh/id_ed25519 biocoder@192.168.1.3 +``` + +- [mitigations](../blob/master/.scripts/common/mitigations) - set kernel boot mitigations param. Note: only systemd-boot supported. +```sh +Usage: mitigations [on/off] +``` + +- [sddm-theme](../blob/master/.scripts/common/sddm-theme) - set SDDM theme to conf. +```sh +Usage: sddm-theme THEME +``` + +### [arch](../tree/master/.scripts/arch) + +Arch Linux specific. + +#### Environment + +- [full-setup](../blob/master/.scripts/arch/server-setup) - setup everything except server env. +- [base-setup](../blob/master/.scripts/arch/base-setup) - setup base environment with some tweaks. +- [desktop-setup](../blob/master/.scripts/arch/desktop-setup) - graphical environment. +- [server-setup](../blob/master/.scripts/arch/server-setup) - server environment. + + +#### Package managers + +- [pkgs](../blob/master/.scripts/arch/pkgs) - package managers wrapper, noninteractive, support: pacman, paru, yay. Used in scripts below. +```sh +usage: pkgs [...] +operations: + pkgs sync + pkgs install +``` + +- [rankmirrors-update](../blob/master/.scripts/arch/rankmirrors-update) - rank all [mirrors](https://archlinux.org/mirrorlist/?protocol=https&use_mirror_status=on), process can take a while, some abroad servers can be faster in EU. +- [paru-install](../blob/master/.scripts/arch/paru-install) - install AUR [paru](https://github.com/Morganamilo/paru) package manager. + +#### Repos + +- [repos-install](../blob/master/.scripts/arch/repos-install) - install all repos, paru and run rankmirrors-update. +- [alhp-install](../blob/master/.scripts/arch/alhp-install) - install [ALHP](https://github.com/an0nfunc/ALHP) repos. Archlinux-based repos build with different x86-64 feature levels, -O3 and LTO. +- [chaotic-aur-install](../blob/master/.scripts/arch/chaotic-aur-install) - install [Chaotic-AUR](https://github.com/chaotic-aur) repos. An automated building repo for AUR packages. +- [archlinuxcn-install](../blob/master/.scripts/arch/archlinuxcn-install) - install [archlinuxcn](https://github.com/archlinuxcn/repo) repos. Arch Linux CN Repository. + +#### Packages + +- [extra-install](../blob/master/.scripts/arch/extra-install) - install extra packages. +```sh +Usage: extra-install [net|dev|all] + + net - network packages. + dev - development packages. + all - all packages. +``` + +- [cups-install](../blob/master/.scripts/arch/cups-install) - install CUPS with foomatic drivers. +- [obs-install](../blob/master/.scripts/arch/obs-install) - install OBS with some plugins. \ No newline at end of file