Skip to content

Commit

Permalink
Remove unnecessary use of sudo/doas
Browse files Browse the repository at this point in the history
From now on `make` must be ran as a privileged user, such as root.
For BSD you can use `doas`, Linux and macOS users can use `sudo`
to gain such privileges.

This change made the necessity for a separate `install` and `update`
option obsolete, thus it has also been removed.

The pipeline to test the Makefile on Ubuntu has also been altered to
use sudo and remove the `update` test.
  • Loading branch information
AntonVanAssche committed Apr 19, 2024
1 parent 906fc72 commit 6896d75
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 44 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,26 @@ jobs:
test-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Test installation
run: |
make install
- name: Test updating
run: |
make update
sudo make install
- name: Test uninstall
run: |
make install
make uninstall
sudo make install
sudo make uninstall
test-macos:
runs-on: macos-12
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Test installation
run: |
make install
- name: Test updating
run: |
make update
- name: Test uninstall
run: |
make install
Expand Down
21 changes: 6 additions & 15 deletions BSDmakefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
PREFIX = $(HOME)/.local
BIN = /usr/bin
MAN_DIR = /usr/share/man/man1
SUDO := doas

all:
@echo Run \'make install\' to install BashPass.
@echo Run \'make update\' to update BashPass.
@echo Run \'make uninstall\' to uninstall BashPass.

install:
@echo Installing BashPass...
@$(SUDO) install -v -m755 bashpass $(BIN)
@$(SUDO) install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
@$(SUDO) install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
install -v -m755 bashpass $(BIN)
install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
@echo BashPass installed successfully!

update:
@echo Updating BashPass...
@$(SUDO) install -v -m755 bashpass $(BIN)
@$(SUDO) install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
@$(SUDO) install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
@echo BashPass updated successfully!

uninstall:
@echo Uninstalling BashPass...
@$(SUDO) rm -vf $(BIN)/bashpass
@$(SUDO) rm -vf $(MAN_DIR)/bashpass.1.gz
@$(SUDO) rm -vf $(MAN_DIR)/bashpass.conf.1.gz
rm -vf $(BIN)/bashpass
rm -vf $(MAN_DIR)/bashpass.1.gz
rm -vf $(MAN_DIR)/bashpass.conf.1.gz
@echo BashPass uninstalled successfully!
@echo Bye, have a nice day!
23 changes: 7 additions & 16 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
PREFIX = $(HOME)/.local
BIN = /usr/bin
MAN_DIR = /usr/share/man/man1
SUDO := sudo
OS := $(shell uname -s)

# Check if the operating system is Linux
Expand All @@ -10,35 +9,27 @@ ifeq ($(OS),Linux)
MAN_DIR = /usr/share/man/man1
endif

# Check if the operating system is Mac OS X
# Check if the operating system is macOS X
ifeq ($(OS),Darwin)
BIN = /usr/local/bin
MAN_DIR = /usr/local/share/man/man1
endif

all:
@echo Run \'make install\' to install BashPass.
@echo Run \'make update\' to update BashPass.
@echo Run \'make uninstall\' to uninstall BashPass.

install:
@echo Installing BashPass...
@$(SUDO) install -v -m755 bashpass $(BIN)
@$(SUDO) install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
@$(SUDO) install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
install -v -m755 bashpass $(BIN)
install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
@echo BashPass installed successfully!

update:
@echo Updating BashPass...
@$(SUDO) install -v -m755 bashpass $(BIN)
@$(SUDO) install -v -m644 docs/bashpass.1.gz $(MAN_DIR)
@$(SUDO) install -v -m644 docs/bashpass.conf.1.gz $(MAN_DIR)
@echo BashPass updated successfully!

uninstall:
@echo Uninstalling BashPass...
@$(SUDO) rm -vf $(BIN)/bashpass
@$(SUDO) rm -vf $(MAN_DIR)/bashpass.1.gz
@$(SUDO) rm -vf $(MAN_DIR)/bashpass.conf.1.gz
rm -vf $(BIN)/bashpass
rm -vf $(MAN_DIR)/bashpass.1.gz
rm -vf $(MAN_DIR)/bashpass.conf.1.gz
@echo BashPass uninstalled successfully!
@echo Bye, have a nice day!

0 comments on commit 6896d75

Please sign in to comment.