FORUMS
Remove All Ads from XDA

[TOOLS][ZIPS][SCRIPTS] osm0sis' Odds and Ends [Multiple Devices/Platforms]

13,698 posts
Thanks Meter: 30,280
 
By osm0sis, Recognized Developer / Recognized Contributor on 18th April 2013, 12:37 AM
Post Reply Email Thread
23rd July 2019, 08:29 AM |#2441  
guest4711's Avatar
Senior Member
Flag Београд (Beograd/Belgrade/Griechisch Weißenburg/Alba Graeca; Alba Bulgarica)
Thanks Meter: 2,219
 
More
Quote:
Originally Posted by ianmacd

A tangential question about coding style: Why do you terminate every line with a superfluous semi-colon? This is unimportant, but I haven't seen this particular idiosyncrasy before, so I'm curious.

It's a hommage to Pascal (and Modula2) where a statement is terminated by a semicolon.
23rd July 2019, 08:41 AM |#2442  
ianmacd's Avatar
Senior Member
Flag Amsterdam
Thanks Meter: 3,071
 
More
Quote:
Originally Posted by DiamondJohn

for me, I find that If you get everything else in the line correct, then it is superfluous, however, if you do make a typo (which happens often) it highlights the mistake quicker as opposed to continuing to the net line waiting for more input.

Fair enough. To my mind, a typo wouldn't be any harder to spot if it incurred an unintended line continuation; and such a convenience wouldn't, in any case, compensate for the stylistic penalty that the semi-colon imposes. But tastes differ, so let's leave it at that.

Quote:

Also, adding the semi-colon to the end enables multiple lines on the same line. frivolous example

Code:
cd ~/android; ls -l; cd ~/;

Of course. We all use it as a command separator; it's just the use as a line terminator that I was querying.
23rd July 2019, 09:24 AM |#2443  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,280
 
Donate to Me
More
I adopted it since I ran into problems where newlines weren't always carried over in a copy/paste into adb shell or Terminal Emulator or wherever, but if I terminated with ; (which many coding languages enforce, though shell does not) then things always copy/pasted in a working format.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
23rd July 2019, 09:54 AM |#2444  
Senior Member
Thanks Meter: 111
 
More
it is historical C ++ style
23rd July 2019, 10:08 AM |#2445  
ianmacd's Avatar
Senior Member
Flag Amsterdam
Thanks Meter: 3,071
 
More
Quote:
Originally Posted by osm0sis

I adopted it since I ran into problems where newlines weren't always carried over in a copy/paste into adb shell or Terminal Emulator or wherever, but if I terminated with ; (which many coding languages enforce, though shell does not) then things always copy/pasted in a working format.

Thanks for answering. I was curious whether you might have learned shell after a language that enforced semi-colons as line terminators, such as C or Java.

Someone (jokingly, I think) suggested you might have been an old Modula-2 programmer, but I would have put money on that not being the case. I think only me, Niklaus Wirth and one other bloke I once knew were ever Modula-2 programmers.
The Following 3 Users Say Thank You to ianmacd For This Useful Post: [ View ] Gift ianmacd Ad-Free
28th July 2019, 11:06 AM |#2446  
ianmacd's Avatar
Senior Member
Flag Amsterdam
Thanks Meter: 3,071
 
More
Quote:
Originally Posted by osm0sis

There's also a debate of whether the loop mounted ext4 .img is better than using a tmpfs mount instead (e.g. `mount -t tmpfs -o size=400M,noatime tmpfs $TMP`), but that depends on whether your devices might have a bottleneck on free space on /data to hold the ext4 .img vs. free RAM to hold the tmpfs. I went with ext4 .img since that should help on low-end devices (provided they have the space). switchroot uses tmpfs; AIK-mobile will continue to use ext4 .img since people need to be able to pick up where they left off.

From reading the code, it's not clear to me why you create and mount an ext4 image at all. Is this just for AnyKernel? I have no familiarity with that, hence the question. Because a normal updater script is simply going to do its work on the root file-system that you just remounted r/w. I don't really see why you go to the trouble of creating the ext4 image, because nothing obviously writes to it, although I suppose most updater scripts will use /tmp as a scratchpad.

Anyway, if you could clarify, I'd be grateful.
28th July 2019, 05:18 PM |#2447  
osm0sis's Avatar
OP Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,280
 
Donate to Me
More
Quote:
Originally Posted by ianmacd

From reading the code, it's not clear to me why you create and mount an ext4 image at all. Is this just for AnyKernel? I have no familiarity with that, hence the question. Because a normal updater script is simply going to do its work on the root file-system that you just remounted r/w. I don't really see why you go to the trouble of creating the ext4 image, because nothing obviously writes to it, although I suppose most updater scripts will use /tmp as a scratchpad.

Anyway, if you could clarify, I'd be grateful.

Well there's the memory vs. disk space debate I mentioned, but beyond that you can't unpack a ramdisk in booted Android under /data or anywhere except tmpfs or an ext4 .img or it gets wildly corrupted on the repack, so that's how it started.

When / was tmpfs from a ramdisk that was fine, but now with it being system-as-root you'd run into issues with modifying the system partition and there being space to do so if you didn't then mount something on top to give you space to work.

/tmp itself is important for a lot of flashable zips which have it hardcoded to unzip themselves there and that's where all zip flashing takes place in recovery.
The Following 4 Users Say Thank You to osm0sis For This Useful Post: [ View ]
29th July 2019, 04:50 AM |#2448  
Senior Member
Flag Regensburg
Thanks Meter: 39
 
Donate to Me
More
Hi all, anyone know how to edit default.prop on LineageOS 16.0? Because on boot.img -> ramdisk, there is no default.prop file.
29th July 2019, 07:21 AM |#2449  
Senior Member
Flag Bielefeld
Thanks Meter: 210
 
More
Quote:
Originally Posted by LonelyDay

Hi all, anyone know how to edit default.prop on LineageOS 16.0? Because on boot.img -> ramdisk, there is no default.prop file.

/default.prop is a link to /system/etc/prop.default here, mind the exchanged name parts. And then there is a different one in /vendor/default.prop
The Following User Says Thank You to nussbaum For This Useful Post: [ View ] Gift nussbaum Ad-Free
29th July 2019, 01:46 PM |#2450  
Senior Member
Flag Regensburg
Thanks Meter: 39
 
Donate to Me
More
Quote:
Originally Posted by nussbaum

/default.prop is a link to /system/etc/prop.default here, mind the exchanged name parts. And then there is a different one in /vendor/default.prop

And this possible to change ro.debuggable=0, ro.secure=1, and ro.build.selinux=0?

My apps banking detect my rom is rooted, but not using supersu/magisk, rootbear says my device is dangerous props and selinux flag experiemntal its fail.
30th July 2019, 02:19 AM |#2451  
Senior Member
Flag Sydney
Thanks Meter: 1,866
 
More
Question
Sorry if the following question is OT, but it appears to be thread which can stray...

I am trying to find a shell command or system file that reports/saves the times the device is switched on and off? I can get the battery drain from multiple places (eg dumpsys batterystats, but all the ones I have found thus far, show a time line in respect to only while the phone is on. For example, if I charge the phone to 100%, leave it on for 1hr then turn the phone off for 8hrs, then turn it on for 1hr, the details imply that the phone was on constantly for 2hrs. No reference that I can see logs that it was off for an 8hr window. Have I missed something or is there somewhere else where it is stored?
Post Reply Subscribe to Thread

Tags
automation, batch, flashable zip, script, tool

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes