View Single Post
Old 10-30-2018, 03:35 PM   #114
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by NiLuJe View Post
* Yeah, it only writes the state to the config if retainStateOverRestart is enabled in the [state] section... :/.

* I may have totally missed how the parser handled ini sections... .
i.e., the test should probably be grep -q "invertActive = yes", since state is the section, so, a [state] header, and not a state: prefix like it's handled in the code.
I think we're in business! The above 2 things are the key.

However, when NightMode rewrites nightmode.ini, the format of the line changes slightly.
Original .ini:
Code:
[state]
invertActive = no		# yes / no
Re-written .ini:
Code:
[state]
invertActive                   = no
So I think a regex will fix that. After a bit of googling I came up with this. Does it look OK?
Code:
if grep -Eq "invertActive\s*=\s*yes" "/mnt/onboard/.kobo/nightmode.ini" ; then
jackie_w is offline   Reply With Quote