Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit f9f6560

Browse files
committed
Set user configurable options from environment
This allows setting environment variables rather than editing init.sh and sets default values when the variables aren't found in the environment.
1 parent 39a9117 commit f9f6560

File tree

4 files changed

+71
-71
lines changed

4 files changed

+71
-71
lines changed

Container/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ Either proceed manually (https://divestos.org/pages/build#init) or use the scrip
2424
./phase-1.sh "20.0" |& tee phase-1.log
2525
```
2626

27-
b. Choose your options (optional)
27+
b. Set options (optional)
28+
29+
See Scripts/init.sh for available options. For example:
2830

2931
```sh
30-
nano DivestOS/Scripts/init.sh
32+
export DOS_BRANDING_ORG="My Company"
3133
```
3234

3335
c. Add vendor blobs

Container/phase-1.sh

-7
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ else
3232
echo "WARNING: gocryptfs failed. Signing keys will not be encrypted!"
3333
fi
3434

35-
# Update paths
36-
# https://backreference.org/2009/12/09/using-shell-variables-in-sed/index.html
37-
safe_pattern=$(printf '%s\n' "$(pwd)" | sed 's/[[\.*^$/]/\\&/g')
38-
sed -i "s/\(^export DOS_WORKSPACE_ROOT=\).*/\1\"$safe_pattern\"/" Scripts/init.sh
39-
safe_pattern=$(printf '%s\n' "$(pwd)/Builds" | sed 's/[[\.*^$/]/\\&/g')
40-
sed -i "s/\(^export DOS_BUILDS=\).*/\1\"$safe_pattern\"/" Scripts/init.sh
41-
4235
# Add the initial manifest
4336
cd "Build/LineageOS-$version/"
4437
cat "../../Manifests/Manifest_LAOS-$version.xml" > .repo/local_manifests/local_manifest.xml

Container/phase-2.sh

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ if [ "$2" = "" ]; then
1010
exit 1
1111
fi
1212

13+
# Update paths
14+
DOS_WORKSPACE_ROOT="$(pwd)/DivestOS"
15+
export DOS_WORKSPACE_ROOT
16+
export DOS_BUILDS="$DOS_WORKSPACE_ROOT/Builds"
17+
1318
cd "DivestOS/Build/LineageOS-$version"
1419

1520
# Download

Scripts/init.sh

+62-62
Original file line numberDiff line numberDiff line change
@@ -21,87 +21,87 @@
2121
#START OF USER CONFIGURABLE OPTIONS
2222
#
2323
#General
24-
export DOS_WORKSPACE_ROOT="/mnt/dos/"; #XXX: THIS MUST BE CORRECT TO BUILD!
24+
export DOS_WORKSPACE_ROOT="${DOS_WORKSPACE_ROOT:-/mnt/dos/}"; #XXX: THIS MUST BE CORRECT TO BUILD!
2525
#export DOS_BUILDS=$DOS_WORKSPACE_ROOT"Builds/";
26-
export DOS_BUILDS="/mnt/Storage-1/DivestOS/Builds/"; #XXX: THIS MUST BE CORRECT TO BUILD!
27-
export DOS_SIGNING_KEYS="$DOS_WORKSPACE_ROOT/Signing_Keys/4096pro";
28-
export DOS_SIGNING_GPG="$DOS_WORKSPACE_ROOT/Signing_Keys/gnupg";
26+
export DOS_BUILDS="${DOS_BUILDS:-/mnt/Storage-1/DivestOS/Builds/}"; #XXX: THIS MUST BE CORRECT TO BUILD!
27+
export DOS_SIGNING_KEYS="${DOS_SIGNING_KEYS:-$DOS_WORKSPACE_ROOT/Signing_Keys/4096pro}";
28+
export DOS_SIGNING_GPG="${DOS_SIGNING_GPG:-$DOS_WORKSPACE_ROOT/Signing_Keys/gnupg}";
2929
#export USE_CCACHE=1;
3030
#export CCACHE_DIR="";
31-
export CCACHE_COMPRESS=1;
32-
export CCACHE_COMPRESSLEVEL=1;
31+
export CCACHE_COMPRESS="${CCACHE_COMPRESS:-1}";
32+
export CCACHE_COMPRESSLEVEL="${CCACHE_COMPRESSLEVEL:-1}";
3333
#export DOS_BINARY_PATCHER="";
34-
export DOS_MALWARE_SCAN_ENABLED=false; #Set true to perform a fast scan on patchWorkspace() and a through scan on buildAll()
35-
export DOS_MALWARE_SCAN_SETTING="quick"; #buildAll() scan speed. Options: quick, extra, slow, full
36-
export DOS_REFRESH_PATCHES=true; #Set true to refresh branch-specific patches on apply
34+
export DOS_MALWARE_SCAN_ENABLED="${DOS_MALWARE_SCAN_ENABLED:-false}"; #Set true to perform a fast scan on patchWorkspace() and a through scan on buildAll()
35+
export DOS_MALWARE_SCAN_SETTING="${DOS_MALWARE_SCAN_SETTING:-quick}"; #buildAll() scan speed. Options: quick, extra, slow, full
36+
export DOS_REFRESH_PATCHES="${DOS_REFRESH_PATCHES:-true}"; #Set true to refresh branch-specific patches on apply
3737

3838
#Deblobber
39-
export DOS_DEBLOBBER_REMOVE_ACCESSORIES=true; #Set false to allow use of external accessories that depend on blobs
40-
export DOS_DEBLOBBER_REMOVE_ATFWD=true; #Set true to remove basic ATFWD blobs
41-
export DOS_DEBLOBBER_REMOVE_AUDIOFX=true; #Set true to remove AudioFX
42-
export DOS_DEBLOBBER_REMOVE_APTX=false; #Set true to remove aptX Bluetooth codec
43-
export DOS_DEBLOBBER_REMOVE_CNE=true; #Set true to remove all CNE blobs #XXX: Breaks Wi-Fi calling
44-
export DOS_DEBLOBBER_REMOVE_DPM=true; #Set true to remove all DPM blobs #XXX: Maybe breaks multi-sim and carrier aggregation (LTE+)
45-
export DOS_DEBLOBBER_REMOVE_DPP=false; #Set true to remove all Display Post Processing blobs #XXX: Breaks boot on select devices
46-
export DOS_DEBLOBBER_REMOVE_FACE=false; #Set true to remove all face unlock blobs
47-
export DOS_DEBLOBBER_REMOVE_FP=false; #Set true to remove all fingerprint reader blobs
48-
export DOS_DEBLOBBER_REMOVE_EUICC=true; #Set true to remove all Google eUICC blobs
49-
export DOS_DEBLOBBER_REMOVE_EUICC_FULL=false; #Set true to remove all hardware eUICC blobs
50-
export DOS_DEBLOBBER_REMOVE_IMS=false; #Set true to remove all IMS blobs #XXX: Carriers are phasing out 3G, making IMS mandatory for calls
51-
export DOS_DEBLOBBER_REMOVE_IPA=false; #Set true to remove all IPA blobs
52-
export DOS_DEBLOBBER_REMOVE_IR=false; #Set true to remove all IR blobs
53-
export DOS_DEBLOBBER_REMOVE_RCS=true; #Set true to remove all RCS blobs
39+
export DOS_DEBLOBBER_REMOVE_ACCESSORIES="${DOS_DEBLOBBER_REMOVE_ACCESSORIES:-true}"; #Set false to allow use of external accessories that depend on blobs
40+
export DOS_DEBLOBBER_REMOVE_ATFWD="${DOS_DEBLOBBER_REMOVE_ATFWD:-true}"; #Set true to remove basic ATFWD blobs
41+
export DOS_DEBLOBBER_REMOVE_AUDIOFX="${DOS_DEBLOBBER_REMOVE_AUDIOFX:-true}"; #Set true to remove AudioFX
42+
export DOS_DEBLOBBER_REMOVE_APTX="${DOS_DEBLOBBER_REMOVE_APTX:-false}"; #Set true to remove aptX Bluetooth codec
43+
export DOS_DEBLOBBER_REMOVE_CNE="${DOS_DEBLOBBER_REMOVE_CNE:-true}"; #Set true to remove all CNE blobs #XXX: Breaks Wi-Fi calling
44+
export DOS_DEBLOBBER_REMOVE_DPM="${DOS_DEBLOBBER_REMOVE_DPM:-true}"; #Set true to remove all DPM blobs #XXX: Maybe breaks multi-sim and carrier aggregation (LTE+)
45+
export DOS_DEBLOBBER_REMOVE_DPP="${DOS_DEBLOBBER_REMOVE_DPP:-false}"; #Set true to remove all Display Post Processing blobs #XXX: Breaks boot on select devices
46+
export DOS_DEBLOBBER_REMOVE_FACE="${DOS_DEBLOBBER_REMOVE_FACE:-false}"; #Set true to remove all face unlock blobs
47+
export DOS_DEBLOBBER_REMOVE_FP="${DOS_DEBLOBBER_REMOVE_FP:-false}"; #Set true to remove all fingerprint reader blobs
48+
export DOS_DEBLOBBER_REMOVE_EUICC="${DOS_DEBLOBBER_REMOVE_EUICC:-true}"; #Set true to remove all Google eUICC blobs
49+
export DOS_DEBLOBBER_REMOVE_EUICC_FULL="${DOS_DEBLOBBER_REMOVE_EUICC_FULL:-false}"; #Set true to remove all hardware eUICC blobs
50+
export DOS_DEBLOBBER_REMOVE_IMS="${DOS_DEBLOBBER_REMOVE_IMS:-false}"; #Set true to remove all IMS blobs #XXX: Carriers are phasing out 3G, making IMS mandatory for calls
51+
export DOS_DEBLOBBER_REMOVE_IPA="${DOS_DEBLOBBER_REMOVE_IPA:-false}"; #Set true to remove all IPA blobs
52+
export DOS_DEBLOBBER_REMOVE_IR="${DOS_DEBLOBBER_REMOVE_IR:-false}"; #Set true to remove all IR blobs
53+
export DOS_DEBLOBBER_REMOVE_RCS="${DOS_DEBLOBBER_REMOVE_RCS:-true}"; #Set true to remove all RCS blobs
5454

5555
#Features
56-
export DOS_HOSTS_BLOCKING=true; #Set false to prevent inclusion of a HOSTS file
57-
export DOS_HOSTS_BLOCKING_LIST="https://divested.dev/hosts-wildcards"; #Must be in the format "127.0.0.1 bad.domain.tld"
58-
export DOS_SENSORS_PERM=false; #Set true to provide a per-app sensors permission for 14.1/15.1 #XXX: can break things like camera
59-
export DOS_USE_KSM=false; #Set true to use KSM for increased memory efficiency at the cost of easier side-channel attacks and increased CPU usage #XXX: testing only
56+
export DOS_HOSTS_BLOCKING="${DOS_HOSTS_BLOCKING:-true}"; #Set false to prevent inclusion of a HOSTS file
57+
export DOS_HOSTS_BLOCKING_LIST="${DOS_HOSTS_BLOCKING_LIST:-https://divested.dev/hosts-wildcards}"; #Must be in the format "127.0.0.1 bad.domain.tld"
58+
export DOS_SENSORS_PERM="${DOS_SENSORS_PERM:-false}"; #Set true to provide a per-app sensors permission for 14.1/15.1 #XXX: can break things like camera
59+
export DOS_USE_KSM="${DOS_USE_KSM:-false}"; #Set true to use KSM for increased memory efficiency at the cost of easier side-channel attacks and increased CPU usage #XXX: testing only
6060

6161
#Servers
62-
export DOS_DEFAULT_DNS_PRESET="Quad9"; #Sets default DNS. Options: See changeDefaultDNS() in Scripts/Common/Functions.sh
63-
export DOS_GPS_NTP_SERVER="2.android.pool.ntp.org"; #Options: Any NTP pool
64-
export DOS_GPS_SUPL_HOST="supl.google.com"; #Options: Any *valid* SUPL server
62+
export DOS_DEFAULT_DNS_PRESET="${DOS_DEFAULT_DNS_PRESET:-Quad9}"; #Sets default DNS. Options: See changeDefaultDNS() in Scripts/Common/Functions.sh
63+
export DOS_GPS_NTP_SERVER="${DOS_GPS_NTP_SERVER:-2.android.pool.ntp.org}"; #Options: Any NTP pool
64+
export DOS_GPS_SUPL_HOST="${DOS_GPS_SUPL_HOST:-supl.google.com}"; #Options: Any *valid* SUPL server
6565

6666
#Release Processing
67-
export DOS_MALWARE_SCAN_BEFORE_SIGN=false; #Scan device files for malware before signing
68-
export DOS_GENERATE_DELTAS=false; #Creates deltas from existing target_files in $DOS_BUILDS
69-
export DOS_AUTO_ARCHIVE_BUILDS=true; #Copies files to $DOS_BUILDS after signing
70-
export DOS_REMOVE_AFTER=true; #Removes device OUT directory after complete to reclaim space. Requires AUTO_ARCHIVE_BUILDS=true
71-
export DOS_REMOVE_AFTER_FULL=false; #Removes the entire OUT directory
72-
export DOS_GPG_SIGNING=true;
73-
export DOS_GPG_SIGNING_KEY="B8744D67F9F1E14E145DFD8E7F627E920F316994";
67+
export DOS_MALWARE_SCAN_BEFORE_SIGN="${DOS_MALWARE_SCAN_BEFORE_SIGN:-false}"; #Scan device files for malware before signing
68+
export DOS_GENERATE_DELTAS="${DOS_GENERATE_DELTAS:-false}"; #Creates deltas from existing target_files in $DOS_BUILDS
69+
export DOS_AUTO_ARCHIVE_BUILDS="${DOS_AUTO_ARCHIVE_BUILDS:-true}"; #Copies files to $DOS_BUILDS after signing
70+
export DOS_REMOVE_AFTER="${DOS_REMOVE_AFTER:-true}"; #Removes device OUT directory after complete to reclaim space. Requires AUTO_ARCHIVE_BUILDS=true
71+
export DOS_REMOVE_AFTER_FULL="${DOS_REMOVE_AFTER_FULL:-false}"; #Removes the entire OUT directory
72+
export DOS_GPG_SIGNING="${DOS_GPG_SIGNING:-true}";
73+
export DOS_GPG_SIGNING_KEY="${DOS_GPG_SIGNING_KEY:-B8744D67F9F1E14E145DFD8E7F627E920F316994}";
7474

7575
#Branding
76-
export DOS_BRANDING_ORG="Divested Computing Group";
77-
export DOS_BRANDING_NAME="DivestOS";
78-
export DOS_BRANDING_EMAIL="[email protected]";
79-
export DOS_BRANDING_ZIP_PREFIX="divested";
80-
export DOS_BRANDING_BOOTANIMATION_FONT="Fira-Sans-Heavy"; #Options: $ convert -list font
81-
export DOS_BRANDING_BOOTANIMATION_STYLE="plasma"; #Options: gradient, plasma
76+
export DOS_BRANDING_ORG="${DOS_BRANDING_ORG:-Divested Computing Group}";
77+
export DOS_BRANDING_NAME="${DOS_BRANDING_NAME:-DivestOS}";
78+
export DOS_BRANDING_EMAIL="${DOS_BRANDING_EMAIL:-support@divestos.org}";
79+
export DOS_BRANDING_ZIP_PREFIX="${DOS_BRANDING_ZIP_PREFIX:-divested}";
80+
export DOS_BRANDING_BOOTANIMATION_FONT="${DOS_BRANDING_BOOTANIMATION_FONT:-Fira-Sans-Heavy}"; #Options: $ convert -list font
81+
export DOS_BRANDING_BOOTANIMATION_STYLE="${DOS_BRANDING_BOOTANIMATION_STYLE:-plasma}"; #Options: gradient, plasma
8282
#export DOS_BRANDING_BOOTANIMATION_COLOR="#FF5722-#FF8A65"; #gradient
83-
export DOS_BRANDING_BOOTANIMATION_COLOR="#FF5722-#03A9F4"; #plasma
84-
export DOS_BRANDING_LINK_ABOUT="https://divestos.org/pages/about";
85-
export DOS_BRANDING_LINK_NEWS="https://divestos.org/pages/news";
86-
export DOS_BRANDING_LINK_PRIVACY="https://divestos.org/pages/privacy_policy";
83+
export DOS_BRANDING_BOOTANIMATION_COLOR="${DOS_BRANDING_BOOTANIMATION_COLOR:-#FF5722-#03A9F4}"; #plasma
84+
export DOS_BRANDING_LINK_ABOUT="${DOS_BRANDING_LINK_ABOUT:-https://divestos.org/pages/about}";
85+
export DOS_BRANDING_LINK_NEWS="${DOS_BRANDING_LINK_NEWS:-https://divestos.org/pages/news}";
86+
export DOS_BRANDING_LINK_PRIVACY="${DOS_BRANDING_LINK_PRIVACY:-https://divestos.org/pages/privacy_policy}";
8787

8888
#OTAs
89-
export DOS_OTA_SERVER_PRIMARY="https://divestos.org/updater.php";
90-
export DOS_OTA_SERVER_EXTENDED=true; #Enable to provide multiple choices as set below
91-
export DOS_OTA_SERVER_SECONDARY="https://divestos.eeyo.re/updater.php";
92-
export DOS_OTA_SERVER_SECONDARY_NAME="Cloudflare";
93-
export DOS_OTA_SERVER_ONION_PRIMARY="http://divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion/updater.php";
94-
export DOS_OTA_SERVER_ONION_SECONDARY="http://2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion/updater.php";
95-
export DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY="divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion"; #Used for network security config
96-
export DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY="2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion";
89+
export DOS_OTA_SERVER_PRIMARY="${DOS_OTA_SERVER_PRIMARY:-https://divestos.org/updater.php}";
90+
export DOS_OTA_SERVER_EXTENDED="${DOS_OTA_SERVER_EXTENDED:-true}"; #Enable to provide multiple choices as set below
91+
export DOS_OTA_SERVER_SECONDARY="${DOS_OTA_SERVER_SECONDARY:-https://divestos.eeyo.re/updater.php}";
92+
export DOS_OTA_SERVER_SECONDARY_NAME="${DOS_OTA_SERVER_SECONDARY_NAME:-Cloudflare}";
93+
export DOS_OTA_SERVER_ONION_PRIMARY="${DOS_OTA_SERVER_ONION_PRIMARY:-http://divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion/updater.php}";
94+
export DOS_OTA_SERVER_ONION_SECONDARY="${DOS_OTA_SERVER_ONION_SECONDARY:-http://2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion/updater.php}";
95+
export DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY="${DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY:-divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion}"; #Used for network security config
96+
export DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY="${DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY:-2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion}";
9797

9898
#Theme
99-
export DOS_THEME_50="FFCA28"; #Amber 400
100-
export DOS_THEME_100="FFC107"; #Amber 500
101-
export DOS_THEME_200="FFA726"; #Orange 400
102-
export DOS_THEME_300="FF9800"; #Orange 500
103-
export DOS_THEME_500="FF5722"; #Deep Orange 500
104-
export DOS_THEME_700="E64A19"; #Deep Orange 700
99+
export DOS_THEME_50="${DOS_THEME_50:-FFCA28}"; #Amber 400
100+
export DOS_THEME_100="${DOS_THEME_100:-FFC107}"; #Amber 500
101+
export DOS_THEME_200="${DOS_THEME_200:-FFA726}"; #Orange 400
102+
export DOS_THEME_300="${DOS_THEME_300:-FF9800}"; #Orange 500
103+
export DOS_THEME_500="${DOS_THEME_500:-FF5722}"; #Deep Orange 500
104+
export DOS_THEME_700="${DOS_THEME_700:-E64A19}"; #Deep Orange 700
105105
#
106106
#END OF USER CONFIGURABLE OPTIONS
107107
#

0 commit comments

Comments
 (0)