Compare commits
No commits in common. "bc869606807d7337d21241695e5f3ee5aa33a3f6" and "7f8c1f9dd0fb4baca994b73a1d7a48f470bb888a" have entirely different histories.
bc86960680
...
7f8c1f9dd0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
||||||
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 for architecture in $(ARCHITECTURES); do ./build.sh $$target $$architecture; done; done
|
for target in $(TARGETS); do ./build.sh $$target $(ARCHITECTURES); done
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|
164
build.sh
164
build.sh
|
@ -3,68 +3,29 @@
|
||||||
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 [ $# -ne 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "please give me target and architecture(s) plss..."
|
echo "please give me target and architecture(s) plss..."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $+commands[gsed] )); then
|
|
||||||
alias sed=gsed
|
|
||||||
fi
|
|
||||||
if (( $+commands[gdate] )); then
|
|
||||||
alias date=gdate
|
|
||||||
fi
|
|
||||||
|
|
||||||
target=${1:l}
|
target=${1:l}
|
||||||
architecture=${2:l}
|
shift
|
||||||
NAME_CAPS=${(C)target}
|
NAME_CAPS=${(C)target}
|
||||||
|
config_path=$SCRIPT_PATH/config/$target.config.sh
|
||||||
|
if [ ! -f $config_path ]; then
|
||||||
|
echo "Config for $NAME_CAPS not found:"
|
||||||
|
echo "Expected config at $config_path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
source $config_path
|
||||||
|
export VERSION=$(jq -r '.name' <<<$JSON)
|
||||||
|
echo "Building $NAME_CAPS v$VERSION for architectures: $@"
|
||||||
|
|
||||||
echo "Building $NAME_CAPS..."
|
control_file="Source: $target
|
||||||
|
|
||||||
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
|
||||||
|
@ -72,22 +33,20 @@ Maintainer: alex
|
||||||
Package: $target
|
Package: $target
|
||||||
Depends: $DEPENDS
|
Depends: $DEPENDS
|
||||||
Version: $VERSION
|
Version: $VERSION
|
||||||
Architecture: $architecture
|
Architecture: REPLACE_ARCHITECTURE
|
||||||
Description: $target" > $DEBIAN_DIR/control
|
Description: $target"
|
||||||
|
|
||||||
PKG_DIR=$DEBIAN_DIR/$target
|
package_control_file="Package: $target
|
||||||
mkdir -p $PKG_DIR
|
Maintainer: alex
|
||||||
|
Depends: $DEPENDS
|
||||||
|
Version: $VERSION
|
||||||
|
Architecture: REPLACE_ARCHITECTURE
|
||||||
|
Description: $target"
|
||||||
|
|
||||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
package_info="PackageAuthor=alex
|
||||||
d /var/lib/$target 0755 $target $target
|
UpdateMethod=External
|
||||||
Z /var/lib/$target - $target $target
|
UpdateMethodMessage=rebuild apt packages
|
||||||
Z /usr/lib/$target - $target $target
|
Branch=$BRANCH"
|
||||||
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.
|
||||||
|
@ -107,8 +66,29 @@ Type=simple
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target"
|
WantedBy=multi-user.target"
|
||||||
|
|
||||||
echo $service_file > $DEBIAN_DIR/$target.service
|
sysusers_file="$target home=/var/lib/$target"
|
||||||
|
|
||||||
|
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" " "))
|
||||||
|
@ -129,19 +109,39 @@ 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
|
||||||
|
|
||||||
if [[ "$arch" == "$architecture" ]]; then
|
mkdir -p $pkgdir/usr/lib/systemd/system
|
||||||
curl -Ls $url | tar xz -C $BUILD_DIR/
|
echo $service_file > $pkgdir/usr/lib/systemd/system/$target.service
|
||||||
rm -rf $BUILD_DIR/$NAME_CAPS/$NAME_CAPS.Update
|
|
||||||
install -d -m 755 "$PKG_DIR/usr/lib/$target/bin"
|
mkdir -p $pkgdir/usr/lib/tmpfiles.d
|
||||||
cp -dpr --no-preserve=ownership "$BUILD_DIR/$NAME_CAPS"* "$PKG_DIR/usr/lib/$target/bin"
|
echo $tmpfiles_file > $pkgdir/usr/lib/tmpfiles.d/$target.conf
|
||||||
|
|
||||||
|
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,5 +1,7 @@
|
||||||
#!/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,5 +1,7 @@
|
||||||
#!/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,5 +1,7 @@
|
||||||
#!/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,5 +1,7 @@
|
||||||
#!/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,5 +1,7 @@
|
||||||
#!/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