2020-03-07 19:44:22 +01:00
|
|
|
#!/bin/bash
|
2019-07-17 20:50:38 +02:00
|
|
|
printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
|
|
|
|
|
2020-03-29 00:18:58 +01:00
|
|
|
# Aborts the script upon any faliure
|
|
|
|
set -e;
|
|
|
|
|
2019-07-21 07:30:19 +02:00
|
|
|
# Setup Script Variables
|
|
|
|
BINARY_TARBALL=$1;
|
2019-08-18 10:27:02 +02:00
|
|
|
TOGGLE_SETTINGS_SCRIPT=$2;
|
2019-07-21 07:30:19 +02:00
|
|
|
LAUNCHER_SCRIPT=$3;
|
2021-02-13 20:04:43 +01:00
|
|
|
CI_PROJECT_DIR=${CI_PROJECT_DIR:-$(realpath $(dirname $0)/../)}
|
2019-08-18 10:27:02 +02:00
|
|
|
_SCRIPT_FOLDER=$(realpath $(dirname $0));
|
|
|
|
_EXTRACTED_TARBALL_FOLDER=$_SCRIPT_FOLDER/librewolf;
|
2021-09-26 13:44:09 +02:00
|
|
|
_SETTINGS_TAG=${SETTINGS_TAG:-'2.0'}
|
2020-03-15 02:19:42 +01:00
|
|
|
_SETTINGS_REPO='https://gitlab.com/librewolf-community/settings.git';
|
2019-07-21 07:30:19 +02:00
|
|
|
|
2019-07-17 20:50:38 +02:00
|
|
|
# Extracts the binary tarball
|
|
|
|
printf "\nExtracting librewolf binary tarball\n";
|
2020-03-30 10:37:02 +02:00
|
|
|
mkdir -p $_EXTRACTED_TARBALL_FOLDER
|
|
|
|
tar --strip-components=1 -xf $BINARY_TARBALL -C $_EXTRACTED_TARBALL_FOLDER
|
2019-07-17 20:50:38 +02:00
|
|
|
|
|
|
|
# Adds the librefox config files to the packaged tarball
|
|
|
|
printf "\nCopying librewolf settings to extracted binary tarball\n";
|
2019-08-17 05:00:32 +02:00
|
|
|
|
2019-08-18 01:33:13 +02:00
|
|
|
git clone $_SETTINGS_REPO $_EXTRACTED_TARBALL_FOLDER/settings;
|
2020-10-29 02:18:46 +01:00
|
|
|
cd $_EXTRACTED_TARBALL_FOLDER/settings
|
2021-06-02 20:41:13 +02:00
|
|
|
git checkout $_SETTINGS_TAG
|
2020-10-29 02:18:46 +01:00
|
|
|
cd -
|
2020-03-30 10:37:02 +02:00
|
|
|
# no need to keep that in there:
|
2020-03-15 02:19:42 +01:00
|
|
|
rm -rf "${_EXTRACTED_TARBALL_FOLDER}/settings/.git";
|
2019-08-17 05:00:32 +02:00
|
|
|
cp $TOGGLE_SETTINGS_SCRIPT $_EXTRACTED_TARBALL_FOLDER/settings;
|
2019-07-21 07:30:19 +02:00
|
|
|
cp $LAUNCHER_SCRIPT $_EXTRACTED_TARBALL_FOLDER/launch_librewolf.sh;
|
2019-07-17 20:50:38 +02:00
|
|
|
|
2020-03-15 02:19:42 +01:00
|
|
|
# Somewhat crude workaround to use settings per default
|
|
|
|
# until we've worked out how to use `--install-settings` with links
|
|
|
|
# in all major packages instead
|
2020-03-28 23:15:41 +01:00
|
|
|
printf "\nWorkaround: auto-enable Settings\n"
|
2020-03-29 00:18:58 +01:00
|
|
|
cp -r $_EXTRACTED_TARBALL_FOLDER/settings/* $_EXTRACTED_TARBALL_FOLDER;
|
2020-03-15 02:19:42 +01:00
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# Add distribution.ini
|
|
|
|
distini="$_EXTRACTED_TARBALL_FOLDER/distribution/distribution.ini"
|
|
|
|
|
|
|
|
install -Dvm644 /dev/stdin "$distini" <<END
|
|
|
|
[Global]
|
2021-01-31 11:51:25 +01:00
|
|
|
id=io.gitlab.librewolf-community
|
2020-03-28 23:15:41 +01:00
|
|
|
version=1.0
|
|
|
|
about=LibreWolf
|
|
|
|
|
|
|
|
[Preferences]
|
|
|
|
app.distributor="LibreWolf Community"
|
|
|
|
app.distributor.channel=librewolf
|
|
|
|
app.partner.librewolf=librewolf
|
|
|
|
END
|
|
|
|
|
2020-03-31 10:57:25 +02:00
|
|
|
# Create Appstream metadate file
|
|
|
|
export DATE=$(date +%Y-%m-%d)
|
2021-03-25 16:21:05 +01:00
|
|
|
envsubst < ${_SCRIPT_FOLDER}/../content/io.gitlab.librewolf-community.appdata.xml.in > ${_EXTRACTED_TARBALL_FOLDER}/io.gitlab.librewolf-community.appdata.xml
|
2020-03-31 10:57:25 +02:00
|
|
|
|
2019-07-17 20:50:38 +02:00
|
|
|
# Repacks the binary tarball
|
|
|
|
printf "\nRecompressing binary tarball\n";
|
2020-03-30 10:37:02 +02:00
|
|
|
tar -jvcf $BINARY_TARBALL -C $_EXTRACTED_TARBALL_FOLDER .
|