diff --git a/README.md b/README.md index 46016a3..cd14e6b 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,28 @@ # PKGBUILD Update Integrity -This repository contains a simple helper script, `update-integrity`. Its -purpose is to easily update the `sha256` sums in PKGBUILD files. This is -helpful if you're maintaining a PKGBUILD and have bumped a version or -updated some sources. It simply replaces the existing hashes with the -output of `makepkg -g`, first prompting the user for a review and -confirmation. It requires `kakoune` since we use `kak -f` to perform the -replacement. +This repository contains a simple helper script, `update-integrity`. Its purpose +is to easily update the `sha256` sums in PKGBUILD files. This is helpful if +you're maintaining a PKGBUILD and have bumped a version or updated some sources. +It simply replaces the existing hashes with the output of `makepkg -g`, first +prompting the user for a review and confirmation. It requires `kakoune` since we +use `kak -f` to perform the replacement. -To use the script, simply provide a path to a `PKGBUILD` or its parent -directory as the argument. If no argument is given, the current working -directory is used. +To use the script, simply provide a path to a `PKGBUILD` or its parent directory +as the argument. If no argument is given, the current working directory is used. -The following installation script is provided as a convenience. You can -copy this code into a POSIX shell to install `update-integrity`. +An installation script is provided as a convenience. + +> [!IMPORTANT] +> You should **never** pipe an unknown script directly into your shell. +> **Always** review it first. ```sh -#!/bin/sh - -script="https://git.sr.ht/~ficd/pkgbuild-update-integrity/blob/main/update-integrity" -curl "$script">update-integrity -chmod +x update-update-integrity -sudo cp -f update-integrity /usr/bin/update-integrity +url="https://git.ficd.sh/ficd/pkgbuild-update-integrity/raw/branch/main/install.sh" +# download installer +curl "$url" -o /tmp/install.sh +# review it +less /tmp/install.sh +# make it executable, run it +chmod +x /tmp/install.sh +/tmp/install.sh ``` diff --git a/install.sh b/install.sh index 2cc3539..35d2a00 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,14 @@ #!/bin/sh -script="https://git.sr.ht/~ficd/pkgbuild-update-integrity/blob/main/update-integrity" +temp="$(mktemp -d)" +script="https://git.ficd.sh/ficd/pkgbuild-update-integrity/raw/branch/main/update-integrity.sh" +cd "$temp" || echo 'Error creating temp dir!' && exit 1 +echo "Downloading script..." curl "$script">update-integrity +echo "Installing..." chmod +x update-update-integrity sudo cp -f update-integrity /usr/bin/update-integrity +echo "Cleaning up..." +rm -r "$temp" +echo "Done!" diff --git a/update-integrity b/update-integrity.sh similarity index 96% rename from update-integrity rename to update-integrity.sh index 1ebdf9d..7e1e0ef 100755 --- a/update-integrity +++ b/update-integrity.sh @@ -5,7 +5,7 @@ # Automatically replaces sha256sums* with updated versions from # makepkg -g. Previous PKGBUILD is always backed up. # Requires kakoune (pacman -S kakoune) -# Author: Daniel Fichtinger +# Author: Daniel Fichtinger # License: GPLv3 # check if user gave path to a PKGBUILD,