gl
9 pagesV  « < 6 7 8 9 > »   
 
REPLY
> Bash script as update-binary for zip update | We use simple and beautiful shell scripts instead of edify, we save.
What do you like more?
What technology do you prefer:
Simple and clear Unix-Shell script, whose possibilities are almost endless [ 81 ] ** [91,01%]
Difficult to understand and debug script edify, which has limitations [ 8 ] ** [8,99%]
Total votes: 89
 
Twaikyont
Message#1
30.01.15, 01:09
Only hardcore
*********
[offline]

Group: Curators
Messages 4856
Check in: 27.12.12

Reputation:-  358  +

Bash-������ � �������� update-binary ��� ZIP-���������� download



useful links
How does Recovery run the update?
S-trace, with my additions @ 09/10/2012, 00:33*
A bit of theory about how to install a Zip archive from Recovery.
Recovery extracts the file META-INF / com / google / android / update-binary to / tmp from the archive with the update, makes it chmod 777 and starts by passing three parameters:
$ 1. API level. This number is from 1 to 3 (in my case it was 2). For us, completely useless.
$ 2. Pipe descriptor for Recovery feedback. We will deal with it in more detail later.
$ 3. The full name of the zip update. Here I think everything is clear.
Is there a blank?
There is. Normal multi-line output is organized (with the usual ui_print, everything was displayed in one line).
Bash script as update-binary for ZIP-update (Post ottiwell # 52319644)
Advantages over Edify
1. A simple and understandable Unix-Shell script, whose capabilities are almost endless, instead of the hard-to-understand and debug script of edify, which has limitations
2. Significant space savings by eliminating unnecessary binaries.
3. A large numberready solutionsfor all occasions.


Post has been editedottiwell - 19.08.16, 18:51
Reason for editing: RekGRpth scripts
Vavun
Message#142
16.04.18, 21:37
Ex merovingian111
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 3143
Check in: 22.07.14
HTC One S

Reputation:-  647  +

Greetings

Do not think for arrogance, forced to be a beggar, I will explain what was happening:
In this topicmicroG GmsCore is a FLOSS frameworkOften you have to help users in QMS to patch files, and you have to explain what and how to replace, what rights to set, how to reboot, etc., so that there are no problems and everything works.
Request:
Could someone give an example of the universal contents of the shell script used instead of the binary update-binary (I hope I truly understood that the shell script instead of the binary will provide greater support for recovery?) To make a universal preset, on the basis of which I would have done individual zip for recovery for individual users?

Essentially, you need an update-binary shell script that will replace only two files.
/system/framework/services.jar
/system/framework/framework-res.apk
No more extra functionality is required.

And then the further I try to figure it out, the further I get confused.


--------------------
Rusm
Message#143
16.04.18, 22:14
a.k.a shoma_81
*********
[offline]

Group: Honorary Gameday
Messages 10536
Check in: 17.10.11
Xiaomi Mi 4 WCDMA

Reputation:-  2757  +

* Merovingian111,
HoldAttached filemod_microG_GmsCore.zip(3.23 KB)

Patched files to throw in the patch folder
Replaced files are backed up along the path: / sdcard / backups. If you wish, you can either backup or make it so that a ready update is created, but now I was too lazy.
There is a dummy in the patch folder to prevent empty archives from being deleted by various archivers. Dummy is not copied. The content of the update after installation is cleared
Installer Content
#! / sbin / sh
#
OUTFD = $ 2;
ZIP = $ 3;

ui_print () {
echo -n -e "ui_print $ 1 \ n">/ proc / self / fd / $ OUTFD
echo -n -e "ui_print \ n">/ proc / self / fd / $ OUTFD
}

sleep 3;

# Mount system
ui_print "==================";
ui_print "==================";
ui_print "Mounting system ...";
sleep 1;
mount / system;
mount -o rw, remount / system;
mount -o rw, remount / system / system;
sleep 1;
ui_print "Done!";
sleep 3;

# Unzip update.zip
ui_print "Unziping updater ...";
sleep 1;
cd / tmp;
unzip -o "$ ZIP";
sleep 1;
ui_print "Done!";
sleep 3;

# Backup
ui_print "Backing up orig files ...";
sleep 1;
mkdir -p / sdcard / backups;
cp /system/framework/framework-res.apk /sdcard/backups/framework-res.apk;
cp /system/framework/services.jar /sdcard/backups/services.jar;
sleep 1;
ui_print "Done!";
sleep 3;

# Install
ui_print "Installing mod ...";
sleep 1;
cp /tmp/patch/framework/framework-res.apk /system/framework/framework-res.apk;
cp /tmp/patch/framework/services.jar /system/framework/services.jar;

sleep 1;
ui_print "Done!";
sleep 3;

# Settings permissions
ui_print "... and setting permissions ...";
sleep 1;
find / system -type d | xargs chmod 0755;
find / system -name * .apk | xargs chmod 0644;
find / system -name * .jar | xargs chmod 0644;
sleep 1;
ui_print "Done!";
sleep 3;

# Clean up
ui_print "Cleaning temporary dirs ...";
sleep 1;
rm -rf / tmp / META-INF;
rm -rf / tmp / patch;
sleep 1;
ui_print "Done!";
sleep 3;
ui_print "Instalation complete!";
ui_print "=====================";
ui_print "=====================";

For ease of reference in case you have questions

Post has been editedshoma_81 - 16.04.18, 22:26
Reason for editing: Perezal
Vavun
Message#144
17.04.18, 16:10
Ex merovingian111
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 3143
Check in: 22.07.14
HTC One S

Reputation:-  647  +

And how to make a conclusion in one line?
Type
ui_print "Bla-bla-blaing:"
sleep 100500
ui_print "DONE"

That as a result, after the completion of sleep came out
Bla-bla-blaing: DONE

?

I tried to modify the ui_print section by removing \ n and so on, but what doesn’t it ...
In general, I tried to make another section of ui_print0 but the output text without a line break.


--------------------
blackeangel
Message#145
18.04.18, 11:56
Nothing Is Impossible! Never
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 2088
Check in: 12.12.14
Xiaomi Redmi 4 Prime

Reputation:-  734  +

* Merovingian111,
ui_print "Bla-bla-blaing: DONE"


--------------------
Forget the pain, forget the fear - And only the wind in the sails!
Updater Script Generator (USG)(Program for creating updater-script (update.zip) based on boot.img and system.img)
Adomb
Message#146
20.04.18, 17:21
Old resident
*******
[offline]

Group: Friendssavagemessiahzine.com
Messages 910
Check in: 02.08.12
Xiaomi Redmi Note 3 Pro Prime

Reputation:-  222  +

Android 8.1
I update the apk in system / app
Here are the scripts -
updater-script
ui_print ("update apk system ...");

run_program ("/ sbin / busybox", "mount", "/ system");
package_extract_dir ("system", "/ system");

package_extract_file ("run / 1.sh", "/tmp/1.sh");
set_metadata ("/ tmp / 1.sh", "uid", 0, "gid", 0, "mode", 0755);
run_program ("/ tmp / 1.sh");

run_program ("/ sbin / busybox", "umount", "/ system");
ui_print ("Installation complete!");

1.sh
#! / sbin / sh
#

z = "find / system / app / / system / priv-app /"
$ z -type d -exec chmod 755 {} \;
$ z -type f -exec chmod 644 {} \;
$ z -exec chown 0: 0 {} \;

New caps are put in place to replace old ones, rights are set, everything is visible, when I boot into the system, you can see in the total commander, that the device is in the system / app ... new, it’s clear that the rights are correct, and the updated applications mysteriously remain old and work, as if nothing had happened. Art cache cleaned, in the data / app there are no copies. The most interesting thing is to go to TvRP, manually copy the apk in its place, manually set the rights, load, and the application is updated.
Where the dog rummaged and what am I doing wrong?

Post has been editedAdomb - 20.04.18, 17:32
blackeangel
Message#147
20.04.18, 19:43
Nothing Is Impossible! Never
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 2088
Check in: 12.12.14
Xiaomi Redmi 4 Prime

Reputation:-  734  +

* AdombWhat is this circus for?
It should be something like this:
ui_print ("update apk system ...");
run_program ("/ sbin / busybox", "mount", "/ system");
package_extract_dir ("system", "/ system");
set_metadata_recursive ("/ system / app", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive ("/ system / priv-app", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
run_program ("/ sbin / busybox", "umount", "/ system");
ui_print ("Installation complete!");

It feels like either the mount doesn't work or the files are not extracted.
Could lay out the archive, with folders, with an empty system folder?

Post has been editedblackeangel - 20.04.18, 19:50


--------------------
Forget the pain, forget the fear - And only the wind in the sails!
Updater Script Generator (USG)(Program for creating updater-script (update.zip) based on boot.img and system.img)
Adomb
Message#148
20.04.18, 22:38
Old resident
*******
[offline]

Group: Friendssavagemessiahzine.com
Messages 910
Check in: 02.08.12
Xiaomi Redmi Note 3 Pro Prime

Reputation:-  222  +

* blackeangel
No, well, the files are extracted. I checked both with total and soldexplorer - after a reboot, new versions of the arcades are in place, in their folders and with the necessary permissions. Once again I first tried and erased the cache and the data / app folder checked - there are no copies, and the system shows that the old versions are installed and they work. But sdmaid, for example, does not see them among installed applications. These are all the tricks I can not understand.
Attached Image

Attached fileupdate.zip(817.11 KB)

About the circus - just played, studied all sorts of possibilities and went through more difficult.

Post has been editedAdomb - 20.04.18, 22:57
blackeangel
Message#149
20.04.18, 23:02
Nothing Is Impossible! Never
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 2088
Check in: 12.12.14
Xiaomi Redmi 4 Prime

Reputation:-  734  +

Adomb @ 04/20/18 22:38*
I tried it again first and artkash erased it and checked the data / app folder - no copies,

What about:
/ data / data?
/ sdcard / Android / data?
/ external_sd / Android / data?
/ cache?
Tried to clean these tails together with dalvik-cache?

And I also see from you that these gaps are updated. You can download off the gaps, throw out too much of them, so to speak, make your own assembly and flash it.

Post has been editedblackeangel - 20.04.18, 23:05


--------------------
Forget the pain, forget the fear - And only the wind in the sails!
Updater Script Generator (USG)(Program for creating updater-script (update.zip) based on boot.img and system.img)
Adomb
Message#150
20.04.18, 23:27
Old resident
*******
[offline]

Group: Friendssavagemessiahzine.com
Messages 910
Check in: 02.08.12
Xiaomi Redmi Note 3 Pro Prime

Reputation:-  222  +

* blackeangel
Oh, I tried everything. ️
No tails.
In manual you put - it is updated. Automatically - updates are not picked up.
blackeangel
Message#151
20.04.18, 23:32
Nothing Is Impossible! Never
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 2088
Check in: 12.12.14
Xiaomi Redmi 4 Prime

Reputation:-  734  +

* Adomb, and after starting again tried all the applications (which were updated) to start and reload again?


--------------------
Forget the pain, forget the fear - And only the wind in the sails!
Updater Script Generator (USG)(Program for creating updater-script (update.zip) based on boot.img and system.img)
Anton Mikhaylych
Message#152
05.09.18, 19:50
a guest
*
[offline]

Group: Banned
Messages 3
Check in: 04.09.18
Samsung Galaxy Tab Pro 10.1 LTE

Reputation:-  0  +

I wrote my shell script as update-binary, but Tvrp crashes with error 2, is there a log what to do?
Checking Digest Files ...
Skip Digest Check: Digest File Not Found
I: Update binary zip
I: Zip doesn’t contain the SELinux file_contexts file in its root.
I: Legacy property environment not used in updater.
E: unknown command [/ tmp / updater:]
Updater process terminated with ERROR: 2
I: Install took 0 second (s).

Attached Image


Post has been editedvaalf - 05.09.18, 20:10
Reason for editing: Pictures under spoiler, section rules
blackeangel
Message#153
05.09.18, 19:52
Nothing Is Impossible! Never
*********
[offline]

Group: Friendssavagemessiahzine.com
Messages 2088
Check in: 12.12.14
Xiaomi Redmi 4 Prime

Reputation:-  734  +

* Anton Mikhaylych, put the file and the screen under the spoiler

Post has been editedblackeangel - 05.09.18, 19:54


--------------------
Forget the pain, forget the fear - And only the wind in the sails!
Updater Script Generator (USG)(Program for creating updater-script (update.zip) based on boot.img and system.img)
gfofanov
Message#154
19.10.18, 18:18
Veteran
********
[offline]

Group: Friendssavagemessiahzine.com
Messages 1335
Check in: 25.09.12
Jiayu S3 Advanced

Reputation:-  182  +

Blackeangel@24.08.16, 15:22*
Recursively set the rights to the folder with files

In my opinion, there is a small mistake - the arguments are confused. So it is more correct:
...
elif [-f "$ i"]; then
chmod $ 6 "$ i"
chown $ 4: $ 5 "$ i"
fi
...
Skyrimus
Message#155
24.01.19, 01:23
Man with straight arms
*********
[online]

Group: Curators
Messages 2728
Check in: 26.12.13
Asus MeMO Pad 7 ME176CX

Reputation:-  761  +

I have not seen

The abort command is exit 1, we write something in ui_print and after it exit 1, for example for some condition


--------------------
HTC Desire V (Died) ->Asus me176cx(Unlocked + TWRP + ROOT) ->Asus A400CG(Died) ->TCL 5015D(sold) ->Wileyfox Spark +(ALPS 8.1.0 + TWRP + ROOT)
Dramcryx
Message#156
15.03.19, 18:53
Null pointer
********
[offline]

Group: Friendssavagemessiahzine.com
Messages 1577
Check in: 06.06.13
Xiaomi Mi 6 6/64

Reputation:-  85  +

Gentlemen, in some scripts I see a call to Linux commands via busybox
For example: busybox echo "#comment line">>/ system buid.prop
When do you need to use busybox? Can I write Linux commands (cp / mv / echo) without it?


--------------------
Z5S Mini Stock =>4.4/5.0
Xiaomi Mi6 4/64 9.5.9
Rusm
Message#157
15.03.19, 19:05
a.k.a shoma_81
*********
[offline]

Group: Honorary Gameday
Messages 10536
Check in: 17.10.11
Xiaomi Mi 4 WCDMA

Reputation:-  2757  +

* Dramcryx,
busybox is embedded in TWRP. You do not need to call it.
Dramcryx
Message#158
15.03.19, 20:18
Null pointer
********
[offline]

Group: Friendssavagemessiahzine.com
Messages 1577
Check in: 06.06.13
Xiaomi Mi 6 6/64

Reputation:-  85  +

* Rusm
When should it be used? I want to write a script for TWRP.
By the way, is sbin necessary? Can I use a simple bin (easier to simulate on the desktop)?


--------------------
Z5S Mini Stock =>4.4/5.0
Xiaomi Mi6 4/64 9.5.9
Rusm
Message#159
15.03.19, 20:24
a.k.a shoma_81
*********
[offline]

Group: Honorary Gameday
Messages 10536
Check in: 17.10.11
Xiaomi Mi 4 WCDMA

Reputation:-  2757  +

Dramcryx@15.03.19, 20:18*
When should it be used? I want to write a script for TWRP.
See examples in the topic. What are you like little, really ...
Dramcryx@15.03.19, 20:18*
Can I use a simple bin (easier to simulate on the desktop)?
If we are talking about the system, then yes. If in recovery, then sbin. There are all the bubo applets, scripts and binaries of recovery. Plus, do not forget that the different bubo implementation in terms of applets is different. Somewhere they can be neutered on some arguments, somewhere a developer could add maximum possibilities. So do not be surprised if one works correctly in the system / recovery, and the other does not.
Like so. If anything, they will correct me

Post has been editedRusm - 15.03.19, 20:35
Dramcryx
Message#160
15.03.19, 20:48
Null pointer
********
[offline]

Group: Friendssavagemessiahzine.com
Messages 1577
Check in: 06.06.13
Xiaomi Mi 6 6/64

Reputation:-  85  +

* Rusm
and in the updater-script I need to mount the sdcard, if I want to write something into it?

no need to mount i found :)

Post has been editedDramcryx - 15.03.19, 21:02


--------------------
Z5S Mini Stock =>4.4/5.0
Xiaomi Mi6 4/64 9.5.9
RomanDesigner
Message#161
29.04.19, 15:59
MT6572Oreo Team
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 356
Check in: 17.01.18
Meizu M6 Note 3/16/32

Reputation:-  25  +

When unpacking, ramdisk gives this:
zcat: invalid magic

Team:
zcat ../non-ported.img-ramdisk.gz | cpio -i

Changed zcat to:
gunzip
pigz -d

With gunzip and pigz -d:
gunzip: non-ported.img-ramdisk.gz is not compressed - skipping
pigz: non-ported.img-ramdisk.gz is not compressed - skipping

I learned this with the help of adb shell ...
Just the output of the commands of the script is not done :(

To unpack the boot, I use: unpackbootimg from 2 posts threads.
I tried WinRAR: everything works, the archive is ramdisk.cpio

What to do?
Android 7.1.2

By the way, the purpose of the script: autoport for MT6572)


--------------------
MT6572Oreo Team
Progress: 70% Objective: Android 8.0.0 on MT6572

9 pagesV  « < 6 7 8 9 > » 


 mobile version    Now: 05/20/19, 06:56