diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-28 16:45:16 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-28 16:45:16 +1100 |
| commit | 587e29efe4584c8fa8016901302fd4214f78be66 (patch) | |
| tree | 734816a3e818112cb706363478e6d3a6be7c1822 /install/util.fish | |
| parent | toggles: update communication (diff) | |
| download | caelestia-cli-587e29efe4584c8fa8016901302fd4214f78be66.tar.gz caelestia-cli-587e29efe4584c8fa8016901302fd4214f78be66.tar.bz2 caelestia-cli-587e29efe4584c8fa8016901302fd4214f78be66.zip | |
install scripts for all modules
Diffstat (limited to 'install/util.fish')
| -rw-r--r-- | install/util.fish | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/install/util.fish b/install/util.fish new file mode 100644 index 0000000..3f54c86 --- /dev/null +++ b/install/util.fish @@ -0,0 +1,55 @@ +. (dirname (status filename))/../util.fish + +function confirm-overwrite -a path + if test -e $path + read -l -p "input '$(realpath $path) already exists. Overwrite? [y/N] ' -n" confirm + if test "$confirm" = 'y' -o "$confirm" = 'Y' + log 'Continuing.' + rm -rf $path + else + log 'Exiting.' + exit + end + end +end + +function install-deps + # All dependencies already installed + pacman -Q $argv &> /dev/null && return + + # Get AUR helper or install if none + which yay > /dev/null && set -l helper yay || set -l helper paru + if ! which paru > /dev/null + warn 'No AUR helper found' + read -l -p "input 'Install yay? [Y/n] ' -n" confirm + if test "$confirm" = 'n' -o "$confirm" = 'N' + warn "Manually install yay or paru and try again." + warn "Alternatively, install the dependencies '$argv' manually and try again." + exit + else + sudo pacman -S --needed git base-devel + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si + cd .. + rm -rf yay + + # First use, see https://github.com/Jguer/yay?tab=readme-ov-file#first-use + yay -Y --gendb + yay -Y --devel --save + end + end + + # Install + log "Installing dependencies '$argv'" + $helper -S --needed --noconfirm $argv +end + +function install-optional-deps + for dep in $argv + if ! pacman -Q $dep &> /dev/null + read -l -p "input 'Install $dep? [Y/n] ' -n" confirm + test "$confirm" != 'n' -a "$confirm" != 'N' && install-deps (cut -f 1 -d ' ' $dep) + end + end +end |