I know there has to be a way, I just can not find it.
What I want to do is with the terminal find a way to create a list of only the .apk files in a folder, would also be nice to know how to list other different file extensions.
My goal is to create a text file with a list of all the apks in my /system/app folder, and other folders as needed.
Thanks
Don't know if this works on Android, but in a standard Linux shell you can cd to the directory (which would be /system/app in your case) and then type ls > file.txt (file can be named anything).
In Windows, you can give this command:
Code:
Dir c:\ /s>dir.txt
and it will create a directory listing of the entire file system and write the results to a file named dir.txt.
Is there a way to accomplish the same thing on an Android device?
Loyal AMLOGIC fanboy here messing around with a CS918 for only the third time . . . .
I am trying to run a shell to unpack an archive, there's a smali file that downloads the archive to /sdcard/Android/data, this part works fine.
The SH should then unpack to the same directory, this part fails.
My question is, does the directory path format require changing depending on your action (even though it's all going to the same place)?
I unpacked the rom's IMG file to see how other scripts are interacting with the filesystem and am seeing the following paths used by different files - but they all go to the same place:
/data/user/0/
/mnt/sdcard/Android/data/
/data/data/
Here is what the .sh file is trying to accomplish:
tar -xf /sdcard/Android/data/settings.tar -C /sdcard/Android/data/
rm /sdcard/Android/data/settings.tar
For the record, this works flawlessly on AMLOGIC using the path:
/storage/emulated/legacy/Android/data
Just incase anyone comes across this via searching:
The correct path is /mnt/sdcard/Android/data/ - but you have to run the batch as root
As the title says, I need a terminal emulator script to quickly delete some folders from the data/data/*appname* partition.
All these folders are named "temp" but they are all subfolders of subfolders of subfolders.
Is there a terminal emulator command to identify all the "temp" subfolders (or subsubsubfolders) in a directory and delete them or do I have to type the location of every single one of them (like -rm data/data/app/sub/sub/temp ?)
Thanks in advance for your help.
Three .sin files from stock are needed: vendor, kernel, system.
Unsin while in .sin folder:
-d to extract all files in working directory
./unsin.exe -d
You will end up with one .img file and two .ext4 files.
kernel_X-FLASH-ALL-C93B.img
system_X-FLASH-ALL-C93B.ext4
vendor_X-FLASH-ALL-C93B.ext4
While on the linux side of things, mount the .ext4 files using: mount -o loop
make sure folder 'ExtractFirm'(name it whatever you want) exists before hand. Folder closing then opening may be needed
sudo mount -o loop system_X-FLASH-ALL-C93B.ext4 ~/ExtractFirm/
Don't forget to chown the files as yours:
sudo chown -R username:group ExtractFirm/
copy the necessary files(into Firmware_Dump folder), then issue the command below when done with the mount:
sudo umount ~/ExtractFirm
--------------------
Find AIK-Linux in the dev sections on xda
Copy kernel_X*.img to AIK extracted folder then issue:
./unpackimg.sh kernel_X-FLASH-ALL-C93B.img
Own your files:
sudo chown -R username:group ramdisk/
Then copy(into Firmware_Dump folder) the contents of ram disk, if they're some errors(usually because of sym. links) with copying them, hit skip, otherwise merge all, replace all.
Lastly, mount vendor:
sudo mount -o loop vendor_X-FLASH-ALL-C93B.ext4 ~/ExtractFirm/
The kernel copy you did previously gave you an empty vendor folder. Copy all contents of the vendor mount into this empty vendor folder(within Firmware_Dump folder).
Dont forget:
sudo umount ~/ExtractFirm
Now that you have extracted firmware contents, you can run extract-files.sh for lineage/custom build:
~/lineageos/device/sony/poplar_dsds$ ./extract-files.sh ~/location of extracted contents/
These are just reference notes for everyone, I'm sure I'll need them again.
thanks @derf elot
great, thanks for the write up we can redirect people here if the question of how to extract files comes up again - which I'm sure it will
Sent from my Sony Xperia XZ1 Compact using XDA Labs
derf elot said:
great, thanks for the write up we can redirect people here if the question of how to extract files comes up again - which I'm sure it will
Sent from my Sony Xperia XZ1 Compact using XDA Labs
Click to expand...
Click to collapse
Indeed it will.
Great guide! I was thinking about automating stuff, but e.g. the copy works best when not done from the shell but from the file manager. The ignore, replace and merge all works perfect there.
Before anyone tries, here my failed attempts:
- Using 7z to extract the ext4 files, works somehow but fails to keep symlinks. But it would be faster...
- `cp -a` doesn't replace symlinks by actual folders and has some errors shown and some files/folders removed. Not sure if safe... So use file manager
- When using a VM make sure the AIK and the final folder are on ext4 filesystems, not shared/mounted from Windows hosts. Avoids failures with symlinks shown as "permission denied"
Edit: Ok I had failures and got an update to the guide:
- Start with the kernel extraction
- Then extract system*.ext4 to the system folder inside the above folder
- Then extract vendor.*ext4 to the vendor folder inside the above folder