feat: add APT repository setup script and documentation
This commit is contained in:
1 parent
999193fe86
commit
f8115ac0e2
2 files changed
+105
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main() (
|
||||
set -euo pipefail
|
||||
|
||||
as_root=()
|
||||
if (( EUID != 0 )); then
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
printf '%s\n' 'manca sudo ed è necessario' >&2
|
||||
exit 1
|
||||
fi
|
||||
as_root=(sudo)
|
||||
fi
|
||||
|
||||
for dependency in apt curl install mktemp; do
|
||||
command -v "$dependency" >/dev/null 2>&1 || {
|
||||
printf 'Missing required command: %s\n' "$dependency" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
curl -fsSL https://git.bjphoster.com/api/packages/deb/debian/repository.key -o "$work/repository.asc"
|
||||
printf '%s\n' 'deb [signed-by=/etc/apt/keyrings/bjphoster-deb.asc] https://git.bjphoster.com/api/packages/deb/debian stable main' > "$work/repository.list"
|
||||
|
||||
"${as_root[@]}" install -d -m 0755 /etc/apt/keyrings /etc/apt/sources.list.d
|
||||
"${as_root[@]}" install -m 0644 "$work/repository.asc" /etc/apt/keyrings/bjphoster-deb.asc
|
||||
"${as_root[@]}" install -m 0644 "$work/repository.list" /etc/apt/sources.list.d/bjphoster-deb.list
|
||||
"${as_root[@]}" apt update
|
||||
)
|
||||
|
||||
main
|
||||
Reference in new issue
Block a user