diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-08-07 23:49:49 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-08-07 23:49:49 +0200 |
| commit | e211f27ba1f5b7b68812f7442575842784f80b71 (patch) | |
| tree | 3fcf4b9ebd3eb29408c09f55004024c4004bc182 /bin/kbuild | |
| parent | 7acce7b6abf85df85468c527f0453e4e3f9e65e5 (diff) | |
| download | dotfiles-e211f27ba1f5b7b68812f7442575842784f80b71.tar.gz dotfiles-e211f27ba1f5b7b68812f7442575842784f80b71.zip | |
kbuild: provide uninstall.sh and files.txt files
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'bin/kbuild')
| -rwxr-xr-x | bin/kbuild | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -135,7 +135,14 @@ cp .config "$INSTALL_PATH/boot/config-$name" ## # Setup install.sh script. -cat <<SCRIPT > "$INSTALL_PATH/install.sh" +# Files that are going to be installed. Funnily enough, the pipeline will create +# the "files.txt" first, so it will show on the `find` output. Hence the stupid +# workaround you see of moving it in later. +find "$INSTALL_PATH" -type f -printf "/%P\n" >files.txt +mv files.txt "$INSTALL_PATH/files.txt" + +# Now write the actual install script. +cat <<SCRIPT >"$INSTALL_PATH/install.sh" #!/usr/bin/env bash set -ex @@ -167,6 +174,27 @@ fi \$EDITOR /boot/extlinux/extlinux.conf SCRIPT +# And the uninstall script. +cat <<SCRIPT >"$INSTALL_PATH/uninstall.sh" +#!/usr/bin/env bash + +set -ex + +if [ "\$EUID" -ne 0 ];then + echo "kbuild (error): run this as root." + exit 1 +fi + +if [ ! -f files.txt ]; then + echo "kbuild (error): there must be a 'files.txt' file." + exit 1 +fi + +xargs rm -f < files.txt +rmdir /boot/dtbs/$name +rmdir /usr/lib/modules/$name +SCRIPT + ## # Create tarball. |
