-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
maintenanceroutines.bash
378 lines (360 loc) · 19.9 KB
/
maintenanceroutines.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
#!/usr/bin/env bash
## Copyright 2017-2022 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
## Hosted sdrausty.github.io/TermuxArch courtesy https://pages.github.com
## https://sdrausty.github.io/TermuxArch/README has info about this project.
## https://sdrausty.github.io/TermuxArch/CONTRIBUTORS Thank you for your help.
################################################################################
_COPYIMAGE_() { # A systemimage.tar.gz file can be used: 'setupTermuxArch ./[path/]systemimage.tar.gz' and 'setupTermuxArch /absolutepath/systemimage.tar.gz'
if [[ "$LCP" = "0" ]]
then
printf "%s\\n" "Copying $GFILE.md5 to $INSTALLDIR..."
cp "$GFILE".md5 "$INSTALLDIR"
printf "%s\\n" "Copying $GFILE to $INSTALLDIR..."
cp "$GFILE" "$INSTALLDIR"
elif [[ "$LCP" = "1" ]]
then
printf "%s\\n" "Copying $GFILE.md5 to $INSTALLDIR..."
cp "$WDIR$GFILE".md5 "$INSTALLDIR"
printf "%s\\n" "Copying $GFILE to $INSTALLDIR..."
cp "$WDIR$GFILE" "$INSTALLDIR"
fi
GFILE="${GFILE##/*/}"
IFILE="${GFILE##*/}"
}
_DOFUNLCR2_() {
_BKPTHF_() { # backup file to backup file directory
cp "$INSTALLDIR/home/$TALUSER/$DOFLNAME" "$BKPDIR/$DOFLNAME.$SDATE.bkp" && printf "\\e[0;32mFile '%s' backed up to '\\e[1;32m%s\\e[0;32m'. " "$INSTALLDIR/home/$TALUSER/$DOFLNAME" "$BKPDIR/$DOFLNAME.$SDATE.bkp"
}
_CPYFRT_() { # copy file from root login to user
cp "$INSTALLDIR/root/$DOFLNAME" "$INSTALLDIR/home/$TALUSER/" && printf "\\e[0;32mFile '%s' copied to '\\e[1;32m%s\\e[0;32m'. " "${INSTALLDIR##*/}/root/$DOFLNAME" "${INSTALLDIR##*/}/home/$TALUSER/$DOFLNAME"
}
BKPDIR="$INSTALLDIR/var/backups/${INSTALLDIR##*/}/home/$TALUSER"
[ -d "$BKPDIR" ] || mkdir -p "$BKPDIR"
if [ "$TALUSER" != alarm ]
then
DOFLIST_=(.bash_logout .bash_profile .bashrc .cshrc .emacs .gitconfig .initrc .inputrc .vimrc .profile .zshrc)
for DOFLNAME in "${DOFLIST_[@]}"
do
printf "\\n\\e[0;32mProcessing user \\e[1;32m%s\\e[0;32m file \\e[1;32m%s\\e[0;32m. " "$TALUSER" "$DOFLNAME"
if [ -f "$INSTALLDIR/root/$DOFLNAME" ] && [ -f "$INSTALLDIR/home/$TALUSER/$DOFLNAME" ]
then
diff "$INSTALLDIR/root/$DOFLNAME" "$INSTALLDIR/home/$TALUSER/$DOFLNAME" 1>/dev/null || { _BKPTHF_ && _CPYFRT_ ; }
elif [ -f "$INSTALLDIR/root/$DOFLNAME" ] && [ ! -f "$INSTALLDIR/home/$TALUSER/$DOFLNAME" ]
then
_CPYFRT_
fi
done
fi
}
_DOTHRF_() { # do the root user files
[ -f $1 ] && { printf "\\e[1;32m%s\\e[0;32m%s\\e[0m\\n" "==>" " cp $1 /var/backups/${INSTALLDIR##*/}/$1.$SDATE.bkp" && cp "$1" "$INSTALLDIR/var/backups/${INSTALLDIR##*/}/$1.$SDATE.bkp" ; } || printf "%s" "copy file '$1' if found; file not found; continuing; "
}
_FUNLCR2_() { # copy from root to home
export FLCRVAR=($(ls home/))
for TALUSER in "${FLCRVAR[@]}"
do
_DOFUNLCR2_
done
}
_PPLCACHEDIR_() {
printf '\e[0;32mPopulating from cache files: \e[1;32mBEGUN…\n\e[0;32mThe \e[1;32m%s\e[0;32m command can be used to populate the cache. The command \e[1;32m%s\e[0;32m will repopulate the installation package files from the cache directory and update the TermuxArch files to the newest published version.\n\e[1;32m' "'trim'" "'${0##*/} ref'"
{ [ -e "$CACHEDIR" ] && cd "$CACHEDIR" && printf '%s' "cd $CACHEDIR && " ; } || { cd "$PREFIXDATAFILES" && mkdir -p "$PREFIXDATAFILESUFIX" && cd "$CACHEDIR" && printf '%s\n' "cd $PREFIXDATAFILES && mkdir -p $PREFIXDATAFILESUFIX && cd $CACHEDIR && " ; } || exit 196
cd "$INSTALLDIR" && printf '%s\n' "cd $INSTALLDIR" || exit 196
find "$CACHEDIR" -type f -name "*tar.gz*" -exec ln -s {} \; 2>/dev/null
[ -d "$INSTALLDIR"/var/cache/pacman/pkg ] || { mkdir -p "$INSTALLDIR"/var/cache/pacman/pkg && printf '%s' "mkdir -p $INSTALLDIR/var/cache/pacman/pkg && " ; }
cd "$INSTALLDIR"/var/cache/pacman/pkg && printf '%s\n' "cd $INSTALLDIR/var/cache/pacman/pkg" || exit 196
printf '%s\n' "find "$CACHEDIR$CACHEDIRSUFIX" -type f -exec ln -s {} \;" && find "$CACHEDIR$CACHEDIRSUFIX" -type f -exec ln -s {} \; 2>/dev/null
cd "$INSTALLDIR" && printf '%s\n' "cd $INSTALLDIR" || exit 196
printf '\e[0;32mPopulating from cache files: \e[1;32mDONE\n\n'
}
_DOUSECACHEDIR_() {
if { [ "$USECACHEDIR" = 0 ] && [ -z "${LCR:-}" ] ; } || { [ "$USECACHEDIR" = 0 ] && [ "${LCR:-}" = 3 ] ; }
then
_PPLCACHEDIR_
fi
}
_LOADIMAGE_() {
_NAMESTARTARCH_
_SPACEINFO_
printf "\\n"
_PREPINSTALLDIR_
_COPYIMAGE_
_MD5CHECK_
_PRINTCU_
rm -f "$INSTALLDIR"/*.tar.gz "$INSTALLDIR"/*.tar.gz.md5
_PRINTDONE_
_PRINTCONFIGUP_
_TOUCHUPSYS_
printf "\\n"
_PRINTFOOTER_
set +Eeuo pipefail
"$INSTALLDIR/$STARTBIN" || _PRINTPROOTERROR_
set -Eeuo pipefail
_PRINTFOOTER2_
_PRINTSTARTBIN_USAGE_
exit
}
_FIXOWNER_() { # fix owner of INSTALLDIR/home/USER, PR by @petkar
_DOFIXOWNER_() {
printf "\\e[0;32m%s" "Adjusting ownership and permissions: BEGUN"
FXARR="$(ls "$INSTALLDIR/home")"
for TALUSER in ${FXARR[@]}
do
if [[ "$TALUSER" != alarm ]]
then
$STARTBIN c "chmod 777 $INSTALLDIR/home/$TALUSER"
$STARTBIN c "chown -R $TALUSER:$TALUSER $INSTALLDIR/home/$TALUSER"
fi
done
printf "\\e[0;32m%s\\e[0m\\n" ": DONE"
}
# _DOFIXOWNER_ || _PSGI1ESTRING_ "_DOFIXOWNER_ maintenanceroutines.bash ${0##*/}"
}
_REFRESHSYS_() { # refresh installation
printf '\033]2; setupTermuxArch refresh 📲 \007'
_NAMESTARTARCH_
_SPACEINFO_
_PREPINSTALLDIR_
_DOUSECACHEDIR_
_SETLOCALE_
printf "\\n"
printf "\\e[1;32m==> \\e[1;37m%s \\e[1;32m%s %s...\\n" "Running" "${0##*/}" "$ARGS"
"$INSTALLDIR"/root/bin/setupbin.bash || _PRINTPROOTERROR_
rm -f root/bin/finishsetup.bash
rm -f root/bin/setupbin.bash
printf "\\n\\e[1;32mFiles updated to the newest version %s:\\n\\e[0;32m" "$VERSIONID"
ls "$INSTALLDIR/$STARTBIN" | cut -f7- -d /
ls "$INSTALLDIR"/bin/we | cut -f7- -d /
ls "$INSTALLDIR"/root/.bashrc | cut -f7- -d /
ls "$INSTALLDIR"/root/.bash_profile | cut -f7- -d /
ls "$INSTALLDIR"/root/.vimrc | cut -f7- -d /
ls "$INSTALLDIR"/root/.gitconfig | cut -f7- -d /
printf "\\n\\e[1;32m%s\\n\\e[0;32m" "Files updated to the newest version $VERSIONID in directory ~/${INSTALLDIR##*/}$TMXRCHBNDR/:"
ls "$INSTALLDIR$TMXRCHBNDR/"
if [[ "${LCR:-}" = 2 ]] || [[ "${LCR:-}" = 3 ]] || [[ "${LCR:-}" = 4 ]] || [[ "${LCR:-}" = 5 ]]
then
_FUNLCR2_
_SHFUNCWRAP_
else
printf "\\n\\e[0;32mIn order to refresh user directories, please use '\\e[1;32m%s re[fresh]\\e[0;32m'. " "${0##*/}"
fi
printf "\\n"
_PRINTFOOTER_
set +Eeuo pipefail
$STARTBIN || _PRINTPROOTERROR_
set -Eeuo pipefail
_PRINTFOOTER2_
_PRINTSTARTBIN_USAGE_
exit
}
_SHFUNC_ () {
_SHFDFUNC_ () {
SHFD="$(find "$RMDIR" -type d -printf '%03d %p\n' | sort -r -n -k 1 | cut -d" " -f 2)"
for SHF1D in $SHFD
do
rmdir "$SHF1D" || printf "%s" "Cannot 'rmdir $SHF1D': Continuing..."
done
}
printf "\n%s\n" "Script '${0##*/}' checking and fixing permissions in directory '$PWD': STARTED..."
SDIRS="apex data host-rootfs sdcard storage system vendor"
for SDIR in $SDIRS
do
RMDIR="$INSTALLDIR/$SDIR"
[ -d "$RMDIR" ] && { chmod 755 "$RMDIR" ; printf "%s" "Deleting superfluous '$RMDIR' directory: " && { rmdir "$RMDIR" || _SHFDFUNC_ ; } && printf "%s\n" "Continuing..." ; }
done
PERRS="$(du "$INSTALLDIR" 2>&1 >/dev/null ||:)"
PERRS="$(sed "s/du: cannot read directory '//g" <<< "$PERRS" | sed "s/': Permission denied//g")"
[ -z "$PERRS" ] || { printf "%s" "Fixing permissions in '$INSTALLDIR': " && for PERR in $PERRS ; do chmod 777 "$PERR" ; done && printf "%s\n" "DONE" ; } || printf "%s" "Fixing permissions signal PERRS: Continuing..."
printf "%s\n" "Script '${0##*/}' checking and fixing permissions: DONE"
}
_SHFUNCWRAP_ () {
if [[ "${LCR:-}" -eq 3 ]] || [[ "${LCR:-}" -eq 4 ]] || [[ "${LCR:-}" -eq 5 ]]
then
_PREPPACMANCONF_
FNDTMPROOT=($(find "$TMPDIR" -maxdepth 1 -type d -name "proot*"))
if [ ${#FNDTMPROOT[@]} = 0 ]
then
_SHFUNC_ "$@"
else
if [ ${#FNDTMPROOT[@]} = 1 ]
then
printf "\\n\\e[0;34m%s" "Found ${#FNDTMPROOT[@]} open Termux PRoot QEMU session; Not checking for errors."
else
printf "\\n\\e[0;34m%s" "Found ${#FNDTMPROOT[@]} open Termux PRoot QEMU sessions; Not checking for errors."
fi
fi
fi
}
_SPACEINFO_() {
declare SPACEMESSAGE=""
units="$(df "$INSTALLDIR" | awk 'FNR == 1 {print $2}')"
if [[ "$units" = Size ]]
then
_SPACEINFOGSIZE_
printf "$SPACEMESSAGE"
elif [[ "$units" = 1K-blocks ]]
then
_SPACEINFOKSIZE_
printf "$SPACEMESSAGE"
fi
}
_SPACEINFOGSIZE_() {
_USERSPACE_
if [[ "$CPUABI" = "$CPUABIX86" ]] || [[ "$CPUABI" = "$CPUABIX8664" ]]
then
if [[ "$USRSPACE" = *G ]]
then
SPACEMESSAGE=""
elif [[ "$USRSPACE" = *M ]]
then
USSPACE="${USRSPACE: : -1}"
fi
if [[ "$USSPACE" -lt "800" ]] && [[ "$CPUABI" = "$CPUABIX8664" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. \\e[33mThere is only $USRSPACE of free user space is available on this device. \\e[1;30mThe recommended minimum to install Arch Linux in Termux PRoot for x86_64 architecture is 800M of free user space.\\e[0m\\n"
fi
if [[ "$USSPACE" -lt "600" ]] && [[ "$CPUABI" = "$CPUABIX86" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. \\e[33mThere is only $USRSPACE of free user space is available on this device. \\e[1;30mThe recommended minimum to install Arch Linux in Termux PRoot for $CPUABI architecture is 600M of free user space.\\e[0m\\n"
fi
elif [[ "$USRSPACE" = *G ]]
then
USSPACE="${USRSPACE: : -1}"
if [[ "$CPUABI" = "$CPUABI8" ]]
then
if [[ "$USSPACE" -le "1.5" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. \\e[33mThere is only $USRSPACE of free user space is available on this device. \\e[1;30mThe recommended minimum to install Arch Linux in Termux PRoot for aarch64 architecture is 1.5G of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
elif [[ "$CPUABI" = "$CPUABI7" ]]
then
if [[ "$USSPACE" -le "1.23" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. \\e[33mThere is only $USRSPACE of free user space is available on this device. \\e[1;30mThe recommended minimum to install Arch Linux in Termux PRoot for armv7 architecture is 1.23G of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
else
SPACEMESSAGE=""
fi
else
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. \\e[33mThere is only $USRSPACE of free user space is available on this device. \\e[1;30mThe recommended minimum to install Arch Linux in Termux PRoot is more than 1.5G for aarch64, more than 1.25G for armv7, 800M for x86_64 and 600M of free user space for x86 architecture.\\e[0m\\n"
fi
}
_SPACEINFOKSIZE_() {
_USERSPACE_
if [[ "$CPUABI" = "$CPUABI8" ]]
then
if [[ "$USRSPACE" -lt "1500000" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. There is only \\e[33m$USRSPACE $units of free user space \\e[1;30mavailable on this device. The recommended minimum to install Arch Linux in Termux PRoot for aarch64 architecture is 1.5G of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
elif [[ "$CPUABI" = "$CPUABI7" ]]
then
if [[ "$USRSPACE" -lt "1250000" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. There is only \\e[33m$USRSPACE $units of free user space \\e[1;30mavailable on this device. The recommended minimum to install Arch Linux in Termux PRoot for armv7 architecture is 1.25G of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
elif [[ "$CPUABI" = "$CPUABIX8664" ]]
then
if [[ "$USRSPACE" -lt "800000" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. There is only \\e[33m$USRSPACE $units of free user space \\e[1;30mavailable on this device. The recommended minimum to install Arch Linux in Termux PRoot for x86_64 architecture is 800M of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
elif [[ "$CPUABI" = "$CPUABIX86" ]] || [[ "$CPUABI" = "i386" ]]
then
if [[ "$USRSPACE" -lt "600000" ]]
then
SPACEMESSAGE="\\e[0;33mTermuxArch: \\e[1;33mFREE SPACE NOTICE! \\e[1;30mStart thinking about cleaning out some stuff please. There is only \\e[33m$USRSPACE $units of free user space \\e[1;30mavailable on this device. The recommended minimum to install Arch Linux in Termux PRoot for $CPUABI architecture is 600M of free user space.\\e[0m\\n"
else
SPACEMESSAGE=""
fi
fi
}
_SYSINFO_() {
_NAMESTARTARCH_
_SPACEINFO_
printf "\\e[38;5;76m"
printf "%s\\n" "Generating TermuxArch version $VERSIONID system information; Please wait..."
_TASPINNER_ clock & _SYSTEMINFO_ ; kill $! || _PRINTERRORMSG_ "_SYSINFO_ _SYSTEMINFO_ ${0##*/} maintenanceroutines.bash"
cat "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n\\e[1mPlease share relevant system information along with an issue and pull request at https://github.com/TermuxArch/TermuxArch/issues and also include the input and output with information which may be quite important when planning issues at https://github.com/TermuxArch/TermuxArch/issues with the hope of improving this script, \'%s\'.\\n\\nIf you believe screenshots will help in a quicker resolution for an issue, also include them as well. Please include the input as well as the output, along with screenshots relrevant to Xserver on Android device, and similar.\\n\\n" "${0##*/}"
exit
}
_SYSTEMINFO_ () {
printf "%s\\n" "dpkg --print-architecture result:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
dpkg --print-architecture >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "uname -a results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
uname -a >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
for n in 0 1 2 3 4 5
do
printf "%s\\n" "BASH_VERSINFO[$n] = ${BASH_VERSINFO[$n]}" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
done
printf "\\n%s\\n" "cat /proc/cpuinfo results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
cat /proc/cpuinfo >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "getprop | grep product.cpu results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
getprop | grep product.cpu >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "getprop | grep net. results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
getprop | grep net\\. >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\nFurther getprop results:\\n" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop gsm.sim.operator.iso-country]:" "[$(getprop gsm.sim.operator.iso-country)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop persist.sys.locale]:" "[$(getprop persist.sys.locale)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.build.target_country]:" "[$(getprop ro.build.target_country)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.build.version.release]:" "[$SYSVER]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.build.version.preview_sdk]:" "[$(getprop ro.build.version.preview_sdk)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.build.version.sdk]:" "[$(getprop ro.build.version.sdk)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.com.google.clientidbase]:" "[$(getprop ro.com.google.clientidbase)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.com.google.clientidbase.am]:" "[$(getprop ro.com.google.clientidbase.am)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.com.google.clientidbase.ms]:" "[$(getprop ro.com.google.clientidbase.ms)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.product.device]:" "[$(getprop ro.product.device)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.product.first_api_level]:" "[$(getprop ro.product.first_api_level)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.product.locale]:" "[$(getprop ro.product.locale)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.product.manufacturer]:" "[$(getprop ro.product.manufacturer)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "%s %s\\n" "[getprop ro.product.model]:" "[$(getprop ro.product.model)]" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "Download directory information results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /sdcard/Download ]] && printf "%s\\n" "/sdcard/Download exists" || printf "%s\\n" "/sdcard/Download not found" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /storage/emulated/0/Download ]] && printf "%s\\n" "/storage/emulated/0/Download exists" || printf "%s\\n" "/storage/emulated/0/Download not found" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e "$HOME"/downloads ]] && printf "%s\\n" "$HOME/downloads exists" || printf "%s\\n" "~/downloads not found" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e "$HOME"/storage/downloads ]] && printf "%s\\n" "$HOME/storage/downloads exists" || printf "%s\\n" "$HOME/storage/downloads not found" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "Device information results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /dev/ashmem ]] && printf "%s\\n" "/dev/ashmem exists" || printf "%s\\n" "/dev/ashmem does not exist" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -r /dev/ashmem ]] && printf "%s\\n" "/dev/ashmem is readable" || printf "%s\\n" "/dev/ashmem is not readable" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -w /dev/ashmem ]] && printf "%s\\n" "/dev/ashmem is writable" || printf "%s\\n" "/dev/ashmem is not writable" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s" "Ascertaining system information; Please wait a moment "
[[ -e /dev/shm ]] && printf "%s\\n" "/dev/shm exists" || printf "%s\\n" "/dev/shm does not exist" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -r /dev/shm ]] && printf "%s\\n" "/dev/shm is readable" || printf "%s\\n" "/dev/shm is not readable" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /proc/stat ]] && printf "%s\\n" "/proc/stat exits" || printf "%s\\n" "/proc/stat does not exit" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -r /proc/stat ]] && printf "%s\\n" "/proc/stat is readable" || printf "%s\\n" "/proc/stat is not readable">> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /sys/ashmem ]] && printf "%s\\n" "/sys/ashmmem exists" || printf "%s\\n" "/sys/ashmmem does not exist" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -r /sys/ashmmem ]] && printf "%s\\n" "/sys/ashmmem is readable" || printf "%s\\n" "/sys/ashmmem is not readable" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -e /sys/shm ]] && printf "%s\\n" "/sys/shm exists" || printf "%s\\n" "/sys/shm does not exist" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
[[ -r /sys/shm ]] && printf "%s\\n" "/sys/shm is readable" || printf "%s\\n" "/sys/shm is not readable" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "Disk report $USRSPACE on /data $(date)" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\n" "df $INSTALLDIR results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
df "$INSTALLDIR" >> "${WDIR}setupTermuxArchSysInfo$STIME".log ||:
printf "\\n%s\\n" "df results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
df >> "${WDIR}setupTermuxArchSysInfo$STIME".log ||:
printf "\\n%s\\n" "du -hs $INSTALLDIR results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
du -hs "$INSTALLDIR" >> "${WDIR}setupTermuxArchSysInfo$STIME".log ||:
printf "\\n%s\\n" "ls -al $INSTALLDIR results:" >> "${WDIR}setupTermuxArchSysInfo$STIME".log
ls -al "$INSTALLDIR" >> "${WDIR}setupTermuxArchSysInfo$STIME".log ||:
printf "\\n%s\\n" "This file is found at '${WDIR}setupTermuxArchSysInfo$STIME.log'." >> "${WDIR}setupTermuxArchSysInfo$STIME".log
printf "\\n%s\\e[0m\\n" "End 'setupTermuxArchSysInfo$STIME.log' version $VERSIONID system information." >> "${WDIR}setupTermuxArchSysInfo$STIME".log
}
_USERSPACE_() {
USRSPACE="$(df "$INSTALLDIR" | awk 'FNR == 2 {print $4}')"
if [[ "$USRSPACE" = "" ]]
then
USRSPACE="$(df "$INSTALLDIR" | awk 'FNR == 3 {print $3}')"
fi
}
# maintenanceroutines.bash FE