22
33[ $API -lt 23 ] && abort " The system API of $API is less than the minimum api of 23!"
44
5- NEWFOL=" /storage/emulated/0/Android/data/com.pittvandewitt.viperfx/files"
6-
5+ VIPERFXPACKAGE=" com.pittvandewitt.viperfx"
6+ SDCARD=" /storage/emulated/0"
7+ FOLDER=" $SDCARD /Android/data/$VIPERFXPACKAGE /files"
78
89# Uninstall v4a app if installed
9- VIPERFXPACKAGE=" com.pittvandewitt.viperfx"
10- [ -n " $( pm list packages | grep " $VIPERFXPACKAGE " ) " ] && pm uninstall " $VIPERFXPACKAGE " > /dev/null 2>&1
10+ [ -n " $( pm list packages | grep " $VIPERFXPACKAGE " ) " ] && pm uninstall " $VIPERFXPACKAGE " & > /dev/null
1111
12- MODULEROOT=${MODPATH%/* }
13- NVBASE=${MODULEROOT%/* }
12+ MODULEROOT=" ${MODPATH%/* } "
13+ NVBASE=" ${MODULEROOT%/* } "
1414# Tell user aml is needed if applicable
15- FILES=$( find $NVBASE /modules/* /system $MODULEROOT /* /system -type f -name " *audio_effects*.conf" -o -name " *audio_effects*.xml" -not -path " $NVBASE /modules/ViPER4AndroidFX/*" 2> /dev/null | sed " /ViPER4AndroidFX/d" )
15+ FILES=$( find " $NVBASE " /modules/* /system " $MODULEROOT " /* /system -type f -name " *audio_effects*.conf" -o -name " *audio_effects*.xml" -not -path " $NVBASE /modules/ViPER4AndroidFX/*" 2> /dev/null | sed " /ViPER4AndroidFX/d" )
1616if [ ! -z " $FILES " ] && [ ! " $( echo $FILES | grep ' /aml/' ) " ]; then
1717 ui_print " "
1818 ui_print " ! Conflicting audio mod found !"
@@ -21,74 +21,50 @@ if [ ! -z "$FILES" ] && [ ! "$(echo $FILES | grep '/aml/')" ]; then
2121 ui_print " "
2222fi
2323
24- # Create the new scoped storage directory
25- ui_print " "
26- ui_print " - Placing Files to New Directory:"
27- ui_print " $NEWFOL "
28- mkdir -p $NEWFOL
24+ # Create the scoped storage directory
25+ mkdir -p " $FOLDER "
2926
30- [ ! -d " $NEWFOL /DDC" ] && mkdir -p " $NEWFOL /DDC" 2> /dev/null
31- SDCARD=" /storage/emulated/0"
27+ [ ! -d " $FOLDER " /DDC ] && mkdir -p " $FOLDER " /DDC 2> /dev/null
3228CUSTOM_VDC_FILES=$( find $SDCARD / -name ' *.vdc' -not -path " $SDCARD /Android/*" -not -path " $SDCARD /$( grep_prop id $MODPATH /module.prop) /*" )
3329[ -n " $CUSTOM_VDC_FILES " ] && CUSTOM_VDC_FOUND=true || CUSTOM_VDC_FOUND=false
34- [ -z " $( ls " $NEWFOL /DDC" 2> /dev/null) " ] && DDC_FOLDER_EMPTY=true || DDC_FOLDER_EMPTY=false
30+ [ -z " $( ls " $FOLDER " /DDC 2> /dev/null) " ] && DDC_FOLDER_EMPTY=true || DDC_FOLDER_EMPTY=false
3531if [ $DDC_FOLDER_EMPTY = true ] && [ $CUSTOM_VDC_FOUND = false ]; then
36- ui_print " "
3732 ui_print " - Copying original V4A vdcs"
38- ui_print " "
3933 ui_print " Note that some of these aren't that great"
4034 ui_print " Check out here for better ones:"
4135 ui_print " https://t.me/vdcservice"
42- ui_print " "
43- mkdir -p " $NEWFOL /DDC" 2> /dev/null
44- unzip -oj $MODPATH /vdcs.zip -d $NEWFOL /DDC >&2
36+ mkdir -p " $FOLDER " /DDC 2> /dev/null
37+ unzip -oj " $MODPATH " /vdcs.zip -d " $FOLDER " /DDC >&2
4538else
46- ui_print " "
4739 ui_print " Skipping Viper original vdc copy"
4840 [ $DDC_FOLDER_EMPTY = false ] && ui_print " the folder is not empty"
4941 [ $CUSTOM_VDC_FOUND = true ] && ui_print " custom vdcs have been found"
50- ui_print " "
5142fi
52- rm $MODPATH /vdcs.zip > /dev/null 2>&1
43+ rm " $MODPATH " /vdcs.zip > /dev/null 2>&1
5344if [ $CUSTOM_VDC_FOUND = true ]; then
54- ui_print " "
5545 ui_print " - Copying custom V4A vdcs"
56- ui_print " "
57- ui_print " Found these custom files:"
58- ui_print " $CUSTOM_VDC_FILES "
59- ui_print " "
6046 for file in $CUSTOM_VDC_FILES ; do
61- cp -fv " $file " " $NEWFOL /DDC"
47+ ui_print " $file "
48+ cp -f " $file " " $FOLDER " /DDC
6249 done
6350fi
6451
65-
66- if [ -z " $( ls " $NEWFOL /Kernel" 2> /dev/null) " ]; then
67- ui_print " "
52+ if [ -z " $( ls " $FOLDER " /Kernel 2> /dev/null) " ]; then
6853 ui_print " - Copying Viper IRS files"
69- ui_print " "
70- mkdir -p $NEWFOL /Kernel 2> /dev/null
71- unzip -oj $MODPATH /ViperIRS.zip -d $NEWFOL /Kernel >&2
54+ mkdir -p " $FOLDER " /Kernel 2> /dev/null
55+ unzip -oj " $MODPATH " /ViperIRS.zip -d " $FOLDER " /Kernel >&2
7256else
73- ui_print " "
74- ui_print " Skipping Viper IRS copy, folder is not empty"
75- ui_print " "
57+ ui_print " - Skipping Viper IRS copy, folder is not empty"
7658fi
77- rm $MODPATH /ViperIRS.zip > /dev/null 2>&1
78-
79- # Force driver reinstall to clear out old stuff in event of change from installed version
80- umount -l $( mount | awk ' {print $3}' | grep ' libv4a_fx.so' )
81- killall audioserver
82-
59+ rm " $MODPATH " /ViperIRS.zip 2> /dev/null
8360
84- ui_print " "
85- ui_print " - Patching existing audio_effects files..."
61+ ui_print " - Patching system audio files"
8662AUDIO_EFFECTS_FILES=" $( find /system /vendor -type f -name " *audio_effects*.conf" -o -name " *audio_effects*.xml" ) "
8763for ORIGINAL_FILE in $AUDIO_EFFECTS_FILES ; do
8864 ui_print " Patching $ORIGINAL_FILE "
8965 FILE=" $MODPATH $( echo " $ORIGINAL_FILE " | sed " s|^/vendor|/system/vendor|g" ) "
90- mkdir -p $( dirname $FILE )
91- cp -v " $ORIGINAL_FILE " " $FILE "
66+ mkdir -p " $( dirname $FILE ) "
67+ cp " $ORIGINAL_FILE " " $FILE "
9268 case " $FILE " in
9369 * .conf)
9470 sed -i " /v4a_standard_fx {/,/}/d" " $FILE "
@@ -106,44 +82,35 @@ for ORIGINAL_FILE in $AUDIO_EFFECTS_FILES; do
10682done
10783
10884AUDIOFX_PACKAGE=" org.lineageos.audiofx"
109- if [ -n " $( pm list packages | grep $AUDIOFX_PACKAGE ) " ]; then
110- ui_print " "
85+ if [ -n " $( pm list packages | grep " $AUDIOFX_PACKAGE " ) " ]; then
11186 ui_print " - Disabling $AUDIOFX_PACKAGE "
112- if [ -n " $( pm list packages -d | grep $AUDIOFX_PACKAGE ) " ]; then
87+ if [ -n " $( pm list packages -d | grep " $AUDIOFX_PACKAGE " ) " ]; then
11388 ui_print" $AUDIOFX_PACKAGE is already disabled"
11489 else
115- pm disable $AUDIOFX_PACKAGE
90+ pm disable " $AUDIOFX_PACKAGE "
11691 fi
117- ui_print " "
11892fi
11993
120- ui_print " "
121- ui_print " - Installing ViPER4AndroidFX $( grep_prop version $MODPATH /module.prop) ..."
122- ui_print " After this completes, reboot your device."
123- ui_print " "
94+ ui_print " - Installing the ViPER4AndroidFX user app"
12495APK_INSTALL_FOLDER=" /data/local"
12596(
126- cp -f " $MODPATH /v4afx.apk" " $APK_INSTALL_FOLDER /v4afx.apk" || exit 1
127- pm install $APK_INSTALL_FOLDER /v4afx.apk > /dev/null 2>&1
97+ cp -f " $MODPATH " /v4afx.apk " $APK_INSTALL_FOLDER " /v4afx.apk || exit 1
98+ pm install " $APK_INSTALL_FOLDER " /v4afx.apk & > /dev/null
12899 RET=$?
129- rm " $APK_INSTALL_FOLDER /v4afx.apk"
100+ rm " $APK_INSTALL_FOLDER " /v4afx.apk
130101 exit $RET
131102) || abort " Failed to install V4AFX!"
132- pm disable $VIPERFXPACKAGE > /dev/null 2>&1
103+ pm disable " $VIPERFXPACKAGE " & > /dev/null
133104
134- ui_print " "
135105ui_print " - Configuring ViPER4Android"
136- ui_print " "
137- VIPERFXPREFS=" $( pm dump $VIPERFXPACKAGE | grep dataDir | head -n 1 | cut -d' =' -f2) "
106+ VIPERFXPREFS=" $( pm dump " $VIPERFXPACKAGE " | grep dataDir | head -n 1 | cut -d' =' -f2) "
138107VIPERFXPREFSOWNER=" $( stat -c ' %U' " $VIPERFXPREFS " ) "
139- VIPERFXSHAREDPREFS=" $VIPERFXPREFS /shared_prefs"
108+ VIPERFXSHAREDPREFS=" $VIPERFXPREFS " /shared_prefs
140109[ ! -d " $VIPERFXSHAREDPREFS " ] && mkdir " $VIPERFXSHAREDPREFS "
141- cp -f " $MODPATH /viperfx_preferences.xml" " $VIPERFXSHAREDPREFS / ${VIPERFXPACKAGE} _preferences.xml"
110+ cp -f " $MODPATH " /viperfx_preferences.xml " $VIPERFXSHAREDPREFS " / " ${VIPERFXPACKAGE} _preferences.xml"
142111chown -R $VIPERFXPREFSOWNER :$VIPERFXPREFSOWNER " $VIPERFXPREFS "
143112
144- ui_print " "
145113ui_print " - Setting Permissions"
146- ui_print " "
147- set_perm_recursive $MODPATH 0 0 0755 0644
148- set_perm_recursive $MODPATH /system/vendor 0 0 0755 0644 u:object_r:vendor_file:s0
149- [ -d $MODPATH /system/vendor/etc ] && set_perm_recursive $MODPATH /system/vendor/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0
114+ set_perm_recursive " $MODPATH " 0 0 0755 0644
115+ set_perm_recursive " $MODPATH " /system/vendor 0 0 0755 0644 u:object_r:vendor_file:s0
116+ [ -d " $MODPATH " /system/vendor/etc ] && set_perm_recursive " $MODPATH " /system/vendor/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0
0 commit comments