62 lines
2.1 KiB
Bash
Executable file
62 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
program_name="librewolf-allow-dark"
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|
|
|
# prep
|
|
workdir=$(mktemp -d)
|
|
built_dir=${COMPILED_DIR:-/compiled}/$program_name
|
|
mkdir -p $built_dir
|
|
apt update && apt install curl jq -y
|
|
|
|
# check whether it's up-to-date
|
|
version_file=$built_dir/version
|
|
touch $version_file
|
|
# also available via gitlab.com/librewolf-community/browser/source/-/raw/main/{version,release}
|
|
version=$(curl 'https://gitlab.com/api/v4/projects/32320088/packages?sort=desc' | jq '.[0].version' -r)
|
|
if grep -q $version $version_file; then
|
|
echo "already up to date, exiting"
|
|
exit
|
|
fi
|
|
|
|
# get source and build
|
|
cd $workdir
|
|
curl "https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/$version/librewolf-$version.source.tar.gz" -LO
|
|
tar -xzf librewolf-$version.source.tar.gz
|
|
cd ./librewolf-$version/
|
|
# get build deps
|
|
apt install python3 python3-pip wget patch -y
|
|
# apply allow dark patch
|
|
patch -p1 -i $SCRIPT_DIR/allow_dark.patch
|
|
export MOZ_BUILD_DATE="$(date -u${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH} +%Y%m%d%H%M%S)"
|
|
# not entirely sure what this does, but it's what librewolf-allow-dark does
|
|
export MOZ_NOSPAM=1
|
|
# build
|
|
./mach --no-interactive bootstrap --application-choice=browser
|
|
./lw/setup-wasi-linux.sh
|
|
./mach build
|
|
./mach package
|
|
|
|
# build .tar.zst archive
|
|
cd $workdir
|
|
tar -xvf ./librewolf-$version/obj-x86_64-pc-linux-gnu/dist/librewolf-$version.en-US.linux-x86_64.tar.xz
|
|
cd ./librewolf/
|
|
apt install zstd imagemagick -y
|
|
mkdir -p $built_dir
|
|
rm ./pingsender
|
|
rm ./precomplete
|
|
rm ./removed-files
|
|
curl -L https://codeberg.org/librewolf/bsys6/raw/branch/master/assets/linux.librewolf.desktop.in -o librewolf.desktop
|
|
convert $SCRIPT_DIR/bocchi-the-firefox.png -resize 256x256 ./librewolf.ico
|
|
cd ./browser/chrome/icons/default/
|
|
rm ./*
|
|
resolutions=(16 32 48 64 128)
|
|
for res in "${resolutions[@]}"; do
|
|
convert $SCRIPT_DIR/bocchi-the-firefox.png -resize ${res}x${res} ./default${res}.png
|
|
done
|
|
cd -
|
|
tar --zstd -cf $built_dir/$program_name.tar.zst .
|
|
echo $version >$version_file
|
|
|
|
echo "$program_name updated to $version"
|