Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

Raspberry Pi OS • Re: How to determine when a system was installed?

$
0
0

Code:

cat /etc/rpi-issue | grep reference
will show the date the initially installed OS was created (at least in Raspberry Pi OS/Raspbian) and doesn't change.
So the original installation date will be some time after this (assuming you used the latest image at the time).

Code:

/etc/os-release
changes with upgrades.

Code:

sudo tune2fs -l $(mount -v | awk '/ on \/ / {print $1}') | grep created
is the date the SD Card OS was created. It will change if you copy to a new SD Card.

I use the following script to display useful data.

Code:

#! /bin/sh# 2024-02-28user space# Function to print coloured headings#  delete "tput" lines for plain outputprint_head () { tput setaf 6 echo $1 tput sgr 0}if [ -e /etc/rpi-issue ]; then print_head "- Original Installation" cat /etc/rpi-issue | grep referencefiif [ -e /usr/bin/lsb_release ]; then print_head "- Current OS"#  No LSB modules are available. lsb_release -irdc | sed 's/No LSB modules are available.//' cat /etc/debian_versionfiif [ ! -e /usr/share/xsessions ]; thenprint_head "X NOT installed"fiBITS=$(getconf LONG_BIT)print_head "- Kernel"uname -rprint_head "- Architecture"uname -mecho "$BITS bit userland"print_head "- Model"cat /proc/device-tree/model && echoprint_head "- hostname"hostnameprint_head "- user"whoamiprint_head "- Network"hostname -I# Check status of networkingcheckactive () {if [ $(systemctl is-active $1) = 'active' ]; thenecho $1 'active'fi}checkactive 'systemd-networkd'checkactive 'dhcpcd'checkactive 'NetworkManager'# Get SSID of connected WiFi (WRONG if AP!)if [ -e /sys/class/net/wlan0 ]; thenif [ $(systemctl is-active 'NetworkManager') = 'active' ]; thennmcli connection show |  awk '/wlan0/ {print $1}'elsewpa_cli -i wlan0 status | grep -w ssid | awk -F'[=]' '{print $2}'fifisudo fdisk -l /dev/mmcblk0 | grep "Disk identifier"CPUID=$(awk '/Serial/ {print $3}' /proc/cpuinfo | cut -c 9-)echo "Serial: " $CPUIDif [ -e /opt/vc/bin/vcgencmd -o /usr/bin/vcgencmd ]; thenVERS=$(sudo vcgencmd version  | grep ":")print_head "- Firmware"echo $VERSfiprint_head "- Created"sudo tune2fs -l $(mount -v | awk '/ on \/ / {print $1}') | grep created

Statistics: Posted by Milliways — Thu Oct 24, 2024 6:48 am



Viewing all articles
Browse latest Browse all 3552

Trending Articles