aboutsummaryrefslogtreecommitdiff
path: root/binary_tarball
diff options
context:
space:
mode:
Diffstat (limited to 'binary_tarball')
-rwxr-xr-xbinary_tarball/build_tarball.sh23
-rwxr-xr-xbinary_tarball/content/launch_librewolf.sh32
-rw-r--r--binary_tarball/content/toggle-settings.sh21
-rwxr-xr-xbinary_tarball/scripts/1_Install_Dependencies.sh10
-rwxr-xr-xbinary_tarball/scripts/2_Download_Source_Code.sh11
-rwxr-xr-xbinary_tarball/scripts/3_Configure_Source_Code.sh17
-rwxr-xr-xbinary_tarball/scripts/4_Build_Binary_Tarball.sh34
-rwxr-xr-xbinary_tarball/scripts/5_Configure_Binary_Tarball.sh26
8 files changed, 174 insertions, 0 deletions
diff --git a/binary_tarball/build_tarball.sh b/binary_tarball/build_tarball.sh
new file mode 100755
index 0000000..adf9ad3
--- /dev/null
+++ b/binary_tarball/build_tarball.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+printf "\n------------------------------------- BINARY TARBALL BUILD ------------------------------------------\n";
+
+# Aborts the script upon any faliure
+set -e;
+
+# Sets up script variables
+BINARY_TARBALL=$1;
+_SCRIPT_FOLDER=$(realpath $(dirname $0));
+_REPOSITORY_FOLDER=$(realpath $_SCRIPT_FOLDER/../../../);
+
+_BINARY_TARBALL_SOURCE_FOLDER=$_SCRIPT_FOLDER/compile;
+_BINARY_TARBALL_SOURCE_CONTENT_FOLDER=$_REPOSITORY_FOLDER/browser/common/source_files/;
+_BINARY_TARBALL_TOGGLE_SETTINGS_SCRIPT=$_SCRIPT_FOLDER/content/toggle-settings.sh;
+_BINARY_TARBALL_LAUNCH_SCRIPT=$_SCRIPT_FOLDER/content/launch_librewolf.sh;
+
+# Executes the build
+$_SCRIPT_FOLDER/scripts/1_Install_Dependencies.sh;
+$_SCRIPT_FOLDER/scripts/2_Download_Source_Code.sh $_BINARY_TARBALL_SOURCE_FOLDER;
+$_SCRIPT_FOLDER/scripts/3_Configure_Source_Code.sh $_BINARY_TARBALL_SOURCE_FOLDER $_BINARY_TARBALL_SOURCE_CONTENT_FOLDER;
+$_SCRIPT_FOLDER/scripts/4_Build_Binary_Tarball.sh $_BINARY_TARBALL_SOURCE_FOLDER $BINARY_TARBALL;
+$_SCRIPT_FOLDER/scripts/5_Configure_Binary_Tarball.sh $BINARY_TARBALL $_BINARY_TARBALL_TOGGLE_SETTINGS_SCRIPT $_BINARY_TARBALL_LAUNCH_SCRIPT;
+
diff --git a/binary_tarball/content/launch_librewolf.sh b/binary_tarball/content/launch_librewolf.sh
new file mode 100755
index 0000000..26c1bd5
--- /dev/null
+++ b/binary_tarball/content/launch_librewolf.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+INSTALL_FOLDER=$(realpath $(dirname $0));
+INSTALL_SETTINGS_FOLDER=$INSTALL_FOLDER/settings;
+PROFILE_SETTINGS_FOLDER=$HOME/.librewolf/settings;
+
+# Adds option to install settings if argument is passed
+if [ "$1" = "--install-settings" ]; then
+ mkdir -p $PROFILE_SETTINGS_FOLDER;
+ cp $INSTALL_SETTINGS_FOLDER/defaults/pref/local-settings.js $PROFILE_SETTINGS_FOLDER/local-settings.js;
+ cp $INSTALL_SETTINGS_FOLDER/distribution/policies.json $PROFILE_SETTINGS_FOLDER/policies.json;
+ cp $INSTALL_SETTINGS_FOLDER/librewolf.cfg $PROFILE_SETTINGS_FOLDER/librewolf.cfg;
+ cp $INSTALL_SETTINGS_FOLDER/toggle-settings.sh $PROFILE_SETTINGS_FOLDER/toggle-settings.sh;
+fi
+
+# Sets up settings links
+mkdir -p $INSTALL_FOLDER/defaults/pref/;
+mkdir -p $INSTALL_FOLDER/distribution/;
+ln -s $PROFILE_SETTINGS_FOLDER/local-settings.js $INSTALL_FOLDER/defaults/pref/local-settings.js;
+ln -s $PROFILE_SETTINGS_FOLDER/policies.json $INSTALL_FOLDER/distribution/policies.json;
+ln -s $PROFILE_SETTINGS_FOLDER/librewolf.cfg $INSTALL_FOLDER/librewolf.cfg;
+
+# Sets env variables to disable dedicated profiles (which breaks some packaging methods)
+export MOZ_LEGACY_PROFILES=1;
+export SNAP_NAME="firefox";
+
+# Launches librewolf
+chmod +x $INSTALL_FOLDER/librewolf;
+$INSTALL_FOLDER/librewolf "$@";
+
+
+
diff --git a/binary_tarball/content/toggle-settings.sh b/binary_tarball/content/toggle-settings.sh
new file mode 100644
index 0000000..ff46bde
--- /dev/null
+++ b/binary_tarball/content/toggle-settings.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Exit script with a non-zero exit code if:
+# - any command fails (-e | --errexit)
+# - any variable is unset (-u | --nounset)
+# - a part of a piped sequence fails (-o pipefail)
+set -euo pipefail
+
+SCRIPT_FOLDER=$(realpath $(dirname $0));
+
+# Enable settings ------------------------------------------------------------------------------------------
+if [[ "${1}" = "--enable" ]]; then
+ mv "${SCRIPT_FOLDER}/[DISABLED] local-settings.js" "${SCRIPT_FOLDER}/local-settings.js";
+ mv "${SCRIPT_FOLDER}/[DISABLED] policies.json" "${SCRIPT_FOLDER}/policies.json";
+ mv "${SCRIPT_FOLDER}/[DISABLED] librewolf.cfg" "${SCRIPT_FOLDER}/librewolf.cfg";
+# Disable settings ------------------------------------------------------------------------------------------
+elif [[ "${1}" = "--disable" ]]; then
+ mv "${SCRIPT_FOLDER}/local-settings.js" "${SCRIPT_FOLDER}/[DISABLED] local-settings.js";
+ mv "${SCRIPT_FOLDER}/policies.json" "${SCRIPT_FOLDER}/[DISABLED] policies.json";
+ mv "${SCRIPT_FOLDER}/librewolf.cfg" "${SCRIPT_FOLDER}/[DISABLED] librewolf.cfg";
+fi
diff --git a/binary_tarball/scripts/1_Install_Dependencies.sh b/binary_tarball/scripts/1_Install_Dependencies.sh
new file mode 100755
index 0000000..c241e6b
--- /dev/null
+++ b/binary_tarball/scripts/1_Install_Dependencies.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+printf "\n\n-------------------------------------- DEPENDENCY INSTALLATION ---------------------------------------------\n";
+
+# Setup Script Variables
+_DEPENDENCIES="mercurial wget";
+
+# Installs Dependencies
+printf "\nInstalling dependencies\n";
+apt-get -qq update;
+apt-get -qqy install $_DEPENDENCIES;
diff --git a/binary_tarball/scripts/2_Download_Source_Code.sh b/binary_tarball/scripts/2_Download_Source_Code.sh
new file mode 100755
index 0000000..ac022a1
--- /dev/null
+++ b/binary_tarball/scripts/2_Download_Source_Code.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+printf "\n\n--------------------------------- SOURCE CODE DOWNLOAD --------------------------------------\n";
+
+# Setup Script Variables
+SOURCE_FOLDER=$1;
+_SOURCE_CODE_URL="https://hg.mozilla.org/releases/mozilla-release";
+
+# Clone Firefox Source Code
+printf "\nCloning Firefox Source Code\n";
+hg clone $_SOURCE_CODE_URL $SOURCE_FOLDER;
+
diff --git a/binary_tarball/scripts/3_Configure_Source_Code.sh b/binary_tarball/scripts/3_Configure_Source_Code.sh
new file mode 100755
index 0000000..9adc430
--- /dev/null
+++ b/binary_tarball/scripts/3_Configure_Source_Code.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+printf "\n\n------------------------------ FINAL PREBUILD CONFIGURATION ---------------------------------\n";
+
+# Setup Script Variables
+SOURCE_CODE_FOLDER=$1;
+SOURCE_CODE_CUSTOMIZATION_FOLDER=$2;
+_POCKET_SED_STRING="s/'pocket'/#'pocket'/g";
+_POCKET_FILE=$SOURCE_CODE_FOLDER/browser/components/moz.build;
+
+# Copy Source Code Changes to Source Code
+printf "\nCopying branding and source code changes to firefox source code\n";
+cp -r $SOURCE_CODE_CUSTOMIZATION_FOLDER/* $SOURCE_CODE_FOLDER/;
+
+# Disables Pocket
+printf "\nDisabling Pocket\n";
+sed -i $_POCKET_SED_STRING $_POCKET_FILE;
+
diff --git a/binary_tarball/scripts/4_Build_Binary_Tarball.sh b/binary_tarball/scripts/4_Build_Binary_Tarball.sh
new file mode 100755
index 0000000..5f3ebe5
--- /dev/null
+++ b/binary_tarball/scripts/4_Build_Binary_Tarball.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+printf "\n\n--------------------------------------- BUILD -----------------------------------------------\n";
+
+# Setup Script Variables
+SOURCE_FOLDER=$1;
+OUTPUT_TARBALL=$2;
+_SOURCE_CODE_BINARY_TARBALL_LOCATION="./obj*/dist/librewolf*.tar.bz2";
+
+# Prevents build from breaking in CI/CD environments
+export SHELL=/bin/bash;
+
+# Changes current folder to the source code folder
+cd $SOURCE_FOLDER;
+
+# Runs bootstrapper to install dependencies
+printf "\nRunning bootstrapper to install build dependencies (using ./mach script within source code)\n";
+./mach bootstrap --application-choice=browser --no-interactive;
+
+# Executes the actual build
+printf "\nBuilding LibreWolf\n";
+./mach build;
+
+# Packages the build into a binary tarball
+printf "\nPackaging LibreWolf\n";
+./mach package;
+
+# Moves the packaged tarball to the specified location
+printf "\nMoving Binary Tarball to output location\n";
+mv $_SOURCE_CODE_BINARY_TARBALL_LOCATION $OUTPUT_TARBALL;
+
+# Deletes the source code
+printf "\nDeleting source code\n";
+rm -rf $SOURCE_FOLDER;
+
diff --git a/binary_tarball/scripts/5_Configure_Binary_Tarball.sh b/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
new file mode 100755
index 0000000..562b05e
--- /dev/null
+++ b/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
+
+# Setup Script Variables
+BINARY_TARBALL=$1;
+TOGGLE_SETTINGS_SCRIPT=$2l
+LAUNCHER_SCRIPT=$3;
+_EXTRACTED_TARBALL_FOLDER=./librewolf;
+_SETTINGS_REPO='git@gitlab.com:librewolf-community/librewolf-settings.git';
+
+# Extracts the binary tarball
+printf "\nExtracting librewolf binary tarball\n";
+tar -xvf $BINARY_TARBALL;
+
+# 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;
+cp $TOGGLE_SETTINGS_SCRIPT $_EXTRACTED_TARBALL_FOLDER/settings;
+cp $LAUNCHER_SCRIPT $_EXTRACTED_TARBALL_FOLDER/launch_librewolf.sh;
+
+# Repacks the binary tarball
+printf "\nRecompressing binary tarball\n";
+tar -jcvf $BINARY_TARBALL $_EXTRACTED_TARBALL_FOLDER;
+
+
bgstack15