Last active
November 2, 2024 20:01
-
-
Save cyberpunk042/82b4587ee73fe3907771b0dd3546433c to your computer and use it in GitHub Desktop.
TrueNAS Scale 24.04.2 Customization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set script to exit on error | |
set -e | |
# Enable logging | |
exec > >(tee -i /var/log/setup-script.log) | |
exec 2>&1 | |
echo "Starting script execution..." | |
echo "Fix export path" | |
export PATH=/usr/bin:/usr/sbin | |
# Remount RW /usr | |
echo "Remount RW /usr..." | |
mount -o remount,rw 'boot-pool/ROOT/24.04.2/usr' | |
# Re-enabling apt utilities | |
echo "Enabling apt utilities..." | |
chmod +x /bin/apt* | |
chmod +x /usr/bin/dpkg | |
# Updating sources.list | |
echo "Updating sources.list..." | |
{ | |
echo "deb http://deb.debian.org/debian bullseye main" | |
echo "deb-src http://deb.debian.org/debian bullseye main" | |
} > /etc/apt/sources.list | |
# Updating apt and installing necessary utilities | |
echo "Updating apt and installing utilities..." | |
apt update | |
# Install some basic network and other utilities | |
apt install -y net-tools curl wget xinput evtest | |
# Installing lcd4linux | |
echo "Installing lcd4linux..." | |
apt install -y lcd4linux | |
# Configuring lcd4linux | |
echo "Setting up lcd4linux configuration..." | |
cp ./lcd4linux.conf /etc/lcd4linux.conf | |
cp ./truenas-img.png /home/admin/truenas-img.png | |
systemctl restart lcd4linux | |
# Additional commands for TrueNAS Scale setup on Debian 12 | |
echo "Installing additional utilities for TrueNAS Scale..." | |
apt install -y python pip | |
echo "Script execution completed successfully!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------------------------------------------------------------------------------------------- | |
# For lcd4linux widgets see http://ssl.bulix.org/projects/lcd4linux/wiki/Layout. | |
# | |
# This file needs a small helper script, mystatus. | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
# Global settings | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
Layout 'helios4' | |
Display 'DPF' | |
Variables { | |
# These constants have an optional L_abel variant for display and an internal V_alue. | |
# Filesystems | |
V_FS1 '/' | |
V_FS2 '/mnt/base' | |
V_FS3 '/mnt/share' | |
V_FS4 '/mnt/backup' | |
# Hard Drives | |
V_HDD1 '/dev/mmcblk0' | |
L_HDD1 'mmc' | |
V_HDD2 '/dev/sda' | |
L_HDD2 'sda' | |
V_HDD3 '/dev/sdb' | |
L_HDD3 'sdb' | |
V_HDD4 '/dev/sdc' | |
L_HDD4 'sdc' | |
V_HDD5 '/dev/sdd' | |
L_HDD5 'sdd' | |
V_HDD6 '/dev/sde' | |
L_HDD6 'sde' | |
# Net device | |
V_LANDEV 'enp2s0' | |
# timer ticks | |
second 1000 | |
minute 60 * second | |
# define some standard dimensions: | |
linesize 53 # max line length, for status lines etc. | |
width100 51 # full width after padding (border) | |
width050 24 # 1/2 of full width | |
width033 17 # 1/3 of full width | |
width035 17 # approx 1/3 of full width | |
width025 12 # 1/4 of full width | |
width010 6 # 1/10 of full width | |
darkslategray '2f4f4f' | |
lightskyblue '87cefa' | |
ghostwhite 'f8f8ff' | |
lightslategray '778899' | |
plum 'dda0dd' | |
salmon 'fa8072' | |
silver 'c0c0c0' | |
tomato 'ff6347' | |
transparent 'ffffff00' | |
# standard colors (standard style): | |
# std_fg ghostwhite | |
# std_bg midnightblue | |
# std_fg_bar0 '72a8f9' | |
# std_fg_bar1 salmon | |
# std_bg_bar darkslategray | |
# std_fg_inverse darkslategray | |
# std_bg_inverse ghostwhite | |
# std_fg_area std_fg | |
# std_bg_area darkslategray | |
# std_fg_debug lightslategray | |
# std_bg_debug std_bg | |
std_bg ghostwhite | |
std_fg darkslategray | |
std_fg_bar0 lightskyblue | |
std_fg_bar1 plum | |
std_bg_bar silver | |
std_fg_inverse ghostwhite | |
std_bg_inverse darkslategray | |
std_fg_area std_fg | |
std_bg_area silver | |
std_fg_debug lightslategray | |
std_bg_debug std_bg | |
# To be set later by timers: | |
SyslogMsg 'Dummy' | |
TopMsg 'Dummy' | |
} | |
Display dpf { | |
driver 'DPF' | |
port 'usb0' | |
font '9x10' | |
orientation 4 | |
backlight 4 | |
foreground std_fg | |
background std_bg | |
basecolor std_bg | |
} | |
#Display XWindow { | |
# driver 'X11' | |
# size '320x240' | |
# font '6x8' | |
## pixel '2+1' | |
# pixel '2+0' | |
# gap '0x0' | |
# foreground std_fg | |
# background std_bg | |
# basecolor std_bg | |
#} | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
# Widgets | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
Widget System { | |
class 'Text' | |
expression uname('nodename') . (netinfo::ipaddr(V_LANDEV) ? ' ' . netinfo::ipaddr(V_LANDEV) : '') . ' ' . uname('machine') . ' ' . uname('release') | |
width linesize | |
align 'C' | |
background std_bg_inverse | |
foreground std_fg_inverse | |
} | |
Widget Time { | |
class 'Text' | |
expression strftime('%a, %d.%m.%Y %H:%M:%S', time()) . ' Up: ' . uptime('%d days %H:%M:%S') | |
width linesize | |
align 'C' | |
update 1 * second | |
background std_bg_inverse | |
foreground std_fg_inverse | |
} | |
Widget CPU { | |
class 'Text' | |
expression proc_stat::cpu('busy', 1 * second) | |
prefix 'CPU' | |
postfix '%' | |
width width033 | |
precision 1 | |
align 'R' | |
background transparent | |
update 1 * second | |
} | |
Widget CPUTemp { | |
class 'Text' | |
expression exec('cat /sys/class/thermal/thermal_zone0/temp', 10 * second) / 1000 | |
postfix '°C' | |
width 5 | |
precision 0 | |
align 'R' | |
background transparent | |
update 10 * second | |
} | |
Widget CPUBar { | |
class 'Bar' | |
expression proc_stat::cpu('busy', 1 * second) | |
expression2 proc_stat::cpu('system', 1 * second) | |
length width050 | |
direction 'E' | |
update 1 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget Load { | |
class 'Text' | |
expression loadavg(1) | |
postfix loadavg(1) > 2.0 ? '!' : '' | |
prefix 'Load' | |
width width050 | |
precision 1 | |
align 'R' | |
background transparent | |
update 1 * second | |
} | |
Widget LoadBar { | |
class 'Bar' | |
expression loadavg(1) - 1 | |
expression2 loadavg(2) - 1 | |
max 4.0 | |
length width050 | |
direction 'E' | |
update 1 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget Disk { | |
class 'Text' | |
expression (diskstats('sd[a-z]$', 'read_sectors', 1 * second) + diskstats('sd[a-z]$', 'write_sectors', 1 * second)) / 2 / 1024 | |
prefix 'Disk I/O' | |
postfix ' MB/s' | |
width width050 | |
precision 1 | |
align 'R' | |
background transparent | |
update 1 * second | |
} | |
Widget DiskBar { | |
class 'Bar' | |
expression diskstats('sd[a-z]$', 'read_sectors', 1 * second) / 2 / 1024 | |
expression2 diskstats('sd[a-z]$', 'write_sectors', 1 * second) / 2 / 1024 | |
length width050 | |
direction 'E' | |
update 1 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget Netdev { | |
class 'Text' | |
expression (netdev(V_LANDEV, 'Rx_bytes', 1 * second) + netdev(V_LANDEV, 'Tx_bytes', 1 * second)) * 8 / 1024 / 1024 | |
prefix V_LANDEV | |
postfix ' Mbit/s' | |
width width050 | |
precision 1 | |
align 'R' | |
background transparent | |
update 1 * second | |
} | |
Widget NetdevBar { | |
class 'Bar' | |
expression netdev(V_LANDEV, 'Rx_bytes', 1 * second) * 8 / 1024 / 1024 | |
expression2 netdev(V_LANDEV, 'Tx_bytes', 1 * second) * 8 / 1024 / 1024 | |
length width050 | |
direction 'E' | |
update 1 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget Memory { | |
class 'Text' | |
expression floor((meminfo('MemTotal') - meminfo('MemFree')) / 1024) . '/' . floor((meminfo('MemTotal') / 1024)) | |
prefix 'Memory' | |
postfix ' MB' | |
width width050 | |
align 'R' | |
background transparent | |
update 1 * second | |
} | |
Widget MemoryBar { | |
class 'Bar' | |
expression meminfo('MemTotal') - meminfo('MemFree') | |
expression2 meminfo('SwapTotal') - meminfo('SwapFree') | |
max meminfo('MemTotal') | |
length width050 | |
direction 'E' | |
update 1 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget HDDStatus1 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD1, 10 * second), 29) | |
prefix L_HDD1 . ' ' | |
postfix ' ' # . hddtemp(V_HDD1) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget HDDStatus2 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD2, 10 * second), 29) | |
prefix L_HDD2 .' ' | |
postfix ' ' # . hddtemp(V_HDD2) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget HDDStatus3 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD3, 10 * second), 29) | |
prefix L_HDD3. ' ' | |
postfix ' ' # . hddtemp(V_HDD3) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget HDDStatus4 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD4, 10 * second), 29) | |
prefix L_HDD4. ' ' | |
postfix ' ' # . hddtemp(V_HDD4) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget HDDStatus5 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD5, 10 * second), 29) | |
prefix L_HDD5. ' ' | |
postfix ' ' # . hddtemp(V_HDD5) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget HDDStatus6 { | |
class 'Text' | |
expression substr(exec('/sbin/hdparm -C ' . V_HDD6, 10 * second), 29) | |
prefix L_HDD6. ' ' | |
postfix ' ' # . hddtemp(V_HDD6) . '°C' | |
width width035 | |
align 'R' | |
update 10 * second | |
} | |
Widget FSSpace1 { | |
class 'Text' | |
expression (statfs(V_FS1, 'blocks') - statfs(V_FS1, 'bavail')) * statfs(V_FS1, 'bsize') / 1024 / 1024 / 1024 | |
max floor(statfs(V_FS1, 'blocks') * statfs(V_FS1, 'bsize') / 1024 / 1024 / 1024) | |
prefix V_FS1 | |
postfix '/' . floor(statfs(V_FS1, 'blocks') * statfs(V_FS1, 'bsize') / 1024 / 1024 / 1024) . ' GB' | |
width width050 | |
precision 0 | |
align 'R' | |
background transparent | |
update 10 * second | |
} | |
Widget FSSpace2 { | |
class 'Text' | |
expression (statfs(V_FS2, 'blocks') - statfs(V_FS2, 'bavail')) * statfs(V_FS2, 'bsize') / 1024 / 1024 / 1024 | |
max floor(statfs(V_FS2, 'blocks') * statfs(V_FS2, 'bsize') / 1024 / 1024 / 1024) | |
prefix V_FS2 | |
postfix '/' . floor(statfs(V_FS2, 'blocks') * statfs(V_FS2, 'bsize') / 1024 / 1024 / 1024) . ' GB' | |
width width050 | |
precision 0 | |
align 'R' | |
background transparent | |
update 10 * second | |
} | |
Widget FSSpace3 { | |
class 'Text' | |
expression (statfs(V_FS3, 'blocks') - statfs(V_FS3, 'bavail')) * statfs(V_FS3, 'bsize') / 1024 / 1024 / 1024 | |
max floor(statfs(V_FS3, 'blocks') * statfs(V_FS3, 'bsize') / 1024 / 1024 / 1024) | |
prefix V_FS3 | |
postfix '/' . floor(statfs(V_FS3, 'blocks') * statfs(V_FS3, 'bsize') / 1024 / 1024 / 1024) . ' GB' | |
width width050 | |
precision 0 | |
align 'R' | |
background transparent | |
update 10 * second | |
} | |
Widget FSSpace4 { | |
class 'Text' | |
expression (statfs(V_FS4, 'blocks') - statfs(V_FS4, 'bavail')) * statfs(V_FS4, 'bsize') / 1024 / 1024 / 1024 | |
max floor(statfs(V_FS4, 'blocks') * statfs(V_FS4, 'bsize') / 1024 / 1024 / 1024) | |
prefix V_FS4 | |
postfix '/' . floor(statfs(V_FS4, 'blocks') * statfs(V_FS4, 'bsize') / 1024 / 1024 / 1024) . ' GB' | |
width width050 | |
precision 0 | |
align 'R' | |
background transparent | |
update 10 * second | |
} | |
Widget FSSpaceBar1 { | |
class 'Bar' | |
expression statfs(V_FS1, 'blocks') - statfs(V_FS1, 'bfree') | |
expression2 statfs(V_FS1, 'blocks') - statfs(V_FS1, 'bavail') | |
max statfs(V_FS1, 'blocks') | |
length width050 | |
direction 'E' | |
update 10 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget FSSpaceBar2 { | |
class 'Bar' | |
expression statfs(V_FS2, 'blocks') - statfs(V_FS2, 'bfree') | |
expression1 statfs(V_FS2, 'blocks') - statfs(V_FS2, 'bavail') | |
max statfs(V_FS2, 'blocks') | |
length width050 | |
direction 'E' | |
update 10 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget FSSpaceBar3 { | |
class 'Bar' | |
expression statfs(V_FS3, 'blocks') - statfs(V_FS3, 'bfree') | |
expression2 statfs(V_FS3, 'blocks') - statfs(V_FS3, 'bavail') | |
max statfs(V_FS3, 'blocks') | |
length width050 | |
direction 'E' | |
update 10 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget FSSpaceBar4 { | |
class 'Bar' | |
expression statfs(V_FS4, 'blocks') - statfs(V_FS4, 'bfree') | |
expression2 statfs(V_FS4, 'blocks') - statfs(V_FS4, 'bavail') | |
max statfs(V_FS4, 'blocks') | |
length width050 | |
direction 'E' | |
update 10 * second | |
background std_bg_bar | |
barcolor0 std_fg_bar0 | |
barcolor1 std_fg_bar1 | |
} | |
Widget ServicesTitle { | |
class 'Text' | |
expression 'Services' | |
width width100 | |
align 'C' | |
background std_bg_inverse | |
foreground std_fg_inverse | |
} | |
Widget SambaStatus { | |
class 'Text' | |
expression 'Samba ' | |
width width050 | |
postfix exec('/usr/local/bin/mystatus smbd', 10 * second) | |
update 10 * second | |
} | |
# the Syslog widgets may increase system load | |
Widget SyslogTitle { | |
class 'Text' | |
expression '/var/log/syslog' | |
width width100 | |
align 'C' | |
foreground std_fg_inverse | |
background std_bg_inverse | |
} | |
Widget SetSyslogMsg { | |
class 'Timer' | |
expression SyslogMsg = exec('tail -n 1 /var/log/syslog', 4 * second) | |
active 1 | |
update 10 * second | |
} | |
Widget Syslog1 { | |
class 'Text' | |
expression substr(SyslogMsg, 0 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 10 * second | |
} | |
Widget Syslog2 { | |
class 'Text' | |
expression substr(SyslogMsg, 1 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 10 * second | |
} | |
Widget Syslog3 { | |
class 'Text' | |
expression substr(SyslogMsg, 2 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 10 * second | |
} | |
Widget Syslog4 { | |
class 'Text' | |
expression substr(SyslogMsg, 3 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 10 * second | |
} | |
Widget TopTitle { | |
class 'Text' | |
expression 'USER PID %CPU VSZ TIME COMMAND' | |
width width100 | |
align 'L' | |
background std_bg_inverse | |
foreground std_fg_inverse | |
} | |
Widget SetTopMsg { | |
class 'Timer' | |
# ps output must be exactly with100 (51) characters wide, including \n | |
# (the last field 's' ensures there are no shorter lines). | |
# /bin/ps -e -o "user:8,pid:5,pcpu:4,vsize:6,cputime:8,comm:12,s:1" --cols 51 --sort -pcpu | |
# mysql 1218 1.5 151696 00:03:26 mysqld S | |
expression TopMsg = exec('/bin/ps -e -o "user:8,pid:5,pcpu:4,vsize:6,cputime:8,comm:' . (width100 - 39) . ',s:1" --cols ' . width100 . ' --sort -pcpu | /usr/bin/tail -n"+2" | /usr/bin/head -5', 4 * second) | |
active 1 | |
update 4 * second | |
} | |
Widget Top1 { | |
class 'Text' | |
expression substr(TopMsg, 0 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 4 * second | |
} | |
Widget Top2 { | |
class 'Text' | |
expression substr(TopMsg, 1 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 4 * second | |
} | |
Widget Top3 { | |
class 'Text' | |
expression substr(TopMsg, 2 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 4 * second | |
} | |
Widget Top4 { | |
class 'Text' | |
expression substr(TopMsg, 3 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 4 * second | |
} | |
Widget Top5 { | |
class 'Text' | |
expression substr(TopMsg, 4 * width100, width100) | |
width width100 | |
align 'L' | |
foreground std_fg_area | |
background std_bg_area | |
update 4 * second | |
} | |
Widget na { | |
class 'Text' | |
expression 'n/a' | |
width 3 | |
align 'L' | |
} | |
Widget Bgnd { | |
align 'C' | |
class 'Image' | |
file '/home/admin/truenas-img.png' | |
reload 0 | |
inverted 0 | |
visible 1 | |
} | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
# Layout | |
#----------------------------------------------------------------------------------------------------------------------------------- | |
Layout helios4 { | |
layer 1 { | |
Row01.Col01 'System' | |
Row02.Col01 'Time' | |
Row04.Col02 'CPU' | |
Row04.Col21 'CPUTemp' | |
Row05.Col02 'CPUBar' | |
Row07.Col02 'Load' | |
Row08.Col02 'LoadBar' | |
Row10.Col02 'Memory' | |
Row11.Col02 'MemoryBar' | |
Row13.Col02 'Netdev' | |
Row14.Col02 'NetdevBar' | |
Row04.Col29 'Disk' | |
Row05.Col29 'DiskBar' | |
Row07.Col29 'FSSpace1' | |
Row08.Col29 'FSSpace2' | |
Row09.Col29 'FSSpace3' | |
Row10.Col29 'FSSpace4' | |
Row12.Col36 'HDDStatus1' | |
Row13.Col36 'HDDStatus2' | |
Row14.Col36 'HDDStatus3' | |
Row15.Col36 'HDDStatus4' | |
Row16.Col36 'HDDStatus5' | |
Row17.Col36 'HDDStatus6' | |
# Row18.Col02 'ServicesTitle' # some are not set up yet | |
# Row20.Col29 'SambaStatus' | |
# Row25.Col02 'SyslogTitle' | |
# Row26.Col02 'Syslog1' | |
# Row27.Col02 'Syslog2' | |
# Row28.Col02 'Syslog3' | |
# Row29.Col02 'Syslog4' | |
# Row25.Col02 'TopTitle' | |
# Row26.Col02 'Top1' | |
# Row27.Col02 'Top2' | |
# Row28.Col02 'Top3' | |
# Row29.Col02 'Top4' | |
# Row30.Col01 'Debug' | |
} | |
Layer 2 { | |
X1.Y1 'Bgnd' | |
} | |
Timer1 'SetSyslogMsg' | |
# Timer1 'SetTopMsg' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, apt finally works.
Thank You Very Much!