3 # a frivolous but useful script that shows information about the local
4 # computer in terms of an adventure game inventory listing.
6 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
8 unset -v codename osname osver
9 if [ $OPERATING_SYSTEM == "UNIX" ]; then
10 if [ -z "$IS_DARWIN" ]; then
11 # we only try running lsb_release if not on a mac.
12 which lsb_release &>/dev/null
14 codename="$(lsb_release -cs 2>/dev/null)"
15 osname="$(lsb_release -is 2>/dev/null)"
16 osver="$(lsb_release -rs 2>/dev/null)"
19 # darwin / mac doesn't have lsb since not linux.
20 #Usage: sw_vers [-productName|-productVersion|-buildVersion]
21 osname="$(sw_vers -productName 2>/dev/null)"
22 osver="$(sw_vers -productVersion 2>/dev/null)"
23 if [[ "$osver" =~ ^10\.15.*$ ]]; then
25 elif [[ "$osver" =~ ^10\.14.*$ ]]; then
27 elif [[ "$osver" =~ ^10\.13.*$ ]]; then
28 codename="High Sierra"
29 elif [[ "$osver" =~ ^11\.*$ ]]; then
31 elif [[ "$osver" =~ ^12\.*$ ]]; then
34 codename="$(sw_vers -buildVersion 2>/dev/null)"
38 if [ -z "$codename" ]; then
44 # see if uptime even exists.
47 # test if this uptime knows the -p flag.
52 up="$(uptime | awk '{print $2 " " $3 " " $4 " plus " $1 " hours" }')"
55 # if we can't do this, then we're not even on windows cygwin. wth are we?
56 up="up a whole $(cat /proc/uptime|awk '{print $1}') seconds, yo"
59 # decide whether they've got splitter available or not.
60 if [ -f "$FEISTY_MEOW_BINARIES/splitter" -o -f "$FEISTY_MEOW_BINARIES/splitter.exe" ]; then
61 # calculate the number of columsn in the terminal.
63 splitter="$FEISTY_MEOW_BINARIES/splitter --maxcol $(($cols - 1))"
65 # not available, so just emit as huge overly long string.
69 echo "it is $(date +"%A at %H:%M hours on day %e of the %B moon in the gregorian year %Y" | tr A-Z a-z) and our intrepid adventurer $USER is exploring a computer named $(hostname) that is running in a thoughtspace called $osname $osver (code-name $codename), and $USER has deduced that the machine's OS platform is $(uname -m) and its current incarnation has been ${up}." | $splitter
71 echo "the following things appear to be lying around here..."
75 echo "there appear to be these entities on this host..."