Where are /system/build.prop and /vendor/build.prop stored on the ADB shell side on Lineage 19.x GSI’s? - android-12

I’m running an ADB shell on my main device, whose ROM was dead due to forgetting to append emulator after
ro.build.characteristics=tablet
, when appended this line becomes
ro.build.characteristics=tablet,emulator
, on both files in the title.
Since i know where they are, this is solved, i know pull to and push from PC commands inside ADB shell.

Related

Linux - Open terminal for input/output

I'm coding a Rust app and since it's fairly small and there don't appear to be any stable UI frameworks, I've made it run in the console using println! and whatnot for input/output. However since this program is intended to be used by people directly after downloading from the internet (due to its use case), they're likely to just double click on it instead of navigating to their downloads directory in a terminal and running it from there.
This is a problem because on Linux, it runs in the background waiting for input and looks like it's not working. On Windows, Rust programs do open in CMD by default. (and in fact many of the search results for my question were about disabling this behavior - the exact opposite of what I want!).
So is it possible to somehow make my application open in the system's default terminal? My preferred way would be to somehow embed in the executable to open in terminal (similar to the -mconsole compiler flag on MinGW). Otherwise would it be possible to detect it's in the background and fork it into a terminal? If that's not possible then is it at least possible to detect that the app is not running in a terminal and throw up a message box telling the user to run in a terminal?
My app is cross-platform but I'm OK with writing code conditionally compiled on one OS.
One typical way would be to distribute a program.sh along with your executable. If .sh extension is bound to opening a terminal in their window manager of choice, it would open automatically. If not - it is enough of a hint for running it from the shell.
Without this file you could:
Detect if the program is already running inside a terminal can be done with isatty(). There's a crate for it.
If not, spawn the terminal app process (see process::Command) and relaunch the program with it by passing its path to the terminal command line options. As #Caesar mentioned there's a bunch of popular terminals that you might want to check for presence on Linux. If nothing is found, xterm could sometimes be a fallback.

How to identify when a process is triggered?

I have a script in Linux (read-only partition that I cannot change or edit the file) that I want to know when this file is triggered by an external command (button connected to the device). This device is not a pc, so there is no keyboard, but I have telnet access as root.
I know what is and where is the file I want to monitor, but as I said in the beginning the partition is read-only and I cannot change it. Read-only partition is squashfs and would be easier if I could change the file, but as I said, I cannot change it.
So What I want is to find a way to "be informed" when this script is called, My aim is to identify who/how the script is called.
I've tried ps and top but the script runs to quickly to be identified for those and when I can find it using ps I do not know who triggered this script.
My idea is to monitor this script and when it is triggered I can run another command.
Script is located on /usr/bin/command
I do have access (read-write) to other partitions where I can put a script to run the second call.
Thanks in Advance.

Create script to run multiple commands with variable in linux

So basically, I'm trying to streamline a process where I run an executable script to update remote devices that are connected to my server. Initially, I had a few devices that I would update, but it's gotten to the point where it's over 40 and it takes forever to update them all manually. I'd like to create a script to update them all at the same time using the executable, but the only thing I can't figure out is how to include a variable in the script that I can input on the command line, as the version_number has to be manually inputted.
Right now, it looks something like this :
./updater-app device_number version_number
What I've been doing is just copying and pasting a long command to somewhat streamline the process, however, with over 40 devices to update, it's somewhat tedious, and will only get worse with remote devices to update in the future
./updater-app device1 version20 & ./updater-app device2 version20 & ./updater-app device3 version20 & .... and so on.
Since the device numbers all stay the same, basically I just want to create a shell script that allows me update all of them at the same time, but input a version_number variable on the command line, as that changes every time a new version of the device software comes out.
I guess you can create a loop and run the whole update script one by one. It will run parallel, as it's running in background
listOfDevices=("device1" "device2" "device3" ....)
version=$1
for device in "${listOfDevices[#]}"
do
./updater-app $device $version &
done

Terminal not clearing after auto start bashscript in raspbian wheezy

I'm using a raspberry pi 2 to show all the video's in a folder. The raspberry automatically boots up (with a generic electric timer) in to console (not the gui) and after it boots it runs a bashscript I found here. This bashscript contains an infinite loop to play all the videos in a folder using omxplayer.
When I boot in to consolemode and manually start the script everything works perfectly. The terminal screen clears, the first video starts, and after it ends there is a second or two of black screen (empty terminal) and the second video starts playing. This is exactly what I want.
However, when I use crontab to start this script (#reboot /path/to/script.sh) the terminal messages stay and it doesn't clear everything between video's.
I've tried creating my own script that first clears everything, and then calls the second script. But this doesn't work.
I'm really really new in this field (but I'm having fun) so any pointers in the right direction would be appreciated!
P.S. I edited the /boot/cmdline.txt file so it doesn't display critical kernal logs as a work-around.
You should not be doing this using cron. You should be changing the inittab so that it runs outside any environment that may be created. See the inittab(5) man page for details. You may also be interested in openvt(1) as well.

Handling input device plug/unplug while reading from it

I have a bluetooth remote that is paired with my linux box, when active, this remote is visible at /dev/input/event13.
I have a small C program that open this device and read directly from it, which works fine.
Now, my problem is that this remote goes to sleep after a few minutes of inactivity and /dev/input/event13 disappears. It reappears as soon as I press a key on my remote.
I put the output of udevadm here: https://gist.github.com/9fff2f0d7edef1050060.
I use the following code (small ruby ext I wrote), to read from the device: https://gist.github.com/b403d538eb6a8627e2bd.
I thought of writing an udev rule that would start my program when my remote is added and stop it when it is removed. I read the udev documentation, but I couldn't figure it out how to do it. I'm open for suggestion.
After some digging and a lot of frustration I did the following:
I put into /etc/udev/rules.d/99-rmote.rules
KERNEL=="event*", SUBSYSTEM=="input", ACTION=="add|remove", ATTRS{name}=="TiVo Keyboard Remote", RUN+="/home/kuon/handleConnect.rb"
And in handleConnect.rb I check the ACTION environment variable and I start/stop my daemon accordingly. Quite simple in the end and it works well.

Resources