Compare commits
2 commits
7f8c1f9dd0
...
bc86960680
Author | SHA1 | Date | |
---|---|---|---|
Alex Janka | bc86960680 | ||
Alex Janka | 6d537d299a |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
debs/
|
debs/
|
||||||
|
build/
|
||||||
apikeys.sh
|
apikeys.sh
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ default: all
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
for target in $(TARGETS); do ./build.sh $$target $(ARCHITECTURES); done
|
for target in $(TARGETS); do for architecture in $(ARCHITECTURES); do ./build.sh $$target $$architecture; done; done
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|
166
build.sh
166
build.sh
|
@ -3,29 +3,68 @@
|
||||||
SCRIPT_PATH="${0:A:h}"
|
SCRIPT_PATH="${0:A:h}"
|
||||||
source $SCRIPT_PATH/apikeys.sh
|
source $SCRIPT_PATH/apikeys.sh
|
||||||
|
|
||||||
if (( $+commands[gsed] )); then
|
|
||||||
alias sed=gsed
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "please give me target and architecture(s) plss..."
|
echo "please give me target and architecture(s) plss..."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
target=${1:l}
|
if (( $+commands[gsed] )); then
|
||||||
shift
|
alias sed=gsed
|
||||||
NAME_CAPS=${(C)target}
|
fi
|
||||||
config_path=$SCRIPT_PATH/config/$target.config.sh
|
if (( $+commands[gdate] )); then
|
||||||
if [ ! -f $config_path ]; then
|
alias date=gdate
|
||||||
echo "Config for $NAME_CAPS not found:"
|
|
||||||
echo "Expected config at $config_path"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
source $config_path
|
|
||||||
export VERSION=$(jq -r '.name' <<<$JSON)
|
|
||||||
echo "Building $NAME_CAPS v$VERSION for architectures: $@"
|
|
||||||
|
|
||||||
control_file="Source: $target
|
target=${1:l}
|
||||||
|
architecture=${2:l}
|
||||||
|
NAME_CAPS=${(C)target}
|
||||||
|
|
||||||
|
echo "Building $NAME_CAPS..."
|
||||||
|
|
||||||
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
BUILD_DIR=$TEMP_DIR/build
|
||||||
|
mkdir -p $BUILD_DIR
|
||||||
|
|
||||||
|
DEBIAN_DIR=$BUILD_DIR/debian
|
||||||
|
mkdir -p $DEBIAN_DIR
|
||||||
|
|
||||||
|
|
||||||
|
curl -Ls https://api.github.com/repos/$NAME_CAPS/$NAME_CAPS/releases --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28" | jq -c '.[]' | while read -r release; do
|
||||||
|
version=$(jq -r '.name' <<<$release)
|
||||||
|
echo "$target ($version) testing; urgency=medium"
|
||||||
|
echo ""
|
||||||
|
jq -r '.body' <<<$release | sed -e '/^\*/!d' -e '/\*$/d' | sed -E 's/\*\*/-/g' | while read -r line; do
|
||||||
|
echo " $line"
|
||||||
|
done
|
||||||
|
author=$(jq -r '.author.login' <<<$release)
|
||||||
|
date=$(jq -r '.published_at' <<<$release)
|
||||||
|
date=$(date --date="$date" -R)
|
||||||
|
echo ""
|
||||||
|
echo " $author $date"
|
||||||
|
echo ""
|
||||||
|
done > $DEBIAN_DIR/changelog
|
||||||
|
|
||||||
|
source $SCRIPT_PATH/config/$target.config.sh
|
||||||
|
|
||||||
|
VERSION=$(jq -r '.name' <<<$JSON)
|
||||||
|
|
||||||
|
echo "\tVersion: $VERSION"
|
||||||
|
|
||||||
|
echo 12 > $DEBIAN_DIR/compat
|
||||||
|
echo "#!/usr/bin/make -f
|
||||||
|
|
||||||
|
clean:
|
||||||
|
|
||||||
|
build:
|
||||||
|
|
||||||
|
binary:
|
||||||
|
dh_installsysusers
|
||||||
|
dh_installsystemd
|
||||||
|
dh_installtmpfiles
|
||||||
|
dh_gencontrol
|
||||||
|
dh_builddeb" > $DEBIAN_DIR/rules
|
||||||
|
echo "Source: $target
|
||||||
Section: $SECTION
|
Section: $SECTION
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: alex
|
Maintainer: alex
|
||||||
|
@ -33,20 +72,22 @@ Maintainer: alex
|
||||||
Package: $target
|
Package: $target
|
||||||
Depends: $DEPENDS
|
Depends: $DEPENDS
|
||||||
Version: $VERSION
|
Version: $VERSION
|
||||||
Architecture: REPLACE_ARCHITECTURE
|
Architecture: $architecture
|
||||||
Description: $target"
|
Description: $target" > $DEBIAN_DIR/control
|
||||||
|
|
||||||
package_control_file="Package: $target
|
PKG_DIR=$DEBIAN_DIR/$target
|
||||||
Maintainer: alex
|
mkdir -p $PKG_DIR
|
||||||
Depends: $DEPENDS
|
|
||||||
Version: $VERSION
|
|
||||||
Architecture: REPLACE_ARCHITECTURE
|
|
||||||
Description: $target"
|
|
||||||
|
|
||||||
package_info="PackageAuthor=alex
|
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||||
UpdateMethod=External
|
d /var/lib/$target 0755 $target $target
|
||||||
UpdateMethodMessage=rebuild apt packages
|
Z /var/lib/$target - $target $target
|
||||||
Branch=$BRANCH"
|
Z /usr/lib/$target - $target $target
|
||||||
|
L /var/log/$target - - - - /var/lib/$target/logs/"
|
||||||
|
echo $tmpfiles_file > $DEBIAN_DIR/$target.tmpfiles
|
||||||
|
|
||||||
|
sysusers_file="u $target - - /var/lib/$target
|
||||||
|
g $target -"
|
||||||
|
echo $sysusers_file > $DEBIAN_DIR/$target.sysusers
|
||||||
|
|
||||||
service_file="# Be sure to use \`systemctl edit $target\` to modify this service with an override.conf because
|
service_file="# Be sure to use \`systemctl edit $target\` to modify this service with an override.conf because
|
||||||
# direct changes will be overwritten by package updates.
|
# direct changes will be overwritten by package updates.
|
||||||
|
@ -66,29 +107,8 @@ Type=simple
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target"
|
WantedBy=multi-user.target"
|
||||||
|
|
||||||
sysusers_file="$target home=/var/lib/$target"
|
echo $service_file > $DEBIAN_DIR/$target.service
|
||||||
|
|
||||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
|
||||||
d /var/lib/$target 0755 $target $target
|
|
||||||
Z /var/lib/$target - $target $target
|
|
||||||
Z /usr/lib/$target - $target $target
|
|
||||||
L /var/log/$target - - - - /var/lib/$target/logs/"
|
|
||||||
|
|
||||||
postinst_file="#!/bin/sh
|
|
||||||
|
|
||||||
SERVER_GROUP=$target
|
|
||||||
|
|
||||||
if ! getent group | grep -q \"^$target:\" ; then
|
|
||||||
echo -n \"Adding group $target..\"
|
|
||||||
addgroup --quiet --system $target 2>/dev/null ||true
|
|
||||||
echo \"..done\"
|
|
||||||
fi
|
|
||||||
|
|
||||||
adduser $target \
|
|
||||||
--system \
|
|
||||||
--home /var/lib/$target \
|
|
||||||
--ingroup $target \
|
|
||||||
--disabled-password"
|
|
||||||
|
|
||||||
rel_info=$(jq '.assets[] | select(.name | contains("linux")) | select(.name | contains("musl") | not)' <<<$JSON)
|
rel_info=$(jq '.assets[] | select(.name | contains("linux")) | select(.name | contains("musl") | not)' <<<$JSON)
|
||||||
declare -a tarballs=($(jq '"\(.browser_download_url) /\(.name)"' <<<$rel_info | tr -d '"' | tr "\n" " "))
|
declare -a tarballs=($(jq '"\(.browser_download_url) /\(.name)"' <<<$rel_info | tr -d '"' | tr "\n" " "))
|
||||||
|
@ -109,39 +129,19 @@ for ((i = 1; i < ${#tarballs[@]}; i += 2)); do
|
||||||
if [[ "$arch" == "core-arm64" ]]; then
|
if [[ "$arch" == "core-arm64" ]]; then
|
||||||
arch="arm64"
|
arch="arm64"
|
||||||
fi
|
fi
|
||||||
if (( $@[(Ie)$arch])); then
|
|
||||||
echo "Building for $arch..."
|
|
||||||
dir=$(mktemp -d)
|
|
||||||
deb_dir=$dir/debian
|
|
||||||
mkdir -p $deb_dir
|
|
||||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" > $deb_dir/control
|
|
||||||
echo $sysusers_file > $deb_dir/$target.sysuser
|
|
||||||
pkgdir=$deb_dir/$target
|
|
||||||
|
|
||||||
mkdir -p $pkgdir/usr/lib/systemd/system
|
if [[ "$arch" == "$architecture" ]]; then
|
||||||
echo $service_file > $pkgdir/usr/lib/systemd/system/$target.service
|
curl -Ls $url | tar xz -C $BUILD_DIR/
|
||||||
|
rm -rf $BUILD_DIR/$NAME_CAPS/$NAME_CAPS.Update
|
||||||
mkdir -p $pkgdir/usr/lib/tmpfiles.d
|
install -d -m 755 "$PKG_DIR/usr/lib/$target/bin"
|
||||||
echo $tmpfiles_file > $pkgdir/usr/lib/tmpfiles.d/$target.conf
|
cp -dpr --no-preserve=ownership "$BUILD_DIR/$NAME_CAPS"* "$PKG_DIR/usr/lib/$target/bin"
|
||||||
|
|
||||||
mkdir -p $pkgdir/usr/lib/$target
|
|
||||||
echo "$package_info\nPackageVersion=$VERSION" >$pkgdir/usr/lib/$target/package_info
|
|
||||||
|
|
||||||
curl -Ls $url | tar xz -C $pkgdir/
|
|
||||||
rm -rf $pkgdir/$NAME_CAPS/$NAME_CAPS.Update
|
|
||||||
mv $pkgdir/$NAME_CAPS $pkgdir/usr/lib/$target/bin
|
|
||||||
chmod -R a=,a+rX,u+w $pkgdir/usr/lib/$target/bin
|
|
||||||
chmod +x $pkgdir/usr/lib/$target/bin/$NAME_CAPS
|
|
||||||
|
|
||||||
deb_pkg_dir=$pkgdir/DEBIAN
|
|
||||||
mkdir -p $deb_pkg_dir
|
|
||||||
echo $package_control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" > $deb_pkg_dir/control
|
|
||||||
|
|
||||||
mkdir -p $SCRIPT_PATH/debs
|
|
||||||
cd $dir
|
|
||||||
dh_builddeb --destdir $SCRIPT_PATH/debs
|
|
||||||
rm -rf $dir
|
|
||||||
else
|
|
||||||
echo "Skipping arch $arch"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
cd $BUILD_DIR
|
||||||
|
dpkg-buildpackage -b
|
||||||
|
cd $TEMP_DIR
|
||||||
|
rm -rf $BUILD_DIR
|
||||||
|
OUT_DIR=$SCRIPT_PATH/debs
|
||||||
|
mkdir -p $OUT_DIR
|
||||||
|
cp $TEMP_DIR/* $OUT_DIR
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source ./apikeys.sh
|
|
||||||
|
|
||||||
export SECTION=sound
|
export SECTION=sound
|
||||||
export JSON=$(curl -Ls https://api.github.com/repos/Lidarr/Lidarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
export JSON=$(curl -Ls https://api.github.com/repos/Lidarr/Lidarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||||
export BRANCH=master
|
export BRANCH=master
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source ./apikeys.sh
|
|
||||||
|
|
||||||
export SECTION=web
|
export SECTION=web
|
||||||
export JSON=$(curl -Ls https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
export JSON=$(curl -Ls https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||||
export BRANCH=master
|
export BRANCH=master
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source ./apikeys.sh
|
|
||||||
|
|
||||||
export SECTION=video
|
export SECTION=video
|
||||||
export JSON=$(curl -Ls https://api.github.com/repos/Radarr/Radarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
export JSON=$(curl -Ls https://api.github.com/repos/Radarr/Radarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||||
export BRANCH=master
|
export BRANCH=master
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source ./apikeys.sh
|
|
||||||
|
|
||||||
export SECTION=misc
|
export SECTION=misc
|
||||||
export JSON=$(curl -Ls https://api.github.com/repos/Readarr/Readarr/releases --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28" | jq 'map(select(.prerelease)) | first')
|
export JSON=$(curl -Ls https://api.github.com/repos/Readarr/Readarr/releases --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28" | jq 'map(select(.prerelease)) | first')
|
||||||
export BRANCH=develop
|
export BRANCH=develop
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source ./apikeys.sh
|
|
||||||
|
|
||||||
export SECTION=video
|
export SECTION=video
|
||||||
export JSON=$(curl -Ls https://api.github.com/repos/Sonarr/Sonarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
export JSON=$(curl -Ls https://api.github.com/repos/Sonarr/Sonarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||||
export BRANCH=master
|
export BRANCH=master
|
||||||
|
|
Loading…
Reference in a new issue