mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Toughen up iiab-apps-to-be-installed, iiab-summary, iiab-diagnostics
This commit is contained in:
parent
8f0bb17990
commit
faa73a3088
4 changed files with 27 additions and 35 deletions
|
@ -8,6 +8,11 @@ iiab_var_value() {
|
||||||
[[ $v2 != "" ]] && echo $v2 || echo $v1 # [ "$v2" ] ALSO WORKS
|
[[ $v2 != "" ]] && echo $v2 || echo $v1 # [ "$v2" ] ALSO WORKS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://askubuntu.com/questions/1250974/user-root-cant-write-to-file-in-tmp-owned-by-someone-else-in-20-04-but-can-in
|
||||||
|
# https://unix.stackexchange.com/questions/503111/group-permissions-for-root-not-working-in-tmp
|
||||||
|
[[ $(id -un) == "root" ]] &&
|
||||||
|
rm -f /tmp/iiab-apps-list /tmp/iiab-apps-to-be-installed
|
||||||
|
|
||||||
# 2022-06-18: 40 apps (list not quite complete)
|
# 2022-06-18: 40 apps (list not quite complete)
|
||||||
#grep -l _installed: /opt/iiab/iiab/roles/*/tasks/install.yml | cut -d/ -f6 > /tmp/iiab-apps-list
|
#grep -l _installed: /opt/iiab/iiab/roles/*/tasks/install.yml | cut -d/ -f6 > /tmp/iiab-apps-list
|
||||||
|
|
||||||
|
@ -17,6 +22,13 @@ iiab_var_value() {
|
||||||
# 2022-06-18: 50 apps (list long but ok!) -- adds these 10: dansguardian, dhcpd, iiab_admin, minetest, named, pylibs, squid, wondershaper, www_base, www_options
|
# 2022-06-18: 50 apps (list long but ok!) -- adds these 10: dansguardian, dhcpd, iiab_admin, minetest, named, pylibs, squid, wondershaper, www_base, www_options
|
||||||
grep -hro '[A-Za-z_][A-Za-z_]*_installed: True' --exclude-dir=0-DEPRECATED-ROLES /opt/iiab/iiab/roles | sed 's/_installed: True$//' | sort | uniq > /tmp/iiab-apps-list
|
grep -hro '[A-Za-z_][A-Za-z_]*_installed: True' --exclude-dir=0-DEPRECATED-ROLES /opt/iiab/iiab/roles | sed 's/_installed: True$//' | sort | uniq > /tmp/iiab-apps-list
|
||||||
|
|
||||||
|
# Non-root CANNOT rm files from /tmp, but CAN write to them (unlike root!!)
|
||||||
|
# This ALSO creates the file (useful when "Apps2B" == 0, for iiab-summary etc)
|
||||||
|
truncate -s 0 /tmp/iiab-apps-to-be-installed
|
||||||
|
|
||||||
|
# So other (non-root) users CAN later write to these, even if they CAN'T chmod!
|
||||||
|
chmod 777 /tmp/iiab-apps-list /tmp/iiab-apps-to-be-installed 2>/dev/null
|
||||||
|
|
||||||
while read app; do
|
while read app; do
|
||||||
if [[ $app == "calibre-web" ]]; then
|
if [[ $app == "calibre-web" ]]; then
|
||||||
app=calibreweb
|
app=calibreweb
|
||||||
|
@ -27,8 +39,6 @@ while read app; do
|
||||||
# echo ${app}_install: $(iiab_var_value ${app}_install)
|
# echo ${app}_install: $(iiab_var_value ${app}_install)
|
||||||
|
|
||||||
if [[ $(iiab_var_value ${app}_install) =~ ^[Tt]rue$ ]] && ! grep -q "${app}_installed: True" /etc/iiab/iiab_state.yml; then
|
if [[ $(iiab_var_value ${app}_install) =~ ^[Tt]rue$ ]] && ! grep -q "${app}_installed: True" /etc/iiab/iiab_state.yml; then
|
||||||
echo $app
|
echo $app | tee -a /tmp/iiab-apps-to-be-installed
|
||||||
fi
|
fi
|
||||||
done < /tmp/iiab-apps-list
|
done < /tmp/iiab-apps-list
|
||||||
|
|
||||||
rm /tmp/iiab-apps-list # So a non-root user can later run this cleanly!
|
|
||||||
|
|
|
@ -127,45 +127,26 @@ function cat_tail() { # $1 = path/filename; $2 = # of lines, for tail
|
||||||
# START BUILDING UP THE FILE THAT'LL CONTAIN THE DIAGNOSTICS!
|
# START BUILDING UP THE FILE THAT'LL CONTAIN THE DIAGNOSTICS!
|
||||||
echo -e "\nCompiling diagnostics..."
|
echo -e "\nCompiling diagnostics..."
|
||||||
|
|
||||||
echo -e "\n 0. Filename Header + Git Hashes + Raspberry Pi Model + OS"
|
echo -e "\n 0. HW + SW Quick Summary"
|
||||||
echo "This is: $outfile" >> $outfile
|
echo "This is: $outfile" >> $outfile
|
||||||
echo >> $outfile
|
echo >> $outfile
|
||||||
echo -e "\n\n\n\n0. GIT INFO + RASPBERRY PI MODEL + OS" >> $outfile
|
echo -e "\n\n\n\n0. HW + SW Quick Summary" >> $outfile
|
||||||
echo >> $outfile
|
|
||||||
echo "iiab commit: $HASH1" >> $outfile
|
|
||||||
echo " remote: $REMOTE_URL1" >> $outfile
|
|
||||||
echo " branch: $BRANCH1" >> $outfile
|
|
||||||
printf "%4s merged PR's since recent tag: $TAG_COMMITS1\n" $PR_COUNT1 >> $outfile
|
|
||||||
echo >> $outfile
|
|
||||||
echo "iiab-admin-console commit: $HASH2" >> $outfile
|
|
||||||
echo " remote: $REMOTE_URL2" >> $outfile
|
|
||||||
echo " branch: $BRANCH2" >> $outfile
|
|
||||||
printf "%4s merged PR's since recent tag: $TAG_COMMITS2\n" $PR_COUNT2 >> $outfile
|
|
||||||
echo >> $outfile
|
|
||||||
cat_file /etc/iiab/pr-list-pulled
|
|
||||||
cat_file /proc/device-tree/model # Should be identical to /sys/firmware/devicetree/base/model
|
|
||||||
cat_file /etc/rpi-issue
|
|
||||||
echo "-IIAB-EXPLANATION-OF-THE-ABOVE-------------------------------------------------" >> $outfile
|
|
||||||
echo >> $outfile
|
echo >> $outfile
|
||||||
|
/opt/iiab/iiab/scripts/iiab-summary >> $outfile
|
||||||
if [ -f /etc/rpi-issue ]; then
|
if [ -f /etc/rpi-issue ]; then
|
||||||
echo "stage2 = Raspberry Pi OS Lite" >> $outfile
|
echo "stage2 = Raspberry Pi OS Lite" >> $outfile
|
||||||
echo "stage4 = Raspberry Pi OS with desktop" >> $outfile
|
echo "stage4 = Raspberry Pi OS with desktop" >> $outfile
|
||||||
echo "stage5 = Raspberry Pi OS with desktop + recommended software" >> $outfile
|
echo "stage5 = Raspberry Pi OS with desktop + recommended software" >> $outfile
|
||||||
echo >> $outfile
|
|
||||||
echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile
|
echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile
|
||||||
else
|
echo >> $outfile
|
||||||
echo "(This is NOT Raspberry Pi OS!)" >> $outfile
|
fi
|
||||||
|
if [ -s /tmp/iiab-apps-to-be-installed ]; then
|
||||||
|
echo "iiab-apps-to-be-installed :" >> $outfile
|
||||||
|
cat /tmp/iiab-apps-to-be-installed >> $outfile
|
||||||
|
echo >> $outfile
|
||||||
fi
|
fi
|
||||||
echo >> $outfile
|
|
||||||
cat_file /etc/issue.net
|
|
||||||
cat_file /etc/debian_version
|
|
||||||
cat_cmd 'dpkg --print-architecture' 'RaspiOS-on-PC shows: i386'
|
|
||||||
cat_cmd 'dpkg --print-foreign-architectures' 'RaspiOS-on-PC shows: amd64'
|
|
||||||
cat_cmd 'systemctl is-active display-manager.service' 'Graphical Desktop?'
|
|
||||||
cat_cmd 'grep "^openvpn_" /etc/iiab/local_vars.yml'
|
|
||||||
cat_cmd 'iiab-apps-to-be-installed' 'IIAB Apps to be installed'
|
|
||||||
|
|
||||||
echo -e '\n\n 1. Files Specially Requested: (from "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n'
|
echo -e '\n 1. Files Specially Requested: (from "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n'
|
||||||
echo -e '\n\n\n\n1. FILES SPECIALLY REQUESTED (FROM "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' >> $outfile
|
echo -e '\n\n\n\n1. FILES SPECIALLY REQUESTED (FROM "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' >> $outfile
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
cat_file $f
|
cat_file $f
|
||||||
|
@ -277,7 +258,7 @@ echo
|
||||||
|
|
||||||
echo -e "\e[1m"
|
echo -e "\e[1m"
|
||||||
#if [ "$ans" == "" ] || [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then
|
#if [ "$ans" == "" ] || [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then
|
||||||
if ! [[ $ans =~ ^[nN]$ ]]; then
|
if ! [[ $ans =~ ^[nNqQ]$ ]]; then
|
||||||
echo -ne "PUBLISHING TO URL... "
|
echo -ne "PUBLISHING TO URL... "
|
||||||
#pastebinit -b dpaste.com < $outfile
|
#pastebinit -b dpaste.com < $outfile
|
||||||
pastebinit -b sprunge.us < $outfile # Run 'pastebinit -l' to list other possible pastebin site URLs
|
pastebinit -b sprunge.us < $outfile # Run 'pastebinit -l' to list other possible pastebin site URLs
|
||||||
|
|
|
@ -68,4 +68,4 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things:
|
||||||
|
|
||||||
## Source Code
|
## Source Code
|
||||||
|
|
||||||
Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 127-261 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible.
|
Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 127-242 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible.
|
||||||
|
|
|
@ -76,7 +76,8 @@ fi
|
||||||
# landscape-sysinfo --sysinfo-plugins=Disk,Temperature,Load # Like: uptime -p
|
# landscape-sysinfo --sysinfo-plugins=Disk,Temperature,Load # Like: uptime -p
|
||||||
#fi
|
#fi
|
||||||
echo
|
echo
|
||||||
echo "$(df -h /) ZIMs: $(ls /library/zims/content/ | wc -l) OER2Go: $(ls /library/www/html/modules/ | wc -l) Apps2B: $(/opt/iiab/iiab/scripts/iiab-apps-to-be-installed | wc -l)"
|
/opt/iiab/iiab/scripts/iiab-apps-to-be-installed > /dev/null
|
||||||
|
echo "$(df -h /) ZIMs: $(ls /library/zims/content/ | wc -l) OER2Go: $(ls /library/www/html/modules/ | wc -l) Apps2B: $(cat /tmp/iiab-apps-to-be-installed | wc -l)"
|
||||||
echo
|
echo
|
||||||
echo $(ip -o link show | awk -F': ' '{print $2}') # Better order than: ls -rt /sys/class/net
|
echo $(ip -o link show | awk -F': ' '{print $2}') # Better order than: ls -rt /sys/class/net
|
||||||
grep "^openvpn_enabled:" /etc/iiab/local_vars.yml
|
grep "^openvpn_enabled:" /etc/iiab/local_vars.yml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue