diff --git a/Scripts/Common/Copy_Keys.sh b/Scripts/Common/Copy_Keys.sh index b9bb075d..91eab679 100644 --- a/Scripts/Common/Copy_Keys.sh +++ b/Scripts/Common/Copy_Keys.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -uo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; if [ -d "$DOS_SIGNING_KEYS" ]; then echo "Copying verity/avb public keys to kernels..."; diff --git a/Scripts/Common/Deblob.sh b/Scripts/Common/Deblob.sh index 7ceddc43..d12603ac 100644 --- a/Scripts/Common/Deblob.sh +++ b/Scripts/Common/Deblob.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -uo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Goal: Remove as many proprietary blobs without breaking core functionality #Outcome: Increased battery/performance/privacy/security, Decreased ROM size diff --git a/Scripts/Common/Fix_CVE_Patchers.sh b/Scripts/Common/Fix_CVE_Patchers.sh index 394e5ed3..2286efae 100644 --- a/Scripts/Common/Fix_CVE_Patchers.sh +++ b/Scripts/Common/Fix_CVE_Patchers.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; commentPatches() { file="$1"; diff --git a/Scripts/Common/Functions.sh b/Scripts/Common/Functions.sh index 95fd35c6..18cb40f9 100644 --- a/Scripts/Common/Functions.sh +++ b/Scripts/Common/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; if [ "$DOS_NON_COMMERCIAL_USE_PATCHES" = true ]; then echo -e "\e[0;33mWARNING: YOU HAVE ENABLED PATCHES THAT WHILE ARE OPEN SOURCE ARE ALSO ENCUMBERED BY RESTRICTIVE LICENSES\e[0m"; diff --git a/Scripts/Common/Optimize.sh b/Scripts/Common/Optimize.sh index 47cb1fcf..994ccd6f 100644 --- a/Scripts/Common/Optimize.sh +++ b/Scripts/Common/Optimize.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Attempts to increase performance and battery life #Last verified: 2021-10-16 diff --git a/Scripts/Common/Patch_CVE.sh b/Scripts/Common/Patch_CVE.sh index 1169fd5f..228e479d 100644 --- a/Scripts/Common/Patch_CVE.sh +++ b/Scripts/Common/Patch_CVE.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -uo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Attempts to patch kernels to be more secure diff --git a/Scripts/Common/Post.sh b/Scripts/Common/Post.sh index efe407ea..f1053785 100644 --- a/Scripts/Common/Post.sh +++ b/Scripts/Common/Post.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; echo "Post tweaks..."; diff --git a/Scripts/Common/Shell.sh b/Scripts/Common/Shell.sh new file mode 100644 index 00000000..0e8e5928 --- /dev/null +++ b/Scripts/Common/Shell.sh @@ -0,0 +1,32 @@ +#!/bin/bash +#DivestOS: A privacy focused mobile distribution +#Copyright (c) 2017-2021 Divested Computing Group +# +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see . + +umask 0022; +unalias cp &>/dev/null || true; +unalias mv &>/dev/null || true; +unalias rm &>/dev/null || true; +unalias ln &>/dev/null || true; +unalias mount &>/dev/null || true; +unalias unmount &>/dev/null || true; +unalias chown &>/dev/null || true; +unalias chmod &>/dev/null || true; +unalias chgrp &>/dev/null || true; +unalias rmdir &>/dev/null || true; +unalias mkdir &>/dev/null || true; +unalias patch &>/dev/null || true; +alias patch='patch --no-backup-if-mismatch'; +alias cp='cp --reflink=auto' diff --git a/Scripts/Generate_Signing_Keys.sh b/Scripts/Generate_Signing_Keys.sh index 6e5c4365..9165a62d 100644 --- a/Scripts/Generate_Signing_Keys.sh +++ b/Scripts/Generate_Signing_Keys.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Reference (MIT): https://grapheneos.org/build#generating-release-signing-keys diff --git a/Scripts/LineageOS-14.1/Defaults.sh b/Scripts/LineageOS-14.1/Defaults.sh index c49de8cf..a0bd12c7 100644 --- a/Scripts/LineageOS-14.1/Defaults.sh +++ b/Scripts/LineageOS-14.1/Defaults.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Changes various default settings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-14.1/Functions.sh b/Scripts/LineageOS-14.1/Functions.sh index 74b8ef65..78bb13c7 100644 --- a/Scripts/LineageOS-14.1/Functions.sh +++ b/Scripts/LineageOS-14.1/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index 2f43f167..631b858a 100644 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Last verified: 2021-10-16 @@ -38,6 +40,7 @@ set -euo pipefail; #START OF PREPRATION # #Download some (non-executable) out-of-tree files for use later on +alias patch='patch --no-backup-if-mismatch'; cd "$DOS_TMP_DIR"; if [ "$DOS_HOSTS_BLOCKING" = true ]; then $DOS_TOR_WRAPPER wget "$DOS_HOSTS_BLOCKING_LIST" -N -O "$DOS_HOSTS_FILE"; fi; cd "$DOS_BUILD_BASE"; diff --git a/Scripts/LineageOS-14.1/Rebrand.sh b/Scripts/LineageOS-14.1/Rebrand.sh index ee7fdac1..441d541b 100644 --- a/Scripts/LineageOS-14.1/Rebrand.sh +++ b/Scripts/LineageOS-14.1/Rebrand.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Updates select user facing strings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-14.1/Theme.sh b/Scripts/LineageOS-14.1/Theme.sh index 406ae362..be18d344 100644 --- a/Scripts/LineageOS-14.1/Theme.sh +++ b/Scripts/LineageOS-14.1/Theme.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Replaces teal accents with orange/yellow ones #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-15.1/Defaults.sh b/Scripts/LineageOS-15.1/Defaults.sh index b6aa1ae7..17d2e677 100644 --- a/Scripts/LineageOS-15.1/Defaults.sh +++ b/Scripts/LineageOS-15.1/Defaults.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Changes various default settings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-15.1/Functions.sh b/Scripts/LineageOS-15.1/Functions.sh index 4d2fc0dc..d528bfdc 100644 --- a/Scripts/LineageOS-15.1/Functions.sh +++ b/Scripts/LineageOS-15.1/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; #Last verified: 2021-10-16 @@ -87,8 +88,7 @@ patchWorkspace() { touch DOS_PATCHED_FLAG; if [ "$DOS_MALWARE_SCAN_ENABLED" = true ]; then scanForMalware false "$DOS_PREBUILT_APPS $DOS_BUILD_BASE/build $DOS_BUILD_BASE/device $DOS_BUILD_BASE/vendor/lineage"; fi; - source build/envsetup.sh; - repopick -it O_asb_2021-10; + #source build/envsetup.sh; sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS_COMMON/Copy_Keys.sh"; diff --git a/Scripts/LineageOS-15.1/Patch.sh b/Scripts/LineageOS-15.1/Patch.sh index ae3fe393..3a358d98 100644 --- a/Scripts/LineageOS-15.1/Patch.sh +++ b/Scripts/LineageOS-15.1/Patch.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-15.1/Rebrand.sh b/Scripts/LineageOS-15.1/Rebrand.sh index e71f9f83..18979eac 100644 --- a/Scripts/LineageOS-15.1/Rebrand.sh +++ b/Scripts/LineageOS-15.1/Rebrand.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Updates select user facing strings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-16.0/Defaults.sh b/Scripts/LineageOS-16.0/Defaults.sh index 72c7f05c..43e8ed14 100644 --- a/Scripts/LineageOS-16.0/Defaults.sh +++ b/Scripts/LineageOS-16.0/Defaults.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Changes various default settings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-16.0/Functions.sh b/Scripts/LineageOS-16.0/Functions.sh index 0a73350f..4dcebb8d 100644 --- a/Scripts/LineageOS-16.0/Functions.sh +++ b/Scripts/LineageOS-16.0/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; #Last verified: 2021-10-16 @@ -75,9 +76,8 @@ patchWorkspace() { touch DOS_PATCHED_FLAG; if [ "$DOS_MALWARE_SCAN_ENABLED" = true ]; then scanForMalware false "$DOS_PREBUILT_APPS $DOS_BUILD_BASE/build $DOS_BUILD_BASE/device $DOS_BUILD_BASE/vendor/lineage"; fi; - source build/envsetup.sh; + #source build/envsetup.sh; #repopick -it pie-firewall; - repopick -it P_asb_2021-10; sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS_COMMON/Copy_Keys.sh"; diff --git a/Scripts/LineageOS-16.0/Patch.sh b/Scripts/LineageOS-16.0/Patch.sh index 438b689a..f8d46f7a 100644 --- a/Scripts/LineageOS-16.0/Patch.sh +++ b/Scripts/LineageOS-16.0/Patch.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-16.0/Rebrand.sh b/Scripts/LineageOS-16.0/Rebrand.sh index 617c550a..3f8583a6 100644 --- a/Scripts/LineageOS-16.0/Rebrand.sh +++ b/Scripts/LineageOS-16.0/Rebrand.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Updates select user facing strings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-17.1/Defaults.sh b/Scripts/LineageOS-17.1/Defaults.sh index c4e88c33..374ef2b6 100644 --- a/Scripts/LineageOS-17.1/Defaults.sh +++ b/Scripts/LineageOS-17.1/Defaults.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Changes various default settings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-17.1/Functions.sh b/Scripts/LineageOS-17.1/Functions.sh index 1a3f1eb8..dd32675f 100644 --- a/Scripts/LineageOS-17.1/Functions.sh +++ b/Scripts/LineageOS-17.1/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-17.1/Patch.sh b/Scripts/LineageOS-17.1/Patch.sh index fcf0ed57..7f316ff2 100644 --- a/Scripts/LineageOS-17.1/Patch.sh +++ b/Scripts/LineageOS-17.1/Patch.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-17.1/Rebrand.sh b/Scripts/LineageOS-17.1/Rebrand.sh index 09a8db2a..6d69438c 100644 --- a/Scripts/LineageOS-17.1/Rebrand.sh +++ b/Scripts/LineageOS-17.1/Rebrand.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Updates select user facing strings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-18.1/Defaults.sh b/Scripts/LineageOS-18.1/Defaults.sh index abfb0c5e..39ebdc36 100644 --- a/Scripts/LineageOS-18.1/Defaults.sh +++ b/Scripts/LineageOS-18.1/Defaults.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Changes various default settings #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-18.1/Functions.sh b/Scripts/LineageOS-18.1/Functions.sh index f7569ea3..57dbfa68 100644 --- a/Scripts/LineageOS-18.1/Functions.sh +++ b/Scripts/LineageOS-18.1/Functions.sh @@ -14,6 +14,7 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index e00e7317..8c799d07 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Last verified: 2021-10-16 diff --git a/Scripts/LineageOS-18.1/Rebrand.sh b/Scripts/LineageOS-18.1/Rebrand.sh index fa377693..cdb9af67 100644 --- a/Scripts/LineageOS-18.1/Rebrand.sh +++ b/Scripts/LineageOS-18.1/Rebrand.sh @@ -14,7 +14,9 @@ # #You should have received a copy of the GNU General Public License #along with this program. If not, see . +umask 0022; set -euo pipefail; +source "$DOS_SCRIPTS_COMMON/Shell.sh"; #Updates select user facing strings #Last verified: 2021-10-16 diff --git a/Scripts/init.sh b/Scripts/init.sh index d89ade08..93efca16 100644 --- a/Scripts/init.sh +++ b/Scripts/init.sh @@ -165,7 +165,6 @@ export GRADLE_OPTS="-Xmx2048m"; export TZ=:/etc/localtime; export LC_ALL=C; export LANG=en_US.UTF-8; -alias patch='patch --no-backup-if-mismatch'; #START OF VERIFICATION #gpgVerifyGitHead $DOS_WORKSPACE_ROOT; @@ -174,12 +173,6 @@ alias patch='patch --no-backup-if-mismatch'; #gpgVerifyGitHead $DOS_WALLPAPERS; #END OF VERIFICATION +source "$DOS_SCRIPTS_COMMON/Shell.sh"; source "$DOS_SCRIPTS_COMMON/Functions.sh"; source "$DOS_SCRIPTS/Functions.sh"; - -unalias cp &>/dev/null || true; -unalias mv &>/dev/null || true; -unalias rm &>/dev/null || true; -unalias ln &>/dev/null || true; - -alias cp='cp --reflink=auto'