mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
71d8968a1a
Class F (logs) and Class G (temp/update) reshuffled. Logs: - /var/log was already a mount from /storage/.cache/log via packages/sysutils/busybox/system.d/var-log.mount, so journald already writes to /var/log/journal in FHS terms. runemu.sh debug log moves from /storage/.cache/log/runemu-debug.log to /var/log/runemu-debug.log (same physical bytes, FHS surface). - createlog (top-level busybox script) packs archive zips into /var/log/archr/archive instead of /storage/logfiles. ArchR tmpfiles z_01_archr.conf creates the backing dir under the storage overlay so the path is writable on first boot. Update: - /var/cache/archr/update is a bridge symlink to /storage/.update added by the archr meta-package. archr-update, automount and the [update] samba share all flipped to the FHS path. - factoryreset still preserves /storage/.update by its real name in the find regex; that path is also what the pre-boot bootloader scripts read, so the backing path is the canonical one and the bridge is just the userland surface. Comment added so this is obvious to future readers. - busybox/scripts/init keeps UPDATE_ROOT=/storage/.update because it runs in the initramfs before /var is even available. Overlayfs workdirs (/storage/.tmp/*-workdir) and /storage/.boot.hint documented as no-op in fhs-mapping.md: the overlayfs kernel layer requires upperdir and workdir to share a filesystem, and the boot hint is part of the U-Boot handshake. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
187 lines
4.6 KiB
Bash
Executable File
187 lines
4.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
# Copyright (C) 2023-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
# create logfile
|
|
|
|
DATE=$(date -u +%Y-%m-%d-%H.%M.%S)
|
|
BASEDIR=$(mktemp -d)
|
|
LOGDIR="log-$DATE"
|
|
RELEASE=$(cat /etc/release)
|
|
|
|
getlog_cmd() {
|
|
if command -v $1 >/dev/null; then
|
|
{
|
|
echo "################################################################################"
|
|
echo "# ... output of $@"
|
|
echo "# LibreELEC release: $RELEASE"
|
|
echo "################################################################################"
|
|
} >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
$@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>/dev/null
|
|
echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
fi
|
|
}
|
|
|
|
get_governor_details() {
|
|
(
|
|
cat_all_files /sys/devices/system/cpu
|
|
cat_all_files /sys/devices/system/cpu/cpufreq
|
|
for cpun in /sys/devices/system/cpu/cpu[0-9]*; do
|
|
cat_all_files ${cpun}/cpufreq
|
|
done
|
|
)
|
|
}
|
|
|
|
cat_all_files() {
|
|
local adir=$1
|
|
local afile var
|
|
|
|
[ -d ${adir} ] || return 0
|
|
|
|
echo "${adir}"
|
|
|
|
cd ${adir}
|
|
for afile in $(find . -maxdepth 1 -print | sort); do
|
|
afile=${afile:2}
|
|
if [ -n "${afile}" ]; then
|
|
if [ -d ${afile} ]; then
|
|
var="<dir>"
|
|
else
|
|
var=$(cat ${afile} 2>/dev/null)
|
|
fi
|
|
[ -n "${var}" ] && printf " %-30s : %s\n" "${afile}" "${var}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
rm -rf ${BASEDIR:?}/$LOGDIR
|
|
mkdir -p $BASEDIR/$LOGDIR
|
|
|
|
# kodi.log
|
|
KODI_LOG_DIR=/storage/.kodi/temp
|
|
|
|
LOGFILE="01_KODI.log"
|
|
for i in kodi.log kodi.old.log; do
|
|
[ -f ${KODI_LOG_DIR}/${i} ] && getlog_cmd cat ${KODI_LOG_DIR}/$i
|
|
done
|
|
|
|
LOGFILE="01_KODI_CRASH.log"
|
|
for i in $(find ${KODI_LOG_DIR} -type f -name "kodi_crashlog_*.log" | sort -r); do
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
LOGFILE="01_KODI_OTHER.log"
|
|
for i in $(find ${KODI_LOG_DIR} -type f -name "*.log" | sort); do
|
|
iname="${i#${KODI_LOG_DIR}/}"
|
|
[ ${iname} = kodi.log ] && continue
|
|
[ ${iname} = kodi.old.log ] && continue
|
|
[ "${iname#kodi_crashlog_}" != "${iname}" ] && continue
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
# System.log
|
|
LOGFILE="02_System.log"
|
|
getlog_cmd dmesg
|
|
getlog_cmd lsmod
|
|
getlog_cmd ps xa
|
|
for i in /storage/.config/hwdb.d/*.hwdb \
|
|
/storage/.config/modprobe.d/*.conf \
|
|
/storage/.config/modules-load.d/*.conf \
|
|
/storage/.config/sleep.d/*.power \
|
|
/storage/.config/sysctl.d/*.conf \
|
|
/storage/.config/udev.rules.d/*.rules \
|
|
; do
|
|
if [ -f "$i" ]; then
|
|
getlog_cmd cat $i
|
|
fi
|
|
done
|
|
if [ -f "/storage/.config/autostart.sh" ]; then
|
|
getlog_cmd cat /storage/.config/autostart.sh
|
|
fi
|
|
if [ -f "/storage/.config/shutdown.sh" ]; then
|
|
getlog_cmd cat /storage/.config/shutdown.sh
|
|
fi
|
|
getlog_cmd ls -laR /storage/.config/system.d
|
|
# note: we dont add .mount units here as they may contain
|
|
# login credentials
|
|
for i in /storage/.config/system.d/*.service ; do
|
|
if [ -f "$i" ] && [ ! -L "$i" ]; then
|
|
getlog_cmd cat $i
|
|
fi
|
|
done
|
|
|
|
# Hardware.log
|
|
LOGFILE="03_Hardware.log"
|
|
getlog_cmd lspci -vvvvnn
|
|
getlog_cmd lsusb -vvv
|
|
getlog_cmd lsusb -t
|
|
getlog_cmd cat /proc/cpuinfo
|
|
getlog_cmd get_governor_details
|
|
getlog_cmd cat /proc/meminfo
|
|
|
|
# Audio.log
|
|
LOGFILE="04_Audio.log"
|
|
getlog_cmd aplay -l
|
|
getlog_cmd aplay -L
|
|
getlog_cmd amixer
|
|
|
|
# Network.log
|
|
LOGFILE="05_Network.log"
|
|
getlog_cmd ifconfig -a
|
|
getlog_cmd netstat -rn
|
|
getlog_cmd netstat -nalp
|
|
getlog_cmd connmanctl services
|
|
getlog_cmd cat /etc/resolv.conf
|
|
|
|
# varlog.log
|
|
LOGFILE="06_varlog.log"
|
|
for i in $(find /var/log -name journal -prune -o -type f -print); do
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
# Input.log
|
|
LOGFILE="07_input.log"
|
|
getlog_cmd cat /proc/bus/input/devices
|
|
# make RPi users happy
|
|
if [ -e /proc/acpi/wakeup ]; then
|
|
getlog_cmd cat /proc/acpi/wakeup
|
|
fi
|
|
|
|
# Filesystem.log
|
|
LOGFILE="08_Filesystem.log"
|
|
getlog_cmd cat /proc/mounts
|
|
getlog_cmd df -h
|
|
getlog_cmd blkid
|
|
|
|
# Journal (current)
|
|
LOGFILE="09_Journal-cur.log"
|
|
getlog_cmd journalctl --no-pager -b -0
|
|
|
|
# Journal (prev)
|
|
# only exists if using persistent journal
|
|
if [ -f "/storage/.cache/journald.conf.d/00_settings.conf" ]; then
|
|
LOGFILE="10_Journal-prev.log"
|
|
getlog_cmd journalctl --no-pager -b -1
|
|
fi
|
|
|
|
# addons
|
|
LOGFILE="11_Addons.log"
|
|
for i in /storage/.kodi/userdata/addon_data/*/*.log \
|
|
/storage/.kodi/userdata/addon_data/*/log/* \
|
|
; do
|
|
if [ -f "$i" ]; then
|
|
getlog_cmd cat $i
|
|
fi
|
|
done
|
|
|
|
# pack logfiles
|
|
# /var/log is /storage/.cache/log via var-log.mount on ArchR; lands on
|
|
# the rw overlay through the FHS path.
|
|
mkdir -p /var/log/archr/archive
|
|
zip -jq /var/log/archr/archive/log-$DATE.zip $BASEDIR/$LOGDIR/*
|
|
|
|
# remove logdir
|
|
rm -rf ${BASEDIR:?}/$LOGDIR
|