And wouldn't I remove scripts that are DEPRECATED

Hein?
This commit is contained in:
Geoffrey Frogeye 2021-06-16 22:58:12 +02:00
parent 1a8502002a
commit a96b3e80e8
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
3 changed files with 0 additions and 890 deletions

View file

@ -1,340 +0,0 @@
#!/usr/bin/env sh
# DEPRECATED
# set -x
# Allows to install software
# Find list of available installers in order of preference
# Read wanted packages and their availability
# Install packages per installer (after prompting)
# COMMON FUNCTIONS
# GLOBAL VARIABLES
# TODO Lock or temp folder
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
# Test if available
available_pkgbuild() {
true
}
available_Tapt() {
[ -f /data/data/com.termux/files/usr/bin/apt ]
}
# Update the database
update_Rpacman() {
sudo pacman -Syu --noconfirm
}
update_Ryay() {
yay -Syu --noconfirm --devel
}
update_Rapt() {
# TODO non-interactive
sudo apt update -y
sudo apt upgrade -y
}
# Test if installed
installed_Rpacman() { # packageName
pacman -Qq "$1" &> /dev/null
}
installed_Ryay() { # package
installed_Rpacman "$@"
}
installed_pip() { # package
pip show "$@" > /dev/null
}
installed_makepkg() { # package
installed_Rpacman "$@"
}
installed_pkgbuild() { # package
installed_Rpacman "$@"
# TODO Might need all the systems package too
}
installed_apt() { # package
dpkg -s "$1" &> /dev/null
}
# Test if available in the repositories
installable_aur() {
curl --fail --silent --head "https://aur.archlinux.org/packages/$@" > /dev/null
}
installable_Rpacman() {
pacman -Si "$1" &> /dev/null
}
installable_Ryay() {
# yay -Ss "$1" > /dev/null
installable_aur
}
installable_pkgbuild() {
installable_aur
}
installable_makepkg() {
installable_aur
}
installable_apt() {
apt-cache show "$1" &> /dev/null
}
# Tell if it hadles mutiple argument for install
multiinstall_pacman() {
true
}
multiinstall_pip() {
true
}
multiinstall_apt() {
true
}
# Really install
install_Rpacman() {
sudo pacman -S --needed --noconfirm $@
}
install_Ryay() {
yay -S --needed --noconfirm $@
}
install_Tapt() {
apt install -y $@
}
install_Rapt() {
sudo apt install -y $@
}
install_Rpip() {
sudo pip install $@
}
install_Upip() {
pip install --user $@
}
installable_Rmakepkg() {
old_pwd="$PWD"
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz"
tar xzvf "$1.tar.gz"
cd "$1"
makepkg -si
cd "$old_pwd"
rm -rf "$TMP_DIR"
}
# GENERIC INSTALLER FUNCTIONS
installerCanonicalName() { # installerName
echo "${1:1}"
}
notImplementedFallback() { # command installerName
echo "[NIMPL] Not implemented: command $1_$2"
false
}
# Wrapper to run a command for an installer
commandInstaller() { # command installerName fallback args...
# echo "[DEBUG] commandInstaller $*"
command="$1"
installerName="$2"
fallback="$3"
shift; shift; shift
installerCName="$(installerCanonicalName "$installerName")"
if command -v "${command}_$installerName" > /dev/null
then
"${command}_$installerName" "$@"
elif command -v "${command}_$installerCName" > /dev/null
then
"${command}_$installerCName" "$@"
else
$fallback "$command" "$installerName" "$@"
fi
}
# INSTALLER LIST FUNCTIONS
availableInstallerFallback() { # command installerName
command -v "$(installerCanonicalName "$2")" > /dev/null
}
availableInstaller() { # installerName
commandInstaller "available" "$1" availableInstallerFallback
}
# Clears the list of installers to use
resetInstallers() {
rm -f "$INSTALLERS_LIST"
touch "$INSTALLERS_LIST"
rm -rf "$INSTALLERS_DIR"
mkdir -p "$INSTALLERS_DIR"
}
addInstaller() { # installername
if availableInstaller "$1"
then
echo "$1" >> "$INSTALLERS_LIST"
rm -f "$INSTALLERS_DIR/$1"
touch "$INSTALLERS_DIR/$1"
return 0
fi
return 1
}
listInstallers() {
cat "$INSTALLERS_LIST"
}
hasInstaller() { # installerName
[ -f "${INSTALLERS_DIR}/$1" ]
}
# Installers that install in the user directory
addUserInstallers() {
addInstaller Tapt # Termux
# addInstaller Umakepkg # TODO broken
addInstaller Upip
# addInstaller Upkgbuild
}
# Installers that install with the system package manager
addSystemInstallers() {
addInstaller Rapt
addInstaller Rpacman
addInstaller Ryay || addInstaller Rmakepkg
}
# Installers that install in the system root but not tracked with system package manager
addRootInstallers() {
addInstaller Rnode
addInstaller Rpip
addInstaller Rpkgbuild
}
# UPDATING INSTALLER DATABASES
updateInstallers() {
for installerName in $(listInstallers)
do
commandInstaller "update" "$installerName" true
done
}
# MARKING PACKAGES TO INSTALL
markPackage() { # installer package
# echo "[DEBUG] Marked $*"
echo "$2" >> "$INSTALLERS_DIR/$1"
}
# Test if a package is installed
installedPackage() { # package
for installerName in $(listInstallers)
do
if commandInstaller "installed" "$installerName" notImplementedFallback "$1"
then
return 0
fi
done
return 1
}
installablePackageBy() { # installer package
commandInstaller "installable" "$1" notImplementedFallback "$2"
}
# List packages to install by given installer
listPackagesForInstaller() { # installer
cat "$INSTALLERS_DIR/$1"
}
isToInstall() { # package
for installerName in $(listInstallers)
do
listPackagesForInstaller "$installerName" | grep -q "^$1\$" && return 0
done
return 1
}
# Mark package to installer list where available
tryPackage() { # packageNames
# If package is already installed or marked to install, skip
for package in "$@"
do
installedPackage "$package" && return 0
isToInstall "$package" && return 0
done
# For each installer
for installerName in $(listInstallers)
do
# For each name given
for package in "$@"
do
# Mark if name available to installer
if installablePackageBy "$installerName" "$package"
then
markPackage "$installerName" "$package"
return 0
fi
done
done
echo "[ERR] Cannot install package with aliases: $*"
return 1
}
i() {
tryPackage "$@"
}
installPackages() {
for installerName in $(listInstallers)
do
# If we can install multiple packages in one go
if commandInstaller "multiinstall" "$installerName" false
then
packages=$(listPackagesForInstaller "$installerName")
[ -z "$packages" ] && continue
commandInstaller "install" "$installerName" notImplementedFallback $packages
else
for packageName in $(listPackagesForInstaller "$installerName")
do
commandInstaller "install" "$installerName" notImplementedFallback "$packageName"
done
fi
done
}

View file

@ -1,167 +0,0 @@
#!/usr/bin/env bash
# DEPRECATED
# Git for /etc
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)")
[ ! -d /etc/.git ] && sudo etckeeper init
sudo etckeeper commit "install-arch script: begin"
# Install yay
# TODO Use yay-bin
sudo pacman -S base-devel --needed
if ! pacman -Q yay-bin &> /dev/null
then
mkdir -p $HOME/.cache/yay
cd $HOME/.cache/yay
curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/yay-bin.tar.gz | tar xzvf -
cd yay-bin
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)
if [ -d /sys/class/backlight/intel_backlight ]
then
sudo pacman -S xf86-video-intel --needed
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
fi
# 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.d ]
then
function link { # filename
sudo ln -s ../xorg.conf.d/$1 /etc/X11/nvidia-xorg.conf.d/$1
}
link 00-keyboard.conf
link 20-intel.conf # Yep
link 30-touchpad.conf
link 50-joystick.conf
fi
exit 0
# Uninstall Manjaro's pamac
if pacman -Q pamac &> /dev/null
then
sudo pacman -Rsc pamac --noconfirm
fi
# 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
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 "# 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
# 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
sudo pacman -S chrony --needed
echo '# File wrote by ~/.dotfiles/config/scripts/install-arch
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
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

@ -1,383 +0,0 @@
#!/usr/bin/env sh
# DEPRECATED
# List of the software I use divided by categories.
# Oh and it asks the category you want to install on
# the running machine too.
# TODO Not tested with Debian derivate
# TODO Not tested on home folder
CONFIG_FILE="${XDG_CONFIG_DIR:=$HOME/.config}/softwareList"
mkdir -p $XDG_CONFIG_DIR
touch $CONFIG_FILE
. $CONFIG_FILE
prompt() { # text
res="none"
while [ "$res" = "none" ]
do
printf "%s [yn] " "$1"
read -r yn
case $yn in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer y or n.";;
esac
done
}
uservar() { # var text
if [ -z "${!1}" ]
then
prompt "${2}" && res=true || res=false
export "$1"="$res"
echo "$1"="$res" >> "$CONFIG_FILE"
fi
}
echo "Please answer some questions about this machine and what you want to do on it:"
# Setting variables
[ -d /data/data/com.termux/files ] && TERMUX=true || TERMUX=false
$TERMUX && INSTALL_GUI=false
[ "$USER" = "root" ] && SUPERUSER=true
uservar SUPERUSER "Have root permissions?"
uservar INSTALL_GUI "Install a GUI environment?"
$INSTALL_GUI && INSTALL_X=true
INSTALL_WAYLAND=false
uservar INSTALL_PASSWORD "Handle password?"
uservar INSTALL_MAIL "Read/send mail?"
uservar INSTALL_ORGANISATION "Handle agenda/contacts?"
uservar INSTALL_HOUSEKEEPING "Do some housekeeping?"
uservar INSTALL_FPGA "Handle FPGAs?"
uservar INSTALL_UTILITIES "Extra utilities?"
uservar INSTALL_DOCUMENT "Create documents?"
uservar INSTALL_IMAGE "Do image editing?"
uservar INSTALL_MUSIC "Play/edit music?"
uservar INSTALL_VIDEO "Play/edit videos?"
if $INSTALL_GUI
then
uservar INSTALL_WINE "Run Windows applications?"
else
INSTALL_WINE=false
fi
echo "(you can change those answers later in $CONFIG_FILE)"
# Preparing installers
. $HOME/.config/scripts/common/installSoftware
resetInstallers
$SUPERUSER && ! $TERMUX && addSystemInstallers
addUserInstallers
echo "Installers that will be used:"
listInstallers | sed 's/^/- /'
echo "Updating databases & packages"
# updateInstallers # DEBUG put back
echo "Finding packages to install"
# Note: i A B: will try A then B for each installer
# i A || i B: will try A for each installer, then B for each installer
# Package managers (install first)
i yay-bin
i python-pip python3-pip pip3
# TODO Install first and recharge installers
# Utils used by those scripts
i base coreutils # Basic shell commands (ls, rm, cp...)
i bash # Shell
i grep # Text finder
i sed # Text replacer
i tar # Archive tool
i openssl-tool openssl-tools # machines script verification
# Various utilities
$SUPERUSER && i sudo tsu
$TERMUX && i termux-api
# Shell utilities
i moreutils # Advanced shell commands (ts, sponge...)
i tmux # Terminal multiplexer
i bash-completion # Shell completions
i fzf # Fancy file finder
i highlight # Syntax highlighter (TODO No termux)
i powerline-go-bin powerline-go # Nice prompt (potential problem: requires go-pie)
i zsh # Shell
i antigen # ZSH plugins
# TODO Arch only for the following (antigen takes over else)
i zsh-autosuggestions # Shell suggestions
i zsh-completions # Shell completions
i zsh-history-substring-search # Shell config
i zsh-syntax-highlighting # Shell highlighting
i rxvt-unicode-terminfo # So it doesn't act weird in root
# Text edition
(i neovim nvim && i python-neovim python3-neovim) || i vim || i vi # Text editor
# Monitoring utilities
i ncdu # Explore directories by weight on disk
i lsof # Find who/what uses the files (TODO No termux)
i pv # Allow to show progress in pipe
# Network utilities
i openssh # SSH connections
# i proxytunnel # Proxy connections through HTTPS (TODO No termux)
i curl # Transfer URL
i wget # Download URL
i gnu-netcat netcat # Network piping
i socat # Multi-purpose relay
i rsync # Remote file-copying tool
i speedtest-cli # Network speed benchmarker (TODO No termux)
i bind-tools dnsutils # DNS queryier
i whois # Domain name queryier
# Archives utilities
i unzip # Unarchive ZIP files
i unrar # Unarchive RAR files
i p7zip # Unarchive 7z files
# Password handling
if $INSTALL_PASSWORD
then
i pwgen # Password generator
i pass # Password manager
if $INSTALL_GUI
then
i rofi-pass # Password selector
# i autopass.cr # Password selector
fi
fi
if $INSTALL_MAIL
then
# i offlineimap # Synchronize IMAP (legacy)
i isync mbsync # Synchronize IMAP
i msmtp # Send mail via SMTP
i notmuch # Index mail
i neomutt || i mutt # CLI mail client
i lynx # CLI web browser (for HTML mail)
i tiv # CLI image viewer
if $INSTALL_GUI
then
i thunderbird # GUI mail client (just in case)
fi
fi
if $INSTALL_ORGANISATION
then
i vdirsyncer # Synchronize DAV
i khard # Contacts editor
i khal # Calendar editor
i todoman # Todo-list
fi
if $INSTALL_HOUSEKEEPING
then
i syncthing # Synchronize files amongst devices
i borg # Backups
i jdupes # Find duplicates
i duperemove # Find and merge dupplicates on BTRFS partitions
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
i android-tools && i android-udev # Android Debug Bridge
i tigervnc # Remote desktop
fi
# Dev utilities
i base-devel build-essential || (i make; i gcc)
i git
[ -z "$INSTALL_DEV" ] && $TERMUX && INSTALL_DEV=false
if $INSTALL_DEV
then
# Misc/Reusable
i man # Documentation
i strace # Tracer
i ctags universal-ctags exuberant-ctags # Tags generator
i perf # Allow verifying performance of software
# C/C++
i cmake # C++ Build system
i clang # C/C++ Compiler
i ccache # Build cache
i gdb # Debugger
# JS
i jq # CLI JSON file handler
# Python
i python-language-server # Python language server
i mypy && i pyls-mypy # Static typing checker for Python
i python-language-server-black # Python code formatter
# Bash
i bash-language-server # Bash / SH language server
fi
if $INSTALL_FPGA
then
i yosys # Verilog processor
i iverilog # Verilog simulator
i ghdl # VHDL simulator
i gtkwave # Simulation file viewer
fi
if $INSTALL_UTILITIES
then
i visidata # CSV file reader
i insect # Unit calculator
i zbar # Read QR codes
i htop # View process usage
$SUPERUSER && i iotop # View process I/O
i progress # Show progress of functions
fi
if $INSTALL_DOCUMENT
then
i pandoc # Document converter
i texlive-most && i texlive-lang # LaTeX renderer
i pdftk # PDF manipulator
i translate-shell # Translator
i inkscape # Vector image converter
i optipng # Optimize PNG files
i jpegtran libjpeg-turbo # Compress JPEG files
i libreoffice-fresh # Office suite
i hunspell-en_GB # Spell checker British english
i hunspell-en_US # Spell checker American english
# i libreoffice-extension-grammalecte-fr # Spell checker French
i libreoffice-extension-languagetool # Complimentary spell checker various
# TODO The last two can't cohabit
fi
if $INSTALL_IMAGE
then
i imagemagick # CLI Image manipulator
i gimp # Photo editor
i darktable # Raw photo editor
i inkscape # Vectorial image editor
i optipng # Optimize PNG files
i jpegtran libjpeg-turbo # Compress JPEG files
fi
if $INSTALL_MUSIC
then
i mpv # Audio/Video player
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
i musescore # Music sheet editor
i ashuffle # Auto-fill MPD playlist
i audacity # Audio editor
fi
if $INSTALL_VIDEO
then
i vlc # Video player
i mpv # Audio/Video player
i mpv-thumbnail-script # Show thumbnails for mpv
i ffmpeg # Video/Audio file handler
i youtube-dl # Downloader for videos
i megatools # Downloader for mega.nz
if $INSTALL_X
then
i simplescreenrecorder # Screen recorder
fi
fi
if $INSTALL_WINE
then
# TODO Add multilib repo and pacman -Sy
i wine # Wine
i wine-gecko # Wine Internet Explorer
i wine-mono # Wine .NET
i mono # Mono .NET
i lib32-libpulse # Sound for Wine with pulseaudio
fi
# Desktop environment
if $INSTALL_GUI
then
i firefox # Web browser
# Extensions: Dark reader, Decentraleyes, Tridactyl, uBlock Origin, Containers, 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-dejavu # Font
i ttf-twemoji # Emoji fonts
i adobe-source-han-sans-otc-fonts # Chinese/Japanese/Korean fonts
i sox # For beeps and stuff
i meld # For comparison
i python-magic # Dependency of o
i yubikey-touch-detector # Show a notification when Yubikey needs pressing
if $INSTALL_X
then
i i3-wm # WM
i libgnomekbd # Show keyboard layout
i dunst # Notifications
i i3lock # Locker
i numlockx # Numlock auto-unlock
i rofi # HUD selector
i rofimoji # emoji 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
i xautolock # Auto lock screen
i xclip # Copy/paste
i lemonbar-xft-git lemonbar # Bottom bar
i wireless_tools # Bottom bar WiFi Indicator (iwgetid)
i autorandr # Multiple screen configurations
i keynav-enhanced keynav # Use mouse with keyboard
i pacmixer # To change PA volumes
i sct # Red filter # TODO Autocompile
i xorg-xinit # To launch X
i xorg-xbacklight xbacklight # For laptop brightness
i pulseaudio # To get ausdio
# TODO Bluetooth headset stuff
fi
if $INSTALL_WAYLAND
then
i sway
fi
fi
echo "Listing software to install"
listInstallers | while read -r installerName
do
echo " Installer $installerName will install:"
listPackagesForInstaller "$installerName" | sed 's/^/ - /'
done
prompt "Okay with those?" || exit 0
echo "Installing packages"
installPackages