Install doas

This commit is contained in:
Augusto Gunsch 2021-05-15 18:55:45 -03:00
parent 5e2b3da821
commit 342d0db401
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
2 changed files with 90 additions and 4 deletions

View File

@ -42,12 +42,12 @@ while getopts ":nvhdpu:" c; do
case $c in
d)
[ "$INSTALL" = PACKAGES ] && exclusive '-p' '-d'
MAXPHASE=$(($MAXPHASE-1))
MAXPHASE=$((MAXPHASE-1))
set_var INSTALL DOTFILES "-d" ;;
p)
[ "$INSTALL" = DOTFILES ] && exclusive '-p' '-d'
[ -n "$INSTALLUSER" ] && exclusive '-p' '<user>'
MAXPHASE=$(($MAXPHASE-1))
MAXPHASE=$((MAXPHASE-1))
set_var INSTALL PACKAGES "-p" ;;
u)
[ "$INSTALL" = PACKAGES ] && exclusive '-p' '<user>'
@ -95,7 +95,61 @@ fi
printphase() {
echo -e "${BOLD}${YELLOW}[$CURPHASE/$MAXPHASE] $1 phase${NC}${NORM}"
CURPHASE=$(($CURPHASE+1))
CURPHASE=$((CURPHASE+1))
}
install_aur() {
dir="$HOMEDIR/$1"
echo -n "Installing $1... "
sudo -u "$1" git clone -q "https://aur.archlinux.org/$1.git" "$dir" 2>&1 > /dev/null
pushd "$dir"
sudo -u "$1" makepkg -si --noconfirm 2>&1 > /dev/null
popd
rm -rf "$1"
echo "done"
}
remove() {
echo -n "Removing $1..."
set +e
pacman -Rs --noconfirm $1 2>&1 > /dev/null
set -e
echo "done"
}
install() {
echo -n "Installing $1..."
pacman -Sq --needed --noconfirm $1 2>&1 > /dev/null
echo "done"
}
prompt() {
[ $NOCONFIRM ] && return true
echo -n "$1 [Y/n]"
read ans
case $ans in
n|N) return false ;;
*) return true ;;
esac
}
install_doas() {
#install_aur requires sudo or doas
[ ! $(prompt "Do you want to install doas (will remove sudo if installed)?") ] && return
install sudo
install_aur doas
remove sudo
echo -n "Adding sudo to IgnorePkg..."
sed 's/^#*\(IgnorePkg[[:blank:]]*=[[:blank:]]*.*\)/\1 sudo/' /etc/pacman.conf -i
echo "done"
echo -n "Linking /bin/sudo to /bin/doas... "
ln -s /bin/doas /bin/sudo
echo "done"
echo -n "Configuring doas... "
echo "permit persist $INSTALLUSER as root" >> /etc/doas.conf
echo "permit nopass $INSTALLUSER as root cmd pacman args -Syu" >> /etc/doas.conf
echo "permit nopass $INSTALLUSER as root cmd pacman args -Syyu" >> /etc/doas.conf
echo "done"
}
# PACKAGES
@ -103,6 +157,10 @@ if [ "$INSTALL" != "DOTFILES" ]; then
printphase "Package installation"
echo -n "Upgrading system... "
_DUMMY=$(pacman -Sqyu --noconfirm 2>&1 > /dev/null)
pacman -Sqyu --noconfirm 2>&1 > /dev/null
echo "done"
install_doas
install_aur yay
fi

28
packages.csv Normal file
View File

@ -0,0 +1,28 @@
,cmake
,picom
,networkmanager
,qutebrowser
,unclutter
,lxsession
,mpv
,mupdf
,fzf
,go
,unzip
,feh
,openssh
,git
,scrot
,tmux
,zsh
,libxinerama
,xorg-server
,xorg-xinit
,man
,pulseaudio
,pulseaudio-alsa
,pulsemixer
,libnotify
,dunst
,xorg-xsetroot
,pamixer
1 cmake
2 picom
3 networkmanager
4 qutebrowser
5 unclutter
6 lxsession
7 mpv
8 mupdf
9 fzf
10 go
11 unzip
12 feh
13 openssh
14 git
15 scrot
16 tmux
17 zsh
18 libxinerama
19 xorg-server
20 xorg-xinit
21 man
22 pulseaudio
23 pulseaudio-alsa
24 pulsemixer
25 libnotify
26 dunst
27 xorg-xsetroot
28 pamixer