Overhaul variable names

This commit is contained in:
Tad 2018-06-29 00:55:21 -04:00
parent 4917b3ebc7
commit d2ba1ddb20
60 changed files with 3800 additions and 3802 deletions

View file

@ -54,7 +54,7 @@ echo "Deblobbing..."
sepolicy=$sepolicy" atfwd.te";
#AudioFX (Audio Effects) [Qualcomm]
if [ "$DEBLOBBER_REMOVE_AUDIOFX" = true ]; then blobs=$blobs"|libasphere.so|libqcbassboost.so|libqcreverb.so|libqcvirt.so|libshoebox.so"; fi;
if [ "$DOS_DEBLOBBER_REMOVE_AUDIOFX" = true ]; then blobs=$blobs"|libasphere.so|libqcbassboost.so|libqcreverb.so|libqcvirt.so|libshoebox.so"; fi;
#Camera
#Attempted, don't waste your time...
@ -126,12 +126,12 @@ echo "Deblobbing..."
blobs=$blobs"|iop|libqti-iop-client.so|libqti-iop.so|QPerformance.jar";
#IMS (VoLTE/Wi-Fi Calling) [Qualcomm]
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then blobs=$blobs"|ims.apk|ims.xml|libimsmedia_jni.so"; fi; #IMS (Core) (To support carriers that have phased out 2G)
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then blobs=$blobs"|ims.apk|ims.xml|libimsmedia_jni.so"; fi; #IMS (Core) (To support carriers that have phased out 2G)
blobs=$blobs"|imscmlibrary.jar|imscmservice|imscm.xml|imsdatadaemon|imsqmidaemon|imssettings.apk|lib-imsdpl.so|lib-imscamera.so|libimscamera_jni.so|lib-imsqimf.so|lib-imsSDP.so|lib-imss.so|lib-imsvt.so|lib-imsxml.so"; #IMS
blobs=$blobs"|ims_rtp_daemon|lib-rtpcommon.so|lib-rtpcore.so|lib-rtpdaemoninterface.so|lib-rtpsl.so|vendor.qti.imsrtpservice.*.so"; #RTP
blobs=$blobs"|lib-dplmedia.so|librcc.so|libvcel.so|libvoice-svc.so|qti_permissions.xml"; #Misc.
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then blobs=$blobs"|volte_modem[/]"; fi;
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then sepolicy=$sepolicy" ims.te imscm.te imswmsproxy.te"; fi;
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then blobs=$blobs"|volte_modem[/]"; fi;
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then sepolicy=$sepolicy" ims.te imscm.te imswmsproxy.te"; fi;
#IPA (Internet Packet Accelerator) [Qualcomm]
#This is actually open source (excluding -diag)
@ -199,7 +199,7 @@ echo "Deblobbing..."
#Time Service [Qualcomm]
#Requires that android_hardware_sony_timekeep be included in repo manifest
if [ "$DEBLOBBER_REPLACE_TIME" = true ]; then
if [ "$DOS_DEBLOBBER_REPLACE_TIME" = true ]; then
#blobs=$blobs"|libtime_genoff.so"; #XXX: Breaks radio
blobs=$blobs"|libTimeService.so|time_daemon|TimeService.apk";
sepolicy=$sepolicy" qtimeservice.te";
@ -244,16 +244,16 @@ echo "Deblobbing..."
#
deblobDevice() {
devicePath="$1";
cd "$base$devicePath";
cd "$DOS_BUILD_BASE$devicePath";
if [ "${PWD##*/}" == "flo" ] || [ "${PWD##*/}" == "mako" ] || [ "${PWD##*/}" == "kona-common" ] || [ "${PWD##*/}" == "n5110" ] || [ "${PWD##*/}" == "smdk4412-common" ] || [ "${PWD##*/}" == "hdx-common" ] || [ "${PWD##*/}" == "thor" ] || [ "${PWD##*/}" == "flounder" ]; then #Some devices don't need/like TimeKeep
replaceTime="false";
fi;
if [ "$DEBLOBBER_REPLACE_TIME" = false ]; then replaceTime="false"; fi; #Disable replacement
if [ "$DOS_DEBLOBBER_REPLACE_TIME" = false ]; then replaceTime="false"; fi; #Disable replacement
if [ -f Android.mk ]; then
#Some devices store these in a dedicated firmware partition, others in /system/vendor/firmware, either way the following are just symlinks
#sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(CMN_SYMLINKS)//' Android.mk; #Remove CMN firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(DXHDCP2_SYMLINKS)//' Android.mk; #Remove Discretix firmware
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(IMS_SYMLINKS)//' Android.mk; fi; #Remove IMS firmware
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(IMS_SYMLINKS)//' Android.mk; fi; #Remove IMS firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(PLAYREADY_SYMLINKS)//' Android.mk; #Remove Microsoft Playready firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WIDEVINE_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WV_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
@ -294,7 +294,7 @@ deblobDevice() {
sed -i 's/ro.bluetooth.emb_wp_mode=true/ro.bluetooth.emb_wp_mode=false/' system.prop; #Disable WiPower
sed -i 's/ro.bluetooth.wipower=true/ro.bluetooth.wipower=false/' system.prop; #Disable WiPower
#Disable IMS
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then
sed -i 's/persist.data.iwlan.enable=true/persist.data.iwlan.enable=false/' system.prop;
sed -i 's/persist.ims.volte=true/persist.ims.volte=false/' system.prop;
sed -i 's/persist.ims.vt=true/persist.ims.vt=false/' system.prop;
@ -314,7 +314,7 @@ deblobDevice() {
if [ -f init/init_*.cpp ]; then
sed -i 's/property_set("persist.rcs.supported", ".");/property_set("persist.rcs.supported", "0");/' init/init_*.cpp; #Disable RCS
#Disable IMS
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then
sed -i 's/property_set("persist.ims.volte", "true");/property_set("persist.ims.volte", "false");/' init/init_*.cpp;
sed -i 's/property_set("persist.ims.vt", "true");/property_set("persist.ims.vt", "false");/' init/init_*.cpp;
sed -i 's/property_set("persist.radio.calls.on.ims", "true");/property_set("persist.radio.calls.on.ims", "false");/' init/init_*.cpp;
@ -328,7 +328,7 @@ deblobDevice() {
#sed -i 's|<bool name="config_enableWifiDisplay">true</bool>|<bool name="config_enableWifiDisplay">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
sed -i 's|<bool name="config_uiBlurEnabled">true</bool>|<bool name="config_uiBlurEnabled">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml; #Disable UIBlur
#Disable IMS
if [ "$DEBLOBBER_REMOVE_IMS" = true ]; then
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then
sed -i 's|<bool name="config_carrier_volte_available">true</bool>|<bool name="config_carrier_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
sed -i 's|<bool name="config_carrier_vt_available">true</bool>|<bool name="config_carrier_vt_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
sed -i 's|<bool name="config_device_volte_available">true</bool>|<bool name="config_device_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
@ -352,40 +352,40 @@ deblobDevice() {
rm -rf board/qcom-wipower.mk product/qcom-wipower.mk; #Remove WiPower makefiles
if [ -f setup-makefiles.sh ]; then
awk -i inplace '!/'$blobs'/' ./*proprietary*.txt; #Remove all blob references from blob manifest
bash -c "cd $base$devicePath && ./setup-makefiles.sh"; #Update the makefiles
bash -c "cd $DOS_BUILD_BASE$devicePath && ./setup-makefiles.sh"; #Update the makefiles
fi;
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f deblobDevice;
deblobKernel() {
kernelPath="$1";
cd "$base$kernelPath";
cd "$DOS_BUILD_BASE$kernelPath";
rm -rf $kernels;
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f deblobKernel;
deblobSepolicy() {
sepolicyPath="$1";
cd "$base$sepolicyPath";
cd "$DOS_BUILD_BASE$sepolicyPath";
if [ -d sepolicy ]; then
cd sepolicy;
rm -f $sepolicy;
fi;
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f deblobSepolicy;
deblobVendors() {
cd "$base";
cd "$DOS_BUILD_BASE";
find vendor -regextype posix-extended -regex '.*('$blobs')' -type f -delete; #Delete all blobs
}
export -f deblobVendors;
deblobVendor() {
makefile="$1";
cd "$base";
cd "$DOS_BUILD_BASE";
awk -i inplace '!/'$blobs'/' "$makefile"; #Remove all blob references from makefile
}
export -f deblobVendor;
@ -409,6 +409,6 @@ rm -rf vendor/samsung/nodevice;
#END OF DEBLOBBING
#
cd "$base";
cd "$DOS_BUILD_BASE";
echo "Deblobbing complete!"

View file

@ -15,7 +15,7 @@
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.
if [ "$NON_COMMERCIAL_USE_PATCHES" = true ]; then
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";
echo -e "\e[0;33mPLEASE SEE THE 'LICENSES' FILE AT THE ROOT OF THIS REPOSITORY FOR MORE INFORMATION\e[0m";
echo -e "\e[0;33mDISABLE THEM BY SETTING 'NON_COMMERCIAL_USE_PATCHES' TO 'false' IN 'Scripts/init.sh'\e[0m";
@ -23,15 +23,14 @@ if [ "$NON_COMMERCIAL_USE_PATCHES" = true ]; then
fi;
startPatcher() {
#$cvePatcher must be set!
java -jar "$cvePatcher" patch "$base" "$androidWorkspace""Patches/" "$cveScripts" $1;
java -jar "$DOS_PATCHER_BINARY" patch "$DOS_BUILD_BASE" "$DOS_WORKSPACE_ROOT""Patches/" "$DOS_SCRIPTS_CVES" $1;
}
export -f startPatcher;
enter() {
echo "================================================================================================"
dir="$1";
cd "$base$dir";
cd "$DOS_BUILD_BASE$dir";
echo "[ENTERING] $dir";
}
export -f enter;
@ -53,14 +52,14 @@ scanForMalware() {
excludes="--exclude-dir=\".git\" --exclude-dir=\".repo\"";
scanQueue="$2";
if [ "$1" = true ]; then
if [ "$MALWARE_SCAN_SETTING" != "quick" ] || [ "$MALWARE_SCAN_SETTING" = "extra" ]; then
scanQueue=$scanQueue" $base/frameworks $base/vendor";
if [ "$DOS_MALWARE_SCAN_SETTING" != "quick" ] || [ "$DOS_MALWARE_SCAN_SETTING" = "extra" ]; then
scanQueue=$scanQueue" $DOS_BUILD_BASE/frameworks $DOS_BUILD_BASE/vendor";
fi;
if [ "$MALWARE_SCAN_SETTING" = "slow" ]; then
scanQueue=$scanQueue"$base/external $base/prebuilts $base/toolchain $base/tools";
if [ "$DOS_MALWARE_SCAN_SETTING" = "slow" ]; then
scanQueue=$scanQueue"$DOS_BUILD_BASE/external $DOS_BUILD_BASE/prebuilts $DOS_BUILD_BASE/toolchain $DOS_BUILD_BASE/tools";
fi;
if [ "$MALWARE_SCAN_SETTING" = "full" ]; then
scanQueue="$base";
if [ "$DOS_MALWARE_SCAN_SETTING" = "full" ]; then
scanQueue="$DOS_BUILD_BASE";
fi;
fi;
du -hsc "$scanQueue";
@ -116,12 +115,12 @@ audit2allowADB() {
export -f audit2allowADB;
disableDexPreOpt() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
if [ -f BoardConfig.mk ]; then
sed -i "s/WITH_DEXPREOPT := true/WITH_DEXPREOPT := false/" BoardConfig.mk;
echo "Disabled dexpreopt";
fi;
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f disableDexPreOpt;
@ -134,9 +133,9 @@ compressRamdisks() {
export -f compressRamdisks;
enhanceLocation() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
#Enable GLONASS
if [ "$GLONASS_FORCED_ENABLE" = false ]; then
if [ "$DOS_GLONASS_FORCED_ENABLE" = false ]; then
sed -i 's/#A_GLONASS_POS_PROTOCOL_SELECT/A_GLONASS_POS_PROTOCOL_SELECT/' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
sed -i 's/A_GLONASS_POS_PROTOCOL_SELECT = 0.*/A_GLONASS_POS_PROTOCOL_SELECT = 15/' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
sed -i 's|A_GLONASS_POS_PROTOCOL_SELECT=0.*</item>|A_GLONASS_POS_PROTOCOL_SELECT=15</item>|' overlay/frameworks/base/core/res/res/values-*/*.xml &>/dev/null || true;
@ -159,33 +158,33 @@ enhanceLocation() {
fi;
fi;
echo "Enhanced location services for $1";
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f enhanceLocation;
enableZram() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
sed -i 's|#/dev/block/zram0|/dev/block/zram0|' fstab.* root/fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
echo "Enabled zram for $1";
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f enableZram;
enableForcedEncryption() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
sed -i 's|encryptable=/|forceencrypt=/|' fstab.* root/fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
echo "Enabled forceencrypt for $1";
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f enableForcedEncryption;
enableStrongEncryption() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
if [ -f BoardConfig.mk ]; then
echo "TARGET_WANTS_STRONG_ENCRYPTION := true" >> BoardConfig.mk;
echo "Enabled AES-256 encryption for $1";
fi;
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f enableStrongEncryption;
@ -207,43 +206,43 @@ changeDefaultDNS() {
dnsPrimaryV6="";
dnsSecondary="";
dnsSecondaryV6="";
if [ -z "$DNS_PRESET"]; then
if [[ "$DEFAULT_DNS_PRESET" == "Cloudflare" ]]; then #https://developers.cloudflare.com/1.1.1.1/commitment-to-privacy/privacy-policy/privacy-policy/
if [ -z "$DNS_PRESET" ]; then
if [[ "$DOS_DEFAULT_DNS_PRESET" == "Cloudflare" ]]; then #https://developers.cloudflare.com/1.1.1.1/commitment-to-privacy/privacy-policy/privacy-policy/
dnsPrimary="1.0.0.1";
dnsPrimaryV6="2606:4700:4700::1001";
dnsSecondary="1.1.1.1";
dnsSecondaryV6="2606:4700:4700::1111";
elif [[ "$DEFAULT_DNS_PRESET" == "OpenNIC" ]]; then #https://servers.opennicproject.org/edit.php?srv=ns3.any.dns.opennic.glue
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "OpenNIC" ]]; then #https://servers.opennicproject.org/edit.php?srv=ns3.any.dns.opennic.glue
dnsPrimary="169.239.202.202";
dnsPrimaryV6="2a05:dfc7:5353::53";
dnsSecondary="185.121.177.177";
dnsSecondaryV6="2a05:dfc7:5::53";
elif [[ "$DEFAULT_DNS_PRESET" == "DNSWATCH" ]]; then #https://dns.watch
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "DNSWATCH" ]]; then #https://dns.watch
dnsPrimary="84.200.69.80";
dnsPrimaryV6="2001:1608:10:25::1c04:b12f";
dnsSecondary="84.200.70.40";
dnsSecondaryV6="2001:1608:10:25::9249:d69b";
elif [[ "$DEFAULT_DNS_PRESET" == "Google" ]]; then #https://developers.google.com/speed/public-dns/privacy
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "Google" ]]; then #https://developers.google.com/speed/public-dns/privacy
dnsPrimary="8.8.8.8";
dnsPrimaryV6="2001:4860:4860::8888";
dnsSecondary="8.8.4.4";
dnsSecondaryV6="2001:4860:4860::8844";
elif [[ "$DEFAULT_DNS_PRESET" == "OpenDNS" ]]; then #https://www.cisco.com/c/en/us/about/legal/privacy-full.html
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "OpenDNS" ]]; then #https://www.cisco.com/c/en/us/about/legal/privacy-full.html
dnsPrimary="208.67.222.222";
dnsPrimaryV6="2620:0:ccc::2";
dnsSecondary="208.67.220.220";
dnsSecondaryV6="2620:0:ccd::2";
elif [[ "$DEFAULT_DNS_PRESET" == "Quad9" ]]; then #https://www.quad9.net/privacy/
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "Quad9" ]]; then #https://www.quad9.net/privacy/
dnsPrimary="9.9.9.9";
dnsPrimaryV6="2620:fe::fe";
dnsSecondary="149.112.112.112";
dnsSecondaryV6="2620:fe::fe"; #no secondary available
elif [[ "$DEFAULT_DNS_PRESET" == "Quad9U" ]]; then #https://www.quad9.net/privacy/
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "Quad9U" ]]; then #https://www.quad9.net/privacy/
dnsPrimary="9.9.9.10";
dnsPrimaryV6="2620:fe::10";
dnsSecondary="149.112.112.10";
dnsSecondaryV6="2620:fe::10"; #no secondary available
elif [[ "$DEFAULT_DNS_PRESET" == "Verisign" ]]; then #https://www.verisign.com/en_US/security-services/public-dns/terms-of-service/index.xhtml
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "Verisign" ]]; then #https://www.verisign.com/en_US/security-services/public-dns/terms-of-service/index.xhtml
dnsPrimary="64.6.64.6";
dnsPrimaryV6="2620:74:1b::1:1";
dnsSecondary="64.6.65.6";
@ -268,7 +267,7 @@ editKernelLocalversion() {
export -f editKernelLocalversion;
hardenDefconfig() {
cd "$base$1";
cd "$DOS_BUILD_BASE$1";
#Attempts to enable/disable supported options to increase security
#See https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings
@ -304,6 +303,6 @@ hardenDefconfig() {
editKernelLocalversion "-dos";
echo "Hardened defconfig for $1";
cd "$base";
cd "$DOS_BUILD_BASE";
}
export -f hardenDefconfig;

View file

@ -17,24 +17,24 @@
#Attempts to patch kernels to be more secure
#Is this the best way to do it? No. Is it the proper way to do it? No. Do I wish device maintainers would do it? Yes. Is it better then nothing? YES!
#Is this the best way to do it? No. Is it the proper way to do it? No. Is it better then nothing? YES!
#Troubleshooting a patch
##If you get an error like the following
#> ../../../../../../kernel/nextbit/msm8992/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c:1116:32: error: 'ACTUATOR_POWER_UP' undeclared (first use in this function)
#$ cd $cvePatchesLinux
#$ cd $DOS_CVES_LINUX
#$ grep "ACTUATOR_POWER_UP" . -Ri
#> ./CVE-2018-3585/3.10/0001.patch:+ if (a_ctrl->actuator_state != ACTUATOR_POWER_UP) {
#$ nano $cveScripts/android_kernel_nextbit_msm8992.sh
#$ nano $DOS_SCRIPTS_CVES/android_kernel_nextbit_msm8992.sh
# Comment out CVE-2018-3585/3.10/0001.patch
echo "Patching CVEs...";
cd "$base";
for patcher in "$cveScripts"/*.sh; do
cd "$DOS_BUILD_BASE";
for patcher in "$DOS_SCRIPTS_CVES"/*.sh; do
echo "Running $patcher";
source "$patcher";
done;
cd "$base";
cd "$DOS_BUILD_BASE";
echo "Patched CVEs!";