#!/bin/sh # Xavi's Script for lazy installs # License: MIT [FILL] # ## OPTIONS ## usage() { printf "helping" && exit 1; } while getopts "nt" o; do case "${o}" in n) printf "user requested" && exit;; t) testmode= $true;; #*) printf "invalid option -%s\\n" "$OPTARG" && exit ;; *) usage;; esac done ## FUNCTIONS ## installpkg(){ if ["$testmode" = $true ]; then echo "Installing" "$1" else echo "No test" # pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ; fi } # WTF is this line for?? grepseq="\"^[PGA]*,\"" #error() {clear; printf "ERROR: \\n%s\\n" "$1"; exit;} welcomemsg(){ dialog --title "Aloha!" --msgbox "hola" 10 60 } error() { printf "%s\n" "$1" >&2; exit 1; } ## SCRIPT START ## # Check this is an Arch distro an we're root pacman --noconfirm --needed -Sy dialog || error "Are you sure you're running this as the root user, are on an Arch-based distribution and have an internet connection?" # Start prompt welcomemsg || error "User exit." # Check BOOT MODE #installpkg dialog || error "Are you root and have an active internet connection?" # Welcome everyone! #welcomemsg || error "Exited"