aboutsummaryrefslogtreecommitdiff
path: root/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
blob: 56d33ad3ad3b3d59b249de35b28ee2db1696d57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";

# Aborts the script upon any faliure
set -e;

# Setup Script Variables
BINARY_TARBALL=$1;
TOGGLE_SETTINGS_SCRIPT=$2;
LAUNCHER_SCRIPT=$3;
CI_PROJECT_DIR=${CI_PROJECT_DIR:-$(realpath $(dirname $0)/../../)}
_SCRIPT_FOLDER=$(realpath $(dirname $0));
_EXTRACTED_TARBALL_FOLDER=$_SCRIPT_FOLDER/librewolf;
_SETTINGS_COMMIT=640b375dc02c5b089f678ed16b0232d1c0cc0721
_SETTINGS_REPO='https://gitlab.com/librewolf-community/settings.git';

# Extracts the binary tarball
printf "\nExtracting librewolf binary tarball\n";
mkdir -p $_EXTRACTED_TARBALL_FOLDER
tar --strip-components=1 -xf $BINARY_TARBALL -C $_EXTRACTED_TARBALL_FOLDER

# Adds the librefox config files to the packaged tarball
printf "\nCopying librewolf settings to extracted binary tarball\n";

git clone $_SETTINGS_REPO $_EXTRACTED_TARBALL_FOLDER/settings;
cd $_EXTRACTED_TARBALL_FOLDER/settings
git checkout $_SETTINGS_COMMIT
cd -
# no need to keep that in there:
rm -rf "${_EXTRACTED_TARBALL_FOLDER}/settings/.git";
cp $TOGGLE_SETTINGS_SCRIPT $_EXTRACTED_TARBALL_FOLDER/settings;
cp $LAUNCHER_SCRIPT $_EXTRACTED_TARBALL_FOLDER/launch_librewolf.sh;

# 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
printf "\nWorkaround: auto-enable Settings\n"
cp -r $_EXTRACTED_TARBALL_FOLDER/settings/* $_EXTRACTED_TARBALL_FOLDER;

# Add distribution.ini
distini="$_EXTRACTED_TARBALL_FOLDER/distribution/distribution.ini"

install -Dvm644 /dev/stdin "$distini" <<END
[Global]
id=io.gitlab.librewolf-community
version=1.0
about=LibreWolf

[Preferences]
app.distributor="LibreWolf Community"
app.distributor.channel=librewolf
app.partner.librewolf=librewolf
END

# Create Appstream metadate file
export DATE=$(date +%Y-%m-%d)
envsubst < ${_SCRIPT_FOLDER}/../content/io.gitlab.LibreWolf.appdata.xml.in > ${_EXTRACTED_TARBALL_FOLDER}/io.gitlab.LibreWolf.appdata.xml

# Repacks the binary tarball
printf "\nRecompressing binary tarball\n";
tar -jvcf $BINARY_TARBALL -C $_EXTRACTED_TARBALL_FOLDER .
bgstack15