aboutsummaryrefslogtreecommitdiff
path: root/linux/binary_tarball
diff options
context:
space:
mode:
authorBeatLink <beatlink@protonmail.com>2019-08-16 20:00:38 -0500
committerBeatLink <beatlink@protonmail.com>2019-08-16 20:00:38 -0500
commitd16a5b29e81bb6e0e58af2a97484defccacf355c (patch)
tree4ef06da3e1d9548a99fc4ce8adf4587d7bd14621 /linux/binary_tarball
parentmove toggle settings folder to linux script (diff)
downloadlibrewolf-linux-d16a5b29e81bb6e0e58af2a97484defccacf355c.tar.gz
librewolf-linux-d16a5b29e81bb6e0e58af2a97484defccacf355c.tar.bz2
librewolf-linux-d16a5b29e81bb6e0e58af2a97484defccacf355c.zip
Move branding and settings to seperate repos and move browser to top level
Diffstat (limited to 'linux/binary_tarball')
-rwxr-xr-xlinux/binary_tarball/build_tarball.sh22
-rwxr-xr-xlinux/binary_tarball/content/launch_librewolf.sh32
-rwxr-xr-xlinux/binary_tarball/scripts/1_Install_Dependencies.sh10
-rwxr-xr-xlinux/binary_tarball/scripts/2_Download_Source_Code.sh11
-rwxr-xr-xlinux/binary_tarball/scripts/3_Configure_Source_Code.sh17
-rwxr-xr-xlinux/binary_tarball/scripts/4_Build_Binary_Tarball.sh34
-rwxr-xr-xlinux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh23
-rw-r--r--linux/binary_tarball/toggle-settings.sh21
8 files changed, 170 insertions, 0 deletions
diff --git a/linux/binary_tarball/build_tarball.sh b/linux/binary_tarball/build_tarball.sh
new file mode 100755
index 0000000..83da436
--- /dev/null
+++ b/linux/binary_tarball/build_tarball.sh
@@ -0,0 +1,22 @@
+#!/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_SETTINGS_FOLDER=$_REPOSITORY_FOLDER/settings;
+_BINARY_TARBALL_LAUNCH_SCRIPT=$_SCRIPT_FOLDER/binary_tarball/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_SETTINGS_FOLDER $_BINARY_TARBALL_LAUNCH_SCRIPT;
+
diff --git a/linux/binary_tarball/content/launch_librewolf.sh b/linux/binary_tarball/content/launch_librewolf.sh
new file mode 100755
index 0000000..26c1bd5
--- /dev/null
+++ b/linux/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/linux/binary_tarball/scripts/1_Install_Dependencies.sh b/linux/binary_tarball/scripts/1_Install_Dependencies.sh
new file mode 100755
index 0000000..c241e6b
--- /dev/null
+++ b/linux/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/linux/binary_tarball/scripts/2_Download_Source_Code.sh b/linux/binary_tarball/scripts/2_Download_Source_Code.sh
new file mode 100755
index 0000000..ac022a1
--- /dev/null
+++ b/linux/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/linux/binary_tarball/scripts/3_Configure_Source_Code.sh b/linux/binary_tarball/scripts/3_Configure_Source_Code.sh
new file mode 100755
index 0000000..9adc430
--- /dev/null
+++ b/linux/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/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh b/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh
new file mode 100755
index 0000000..5f3ebe5
--- /dev/null
+++ b/linux/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/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh b/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
new file mode 100755
index 0000000..293dc16
--- /dev/null
+++ b/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
+
+# Setup Script Variables
+BINARY_TARBALL=$1;
+SETTINGS_FOLDER=$2;
+LAUNCHER_SCRIPT=$3;
+_EXTRACTED_TARBALL_FOLDER=./librewolf;
+
+# 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";
+cp -r $SETTINGS_FOLDER $_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;
+
+
diff --git a/linux/binary_tarball/toggle-settings.sh b/linux/binary_tarball/toggle-settings.sh
new file mode 100644
index 0000000..ff46bde
--- /dev/null
+++ b/linux/binary_tarball/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
bgstack15