2017-10-29 01:48:53 -04:00
#!/bin/bash
2024-04-22 07:48:54 -04:00
#DivestOS: A mobile operating system divested from the norm.
#Copyright (c) 2017-2023 Divested Computing Group
2017-11-05 10:58:01 -05:00
#
#This program is free software: you can redistribute it and/or modify
2024-07-27 18:00:56 -04:00
#it under the terms of the GNU Affero General Public License as published by
2017-11-05 10:58:01 -05:00
#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
2024-07-27 18:00:56 -04:00
#GNU Affero General Public License for more details.
2017-11-05 10:58:01 -05:00
#
2024-07-27 18:00:56 -04:00
#You should have received a copy of the GNU Affero General Public License
2024-07-27 18:31:21 -04:00
#along with this program. If not, see <https://www.gnu.org/licenses/>.
2021-10-16 19:15:19 -04:00
umask 0022;
2021-10-16 15:28:15 -04:00
set -uo pipefail;
2021-10-16 19:15:19 -04:00
source " $DOS_SCRIPTS_COMMON /Shell.sh " ;
2017-10-29 01:48:53 -04:00
#Attempts to patch kernels to be more secure
2018-06-29 00:55:21 -04:00
#Is this the best way to do it? No. Is it the proper way to do it? No. Is it better then nothing? YES!
2017-10-29 14:23:02 -04:00
2018-05-20 14:57:54 -04:00
#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)
2018-06-29 00:55:21 -04:00
#$ cd $DOS_CVES_LINUX
2018-05-20 14:57:54 -04:00
#$ grep "ACTUATOR_POWER_UP" . -Ri
#> ./CVE-2018-3585/3.10/0001.patch:+ if (a_ctrl->actuator_state != ACTUATOR_POWER_UP) {
2018-06-29 00:55:21 -04:00
#$ nano $DOS_SCRIPTS_CVES/android_kernel_nextbit_msm8992.sh
2018-05-20 14:57:54 -04:00
# Comment out CVE-2018-3585/3.10/0001.patch
2018-04-23 08:59:18 -04:00
echo "Patching CVEs..." ;
2017-10-29 01:48:53 -04:00
2018-06-29 00:55:21 -04:00
cd " $DOS_BUILD_BASE " ;
for patcher in " $DOS_SCRIPTS_CVES " /*.sh; do
2018-06-23 00:21:48 -04:00
echo " Running $patcher " ;
2023-03-07 23:41:14 -05:00
source " $patcher " || true;
2017-10-29 02:43:38 -04:00
done ;
2017-10-29 01:48:53 -04:00
2018-06-29 00:55:21 -04:00
cd " $DOS_BUILD_BASE " ;
2021-10-16 15:28:15 -04:00
echo -e "\e[0;32m[SCRIPT COMPLETE] Patched CVEs\e[0m" ;