first commit
This commit is contained in:
commit
3d6c49df65
16 files changed
+1137
No files matched your search
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
source /opt/rust-package-builder/scripts/lib.sh
|
||||
|
||||
OUT=${1:?output file required}
|
||||
PACKAGE=${2:?package name required}
|
||||
URL=$(trim_trailing_slash "$REPOSITORY_URL")
|
||||
|
||||
export OUT PACKAGE URL REPO_DISTRIBUTION REPO_COMPONENT
|
||||
python3 <<'PY_END'
|
||||
import html, os
|
||||
out=os.environ['OUT']
|
||||
package=os.environ['PACKAGE']
|
||||
url=os.environ['URL']
|
||||
dist=os.environ['REPO_DISTRIBUTION']
|
||||
component=os.environ['REPO_COMPONENT']
|
||||
h=html.escape
|
||||
content=f'''<!doctype html>
|
||||
<html lang="pl">
|
||||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{h(package)} repository</title></head>
|
||||
<body>
|
||||
<h1>{h(package)}</h1>
|
||||
<h2>Debian / Ubuntu</h2>
|
||||
<pre>curl -fsSL {h(url)}/repo-key.gpg \\
|
||||
| sudo gpg --dearmor -o /usr/share/keyrings/{h(package)}.gpg
|
||||
|
||||
echo "deb [signed-by=/usr/share/keyrings/{h(package)}.gpg] {h(url)}/apt {h(dist)} {h(component)}" \\
|
||||
| sudo tee /etc/apt/sources.list.d/{h(package)}.list
|
||||
|
||||
sudo apt update
|
||||
sudo apt install {h(package)}</pre>
|
||||
<h2>RHEL / Rocky / Alma / Fedora</h2>
|
||||
<pre>sudo rpm --import {h(url)}/repo-key.gpg
|
||||
|
||||
sudo tee /etc/yum.repos.d/{h(package)}.repo <<'REPO'
|
||||
[{h(package)}]
|
||||
name={h(package)} Repository
|
||||
baseurl={h(url)}/rpm/$basearch
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey={h(url)}/repo-key.gpg
|
||||
REPO
|
||||
|
||||
sudo dnf install {h(package)}</pre>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
with open(out, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
PY_END
|
||||
Reference in new issue
Block a user