Ditch doas

This commit is contained in:
Sam A. 2023-01-29 19:38:42 +01:00
parent 2e438c9e87
commit d95fef85f4
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
7 changed files with 9 additions and 60 deletions

View file

@ -11,16 +11,8 @@ $ cd dotfiles
$ ./install.sh $ ./install.sh
``` ```
Note that I use `doas` instead of `sudo` (only on Artix). If you prefer
`sudo`, then change all instances of `doas` to `sudo`, or simply create
a symlink `doas` pointing to `sudo`:
```sh
$ sudo ln -s $(which sudo) /usr/bin/doas
```
### Notes ### Notes
- You need to make `doas`/`sudo` rules that allow you to execute, - You need to make `sudo` rules that allow you to execute,
`poweroff` and `reboot` without a password, otherwise the `poweroff` and `reboot` without a password, otherwise the
keybindings and scripts for those won't work. keybindings and scripts for those won't work.
- The installation script requires GNU Stow to work. - The installation script requires GNU Stow to work.

View file

@ -13,7 +13,7 @@ if [ "$(lsb_release -si)" = "Fedora" ]; then
INSTALL="pkg install" INSTALL="pkg install"
elif [ "$(lsb_release -si)" = "Artix" ]; then elif [ "$(lsb_release -si)" = "Artix" ]; then
set -- "alacritty" "mako" "nvim" "scripts" "sway" "swaylock" "swaynag" "waybar" "zsh" set -- "alacritty" "mako" "nvim" "scripts" "sway" "swaylock" "swaynag" "waybar" "zsh"
INSTALL="doas pacman -S" INSTALL="sudo pacman -S"
else else
echo "OS not supported!" echo "OS not supported!"
exit 1 exit 1
@ -66,12 +66,6 @@ if [ -n "$DASH" ] && ! command -v dash >/dev/null 2>&1; then
$INSTALL dash $INSTALL dash
fi fi
if [ "$(lsb_release -si)" = "Artix" ]; then
sleep 0.5
echo "=> Installing custom PKGBUILD opendoas-sudo"
(cd pkg/opendoas-sudo && makepkg -si)
fi
sleep 0.5 sleep 0.5
echo "=> Done!" echo "=> Done!"

View file

@ -1,3 +0,0 @@
# Custom packages
These are my custom PKGBUILDs.

View file

@ -1,18 +0,0 @@
# Original author: Ultracoolguy <dummyd241 at gmaildotcom>
# Quick thanks to deuill, creator of rofi-dmenu
# The AUR didn't want this package, so I'm adding it here
pkgname=opendoas-sudo
pkgver=1
pkgrel=1
pkgdesc="A symlink for using Doas as a drop-in replacement for sudo"
arch=('any')
url="https://github.com/Duncaen/OpenDoas"
license=('MIT')
depends=('opendoas')
provides=('sudo')
conflicts=('sudo')
package() {
install -d "$pkgdir"/usr/bin
ln -s $(which doas) "$pkgdir"/usr/bin/sudo
}

View file

@ -25,8 +25,8 @@ bindsym $mod+l exec swaylock
# Session and power management # Session and power management
bindsym $mod+Shift+e exec swaynag -t logout -m 'Log out?' -b 'Yes' 'swaymsg exit' bindsym $mod+Shift+e exec swaynag -t logout -m 'Log out?' -b 'Yes' 'swaymsg exit'
bindsym $mod+Shift+r exec swaynag -t reboot -m 'Reboot?' -b 'Yes' 'doas reboot' bindsym $mod+Shift+r exec swaynag -t reboot -m 'Reboot?' -b 'Yes' 'sudo reboot'
bindsym $mod+Shift+q exec swaynag -t shutdown -m 'Shut down?' -b 'Yes' 'doas poweroff' bindsym $mod+Shift+q exec swaynag -t shutdown -m 'Shut down?' -b 'Yes' 'sudo poweroff'
# Screenshotting # Screenshotting
bindsym Print exec --no-startup-id grimshot --notify save output bindsym Print exec --no-startup-id grimshot --notify save output

View file

@ -53,20 +53,21 @@ alias cl="clear"
alias -g e="\$EDITOR" alias -g e="\$EDITOR"
alias ls="ls --color=always" alias ls="ls --color=always"
alias q="exit 0" alias q="exit 0"
alias visudo="sudo EDITOR='rvim -n' visudo"
# Platform specific # Platform specific
if [[ $(lsb_release -si) == "Artix" ]]; then if [[ $(lsb_release -si) == "Artix" ]]; then
alias code="codium --enable-features=UseOzonePlatform --ozone-platform=wayland" alias code="codium --enable-features=UseOzonePlatform --ozone-platform=wayland"
alias pacin="doas pacman -S" alias pacin="sudo pacman -S"
alias pacls="pacman -Qkl" alias pacls="pacman -Qkl"
alias pacown="pacman -Qo" alias pacown="pacman -Qo"
alias pacqi="pacman -Qi" alias pacqi="pacman -Qi"
alias pacqs="pacman -Qs" alias pacqs="pacman -Qs"
alias pacrm="doas pacman -Rcnsu" alias pacrm="sudo pacman -Rcnsu"
alias pacsi="pacman -Si" alias pacsi="pacman -Si"
alias pacss="pacman -Ss" alias pacss="pacman -Ss"
alias poweroff="doas poweroff" alias poweroff="sudo poweroff"
alias reboot="doas reboot" alias reboot="sudo reboot"
elif [[ $(lsb_release -si) == "Fedora" ]]; then elif [[ $(lsb_release -si) == "Fedora" ]]; then
alias code="codium" alias code="codium"
alias dnfin="sudo dnf install" alias dnfin="sudo dnf install"

View file

@ -14,23 +14,6 @@ bt() {
fi fi
} }
doasedit() {
(( ${+commands[doas]} )) || return 2
[[ $# -eq 0 ]] || return 1
doas -L
doas -u root sh -c "cp /etc/doas.conf /tmp/doas.conf &&
rvim -n /tmp/doas.conf &&
doas -C /tmp/doas.conf &&
mv /tmp/doas.conf /etc/doas.conf &&
echo 'ok' ||
echo >&2 'error'"
local STATUS=$?
doas -L
return $STATUS
}
get_ip() { get_ip() {
(( ${+commands[curl]} )) || return 2 (( ${+commands[curl]} )) || return 2
local ARGS=() local ARGS=()