DietPi V6 ROCKS!!!!!

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
pakikje
Posts: 124
Joined: Fri Nov 11, 2016 3:04 pm

DietPi V6 ROCKS!!!!!

Post by pakikje »

Hello y'all,

I just went from DietPi 1.59 to V6 in NO time at all!!

Everything works great (and faster!)

Just one question. I add some variables (for example: DietPi-version) to my website.

script:

#!/bin/bash

VAR2="$(df -h /mnt/dietpi_userdata | tail -1 | awk '{print $4}')"
VAR3="$(cat /etc/debian_version)"
VAR4="$(cat /boot/dietpi/.version)"
VAR5="$(wc -l < ~/motion.txt)"
sed -i "1s/.*/\<p style="color:#FFFFFF">Free Space \= $VAR2 \/ OS \= Debian $VAR3 \/ DietPiVersion \= $VAR4 \/ Reboots \= $VAR5\<\/p\>/" /var/www/index.html

But the command: "(cat /boot/dietpi/.version)" now gives me 2 lines with numbers instead of 1 line. (and therefor the above script doesn't work).

What's clever? trying to remove the "newlines" in .version. (or will that interfere with dietpi-scripts that look in this file?)

Again: DietPi V6 ROCKS!!!!!

(a Odroidc2 user)
pakikje
Posts: 124
Joined: Fri Nov 11, 2016 3:04 pm

Re: DietPi V6 ROCKS!!!!!

Post by pakikje »

got it:

VAR4="$(sed -n ':a; $ ! {N;ba}; s/\n/./g;p' /boot/dietpi/.version)"

(output is: "6.1")
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPi V6 ROCKS!!!!!

Post by MichaIng »

Thanks for your kind feedback! :)
Okay you already found it. Yeah 1. line = main version, 2. line = subversion. Separated to make handling in scripts easier.
Post Reply