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
```
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
- 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
keybindings and scripts for those won't work.
- The installation script requires GNU Stow to work.

View File

@ -13,7 +13,7 @@ if [ "$(lsb_release -si)" = "Fedora" ]; then
INSTALL="pkg install"
elif [ "$(lsb_release -si)" = "Artix" ]; then
set -- "alacritty" "mako" "nvim" "scripts" "sway" "swaylock" "swaynag" "waybar" "zsh"
INSTALL="doas pacman -S"
INSTALL="sudo pacman -S"
else
echo "OS not supported!"
exit 1
@ -66,12 +66,6 @@ if [ -n "$DASH" ] && ! command -v dash >/dev/null 2>&1; then
$INSTALL dash
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
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
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+q exec swaynag -t shutdown -m 'Shut down?' -b 'Yes' 'doas poweroff'
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' 'sudo poweroff'
# Screenshotting
bindsym Print exec --no-startup-id grimshot --notify save output

View File

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

View File

@ -14,23 +14,6 @@ bt() {
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() {
(( ${+commands[curl]} )) || return 2
local ARGS=()