Today: Mounting tar archives, a novel take on uptime, ipxe escapes.
ratarmount – Access large archives as a filesystem efficiently, e.g., TAR, RAR, ZIP, GZ, BZ2, XZ, ZSTD archives
$ virtualenv ~/.local/ratarmount
$ ~/.local/ratarmount/bin/pip3 install -U ratarmount
$ ~/.local/ratarmount/bin/ratarmount
$ install -D ~/.local/ratarmount/bin/ratarmount ~/bin/
$ mkdir -p ~/mnt
$ curl -O https://data.iana.org/time-zones/tzdata-latest.tar.gz
$ ratarmount tzdata-latest.tar.gz ~/mnt
$ find ~/mnt
$ fusermount -u ~/mnt
tuptime – Report historical and statistical real time of the system, keeping it between restarts. Total uptime
tuptime calculates overall uptime of the system it’s running on. It also flags shutdowns as “BAD” if it comes up without having been gracefully stopped before.
As I grew up in an age where uptime braggery was common even among professionals, my entirely unreasonable use case here is to determine uptime since the previous unclean shutdown:
function tuptime-graceful () {
local tuptime_since=1
local temp_array
while read -r line
do
if [[ "${line}" =~ ' BAD ' ]]
then
read -r -a temp_array <<< "${line}"
tuptime_since=$(( temp_array[0] + 1 ))
break
fi
done < <(tuptime --table --order e --reverse)
tuptime --since "${tuptime_since}"
}
Ampersand in ipxe script
Example is from a Debian preseed environment where preseed/late_command downloads and executes a shell script
set amp &
set latecmd in-target wget ${script_url} ${amp}${amp} in-target bash script.sh
kernel [...] preseed/late_command="${latecmd}"