CI: enable shellcheck

Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
Tavi 2024-05-29 12:04:44 -04:00
parent 03e48ad81b
commit 42a5da8f16
No known key found for this signature in database
GPG Key ID: E599F62ECBAEAF2E
4 changed files with 13 additions and 0 deletions

7
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,7 @@
shell check:
image: koalaman/shellcheck-alpine:stable
stage: test
before_script:
- shellcheck --version
script:
- shellcheck --severity=error Scripts/*.sh Scripts/*/*.sh Scripts/*/*/*.sh

View File

@ -746,6 +746,7 @@ deblobDevice() {
sed -i 's|name="dpm_enabled" type="int"> 1 <|name="dpm_enabled" type="int"> 0 <|' configs/qmi_config.xml; #Disable DPM sed -i 's|name="dpm_enabled" type="int"> 1 <|name="dpm_enabled" type="int"> 0 <|' configs/qmi_config.xml; #Disable DPM
fi; fi;
fi; fi;
# shellcheck disable=SC2144
if [ -f init/init_*.cpp ]; then if [ -f init/init_*.cpp ]; then
#Disable IMS #Disable IMS
if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then if [ "$DOS_DEBLOBBER_REMOVE_IMS" = true ]; then

View File

@ -123,6 +123,7 @@ gpgVerifyDirectory() {
export -f gpgVerifyDirectory; export -f gpgVerifyDirectory;
scanForMalware() { scanForMalware() {
# shellcheck disable=SC2144
if [ -x /usr/bin/clamscan ] && [ -r /var/lib/clamav/main.c*d ]; then if [ -x /usr/bin/clamscan ] && [ -r /var/lib/clamav/main.c*d ]; then
echo -e "\e[0;32mStarting a malware scan...\e[0m"; echo -e "\e[0;32mStarting a malware scan...\e[0m";
local excludes="--exclude-dir=\".git\" --exclude-dir=\".repo\""; local excludes="--exclude-dir=\".git\" --exclude-dir=\".repo\"";
@ -402,6 +403,7 @@ processRelease() {
#grep update_engine Build/*/device/*/*/*.mk -l #grep update_engine Build/*/device/*/*/*.mk -l
local DOS_GENERATE_DELTAS_DEVICES=('akari' 'akatsuki' 'alioth' 'Amber' 'aura' 'aurora' 'avicii' 'barbet' 'bluejay' 'blueline' 'bonito' 'bramble' 'cheetah' 'cheryl' 'coral' 'crosshatch' 'davinci' 'discovery' 'enchilada' 'fajita' 'felix' 'flame' 'FP3' 'FP4' 'guacamole' 'guacamoleb' 'hotdog' 'hotdogb' 'instantnoodle' 'instantnoodlep' 'kebab' 'kirin' 'lemonade' 'lemonadep' 'lemonades' 'lynx' 'marlin' 'mata' 'mermaid' 'oriole' 'panther' 'pioneer' 'pro1' 'pro1x' 'raven' 'redfin' 'sailfish' 'sargo' 'sunfish' 'taimen' 'tangorpro' 'vayu' 'voyager' 'walleye' 'xz2c'); #TODO: check lmi/alioth/apollon local DOS_GENERATE_DELTAS_DEVICES=('akari' 'akatsuki' 'alioth' 'Amber' 'aura' 'aurora' 'avicii' 'barbet' 'bluejay' 'blueline' 'bonito' 'bramble' 'cheetah' 'cheryl' 'coral' 'crosshatch' 'davinci' 'discovery' 'enchilada' 'fajita' 'felix' 'flame' 'FP3' 'FP4' 'guacamole' 'guacamoleb' 'hotdog' 'hotdogb' 'instantnoodle' 'instantnoodlep' 'kebab' 'kirin' 'lemonade' 'lemonadep' 'lemonades' 'lynx' 'marlin' 'mata' 'mermaid' 'oriole' 'panther' 'pioneer' 'pro1' 'pro1x' 'raven' 'redfin' 'sailfish' 'sargo' 'sunfish' 'taimen' 'tangorpro' 'vayu' 'voyager' 'walleye' 'xz2c'); #TODO: check lmi/alioth/apollon
if [ "$DOS_GENERATE_DELTAS" = true ]; then if [ "$DOS_GENERATE_DELTAS" = true ]; then
# shellcheck disable=SC2199
if [[ " ${DOS_GENERATE_DELTAS_DEVICES[@]} " =~ " ${DEVICE} " ]]; then if [[ " ${DOS_GENERATE_DELTAS_DEVICES[@]} " =~ " ${DEVICE} " ]]; then
for LAST_TARGET_FILES in $ARCHIVE/target_files/$DOS_BRANDING_ZIP_PREFIX-$VERSION-*-dos-$DEVICE-target_files.zip; do for LAST_TARGET_FILES in $ARCHIVE/target_files/$DOS_BRANDING_ZIP_PREFIX-$VERSION-*-dos-$DEVICE-target_files.zip; do
if [[ -f "$LAST_TARGET_FILES.id" ]]; then if [[ -f "$LAST_TARGET_FILES.id" ]]; then
@ -457,6 +459,7 @@ processRelease() {
if [ "$hasRecoveryImg" == "1" ] || [ "$hasDtboImg" == "0" ]; then cp -v $OUT_DIR/$PREFIX-fastboot.zip* $ARCHIVE/fastboot/ || true; fi; if [ "$hasRecoveryImg" == "1" ] || [ "$hasDtboImg" == "0" ]; then cp -v $OUT_DIR/$PREFIX-fastboot.zip* $ARCHIVE/fastboot/ || true; fi;
if [ "$hasRecoveryImg" == "0" ] && [ "$hasDtboImg" == "1" ]; then cp -v $OUT_DIR/$PREFIX-recovery.img* $ARCHIVE/ || true; fi; if [ "$hasRecoveryImg" == "0" ] && [ "$hasDtboImg" == "1" ]; then cp -v $OUT_DIR/$PREFIX-recovery.img* $ARCHIVE/ || true; fi;
if [ "$DOS_GENERATE_DELTAS" = true ]; then if [ "$DOS_GENERATE_DELTAS" = true ]; then
# shellcheck disable=SC2199
if [[ " ${DOS_GENERATE_DELTAS_DEVICES[@]} " =~ " ${DEVICE} " ]]; then if [[ " ${DOS_GENERATE_DELTAS_DEVICES[@]} " =~ " ${DEVICE} " ]]; then
cp -v $OUT_DIR/$PREFIX-target_files.zip* $ARCHIVE/target_files/ || true; cp -v $OUT_DIR/$PREFIX-target_files.zip* $ARCHIVE/target_files/ || true;
cp -v $OUT_DIR/$PREFIX-incremental_*.zip* $ARCHIVE/incrementals/ || true; cp -v $OUT_DIR/$PREFIX-incremental_*.zip* $ARCHIVE/incrementals/ || true;

View File

@ -29,6 +29,7 @@ echo "==========================================================================
for f in */verifiedboot_relkeys.der.x509 for f in */verifiedboot_relkeys.der.x509
do do
device=$(dirname $f); device=$(dirname $f);
# shellcheck disable=SC2199
if [[ " ${VERITY_DEVICES[@]} " =~ " ${device} " ]]; then if [[ " ${VERITY_DEVICES[@]} " =~ " ${device} " ]]; then
echo "Device: $device"; echo "Device: $device";
sha1=$(cat $f | openssl dgst -sha1 -c | sed 's/SHA1(stdin)= //' | tr [a-z] [A-Z]); sha1=$(cat $f | openssl dgst -sha1 -c | sed 's/SHA1(stdin)= //' | tr [a-z] [A-Z]);
@ -48,6 +49,7 @@ echo "==========================================================================
for f in */avb_pkmd.bin for f in */avb_pkmd.bin
do do
device=$(dirname $f); device=$(dirname $f);
# shellcheck disable=SC2199
if [[ " ${AVB_DEVICES[@]} " =~ " ${device} " ]]; then if [[ " ${AVB_DEVICES[@]} " =~ " ${device} " ]]; then
echo "Device: $device"; echo "Device: $device";
sha256=$(cat $f | openssl dgst -sha256 | sed 's/SHA2-256(stdin)= //' | tr [a-z] [A-Z]); sha256=$(cat $f | openssl dgst -sha256 | sed 's/SHA2-256(stdin)= //' | tr [a-z] [A-Z]);