diff options
Diffstat (limited to 'scripts/apkworld')
| -rwxr-xr-x | scripts/apkworld | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/apkworld b/scripts/apkworld index 8200983..91deb8e 100755 --- a/scripts/apkworld +++ b/scripts/apkworld | |||
| @@ -3,10 +3,13 @@ | |||
| 3 | # Install and remove packages from a configuration file. | 3 | # Install and remove packages from a configuration file. |
| 4 | 4 | ||
| 5 | # Usage: apkworld [file] | 5 | # Usage: apkworld [file] |
| 6 | # Requires: apk (Alpine Linux package manager) | 6 | # Requires: apk (Alpine Linux package manager), doas (or sudo) |
| 7 | 7 | ||
| 8 | PACKAGES="${1:-$HOME/.config/alpine-packages}" | 8 | PACKAGES="${1:-$HOME/.config/alpine-packages}" |
| 9 | SUDO_CMD=doas | ||
| 9 | 10 | ||
| 10 | cp /etc/apk/world /etc/apk/world.backup | 11 | tmp_file=$(mktemp) |
| 11 | cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > /etc/apk/world | 12 | doas cp /etc/apk/world /etc/apk/world.backup |
| 12 | apk fix | 13 | cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > $tmp_file |
| 14 | doas mv $tmp_file /etc/apk/world | ||
| 15 | doas apk fix | ||
