Hello,
I have a script in TWRP
I trying to take backup of the android system all in: "/system"
into a sdcard "/external_sd/backupOSUmidigiPower"
Code:
ui_print("Start");
run_program("/sbin/busybox", "mount", "/dev/block/mmcblk0p31", "/system");
run_program("/sbin/busybox", "mkdir", "-p", "/external_sd/backupOSUmidigiPower");
run_program("/sbin/busybox", "cp", "-rp", "/system", "/external_sd/backupOSUmidigiPower/");
ui_print("Finish");
That Works very fine and take backup into sd card
But then i trying to take restore backup back to "/system"
but my question is:
1. "Why is my permission gone, see photo"
2. How can i copy all files/folder with permissions
linux cp commands:
Code:
cp
copy with recursion (-r) and (-p) preserve mode,ownership,timestamps
sudo cp -rp <sourceDir> <destDir>
And still got chmod 777 permission on all files/folders
I got bootloop before i think file permission is chmod 777
Can you help me out
Thanks for your time
I experienced that cp command always changes ownership of copied files / directories to root:root regardless of their initial ownership.
jwoegerbauer said:
I experienced that cp command always changes ownership of copied files / directories to root:root regardless of their initial ownership.
Click to expand...
Click to collapse
How can i move files and keep permission?
Moving and Copying are different things.
Don't confuse file's / directory's permissions and file's / directory's ownership: these are different things.
Related
there are some problem with my webtop when i want get full ubuntu....like this
tar: ./usr: Cannot change mode to rwxr-xr-x: Read-only file system
tar: .: Cannot utime: Read-only file system
tar: .: Cannot change ownership to uid 0, gid 0: Read-only file system
tar: .: Cannot change mode to rwxr-xr-x: Read-only file system
tar: Error exit delayed from previous errors
unmounting your sdcard from the temp mount, now that we are done copying all the
files.
Now we will mount the sdcard with webtop copied over to it, to the correct place
, so we can patch it, and remove the FACLs and MACLs. These are what prevent you
accessing application and making changes in the ubuntu install.
help me
You need to mount the system as read/write.
In adb type.
su
mount -o remount, rw
Sent from my Atrixperia using xda premium
z652366 said:
there are some problem with my webtop when i want get full ubuntu....like this
tar: ./usr: Cannot change mode to rwxr-xr-x: Read-only file system
tar: .: Cannot utime: Read-only file system
tar: .: Cannot change ownership to uid 0, gid 0: Read-only file system
tar: .: Cannot change mode to rwxr-xr-x: Read-only file system
tar: Error exit delayed from previous errors
unmounting your sdcard from the temp mount, now that we are done copying all the
files.
Now we will mount the sdcard with webtop copied over to it, to the correct place
, so we can patch it, and remove the FACLs and MACLs. These are what prevent you
accessing application and making changes in the ubuntu install.
help me
Click to expand...
Click to collapse
Hi,
I assume you are using my how-to?
I have a few questions, and need you to get me a few things as well, before I can be of more help.
1) I assume you are already rooted? Are you already rooted?
2) Do you have busybox installed? And have it in /system/bin, and not /system/xbin?
3) Did you run my script as root?
I am thinking that it is either just that you are not running this as root, or that your root install did not work.
Can you run the following commands from the command line on your computer, with your phone connected and post them back in here?
Code:
adb shell
su
cd /data/local
id
busybox df -h
ls -l
mount -o remount, rw /system
touch /system/bin/test
rm /system/bin/test
exit
exit
Post the output back in here, and we will see if there is an issue with your root access.
Each line is a single command, and you must ONLY copy one line and paste it to one command line, do NOT copy all of the commands and paste them to your command line window, it will not work.
its about making patch modpack for my rom and
making update script full...
So,Let's start...
________________________________________
________________________________________
How to make modpack or patch...
Frist make sure that what you want to add on your
rom..like i want to add my modded
systemui,framwork_res,some importent app,some
brinery like su,mkbootimg,some wallpaper,new
ringtone,boot logo,boot animation and some app
with data...
ok now i explain you somethings which are very
very important...
frist in a modpack this folders are added..like>>>
1.Meta_inf
2.data
3.sdcard
4.system...etc etc...
you will also see more folder or file but now i will
tell you about this folders ^^^...
1.Meta_inf...
i think everybody know this folder...i give a short
example...
in this folder you will found update script and
update brinary...
[Q]what is update script?
[Ans.] updater-script - it is just a text file which
contains all the commands which tells the
clockworkmod what to do with the given
zip file. the updater-script is written in the edify
scripting language.
[Q]what is update brinary?
[ans] update-binary - it is a binary which is
requiered by the clockworkmod to translate the
human readable format of the updater-
script to machine readable format for execution
of the updater-script in our device.
now i think you would understand what is update
script and brinary...
ok now 2.Data folder...in data folder you can add
some app with data...fir this what you need?!!
Frist install your app on your mobile and mod
it...like i want to add Xposed installer with
frimwere updated in my modpack...so frist i
installed the app and open it..then click on install/
update...then reboot my device...now my modding
was complete...now its time to add it with data...
.
so i made a folder on sdcard like (modpack for my
rom) then open it and made another folder name
(data) then in data folder i made two folders like
(app) and (data)
then i opened root explorer and went to root
derectory...then go to data...then go to app folder
and choosed my app thats mean xposed...then
copied it to sdcard/modpack/data/app and again
go to root derectory/data...this time i go to data
folder and find my apps data.then copy it to
sdcard/modpack/data/data...thats all...
This is an example...now you can add you app
with data like i had added...but i recommend you
that dont add more then 4 apps with data...
ok now 3.sdcard...
by this folder you can add anythings to your
sdcard...like i want to add some themes of mi
home luncher and all kernel,profile of viper 4
fx...frist made (sdcard)folder on your sdcard/
modpack...now copy all things from your sdcard
which you want to add..like i copied viper4fx
folder from my sdcard and paste it to sdcard/
modpack/sdcard...you can add themes in this way
too...just copied the themes with the whole
derctory in your sdcard/modpack/sdcard
folder...like i copied miui folder to my sdcard/
modpack/sdcard folder...beacuse all themes of
miui are in miui folder...
now comes 4.System folder.. so make a folder
(system) on your sdcard/modpack...then open
system folder and made some folder like
app,etc,lib,bin,xbin etc if you want to add
somethings on your roms system folder..i think
every body know this folder...if you want to add
your modded app,just sing it and drop it to...
Now full completed...you can see some extra
folders and files...if you want to add these to then
comment here i will told you how add these
folder...or you can pm me too
________________________________________
now its time to make update script for your
modpack..
...........
frist copy a meta_inf to your sdcard/modpack and
open update script...delect all things...
you can edit this line as your wish>>>
ui_print(“xolo – next level”);
now see what is ui print?
ui_print – This command prints the prints the
word inside the quotations
Example – ui_print(“xolo – next level”); prints
xolo next level in your cwm recovery
______________________
then you need to mount system partition...and
also another pertition like data,etc (if you want
to add anythings to this folderd)...but no need to
mount sdcard...For mount system-
mount(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “/system”);
if you want to mount data folder then write data
insted of system like-
mount(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “/data”);
okey...done mounting...
Now see what is mount?
mount – This command mounts the partition, if
you want to add files to system partition you
have to mount system partition, data for data
partition
To mount system - mount(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “/system”);
Here mmcblk0p5 is the name of system
partition for mtk 6589 chipsets (this name
varies from device to device)
To mount data - mount(“ext4″, “EMMC”, “/dev/
block/mmcblk0p7″, “/data”); (partition name
varies from device to device)
_____________________
Now formating...what is format>
format - This command formats the partition
specified
It is highly recommended to include this
command to format system and data if you are
making updater-script for ROM
To Format system - format(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “0″);(partition name
varies from device to device)
To Format data - format(“ext4″, “EMMC”, “/
dev/block/mmcblk0p7″, “0″);(partition name
varies from device to device)
NB.dont use it in your modpacks script its for
custom rom....
_______________________
Now you done mounting and its time to install all
things in all folder thats mean extracting...like
sustem folder will extract in your system
pertition...data folder will be in data pertition
and sdcard folder in your sdcard...for extract
system files use this command>>>
package_extract_file(”system“,”/system”)
for data>>> just delect system and add data like.
package_extract_file(”data“,”/data”)
for sdcard do same...
Now what is this>>>
package_extract_dir(” “, “/”) – This command
extracts all the files from the folder mentioned
inside first quotation to the partition or
directory
inside second quotation
For system - package_extract_dir(“system”, “/
system”);
(this copies all files from system folder in zip to
system partition in phone)
For data - package_extract_dir(“data”, “/
data”);
____________________
Ok now symlink...
symlink("mksh", "/system/bin/sh");
the above command creates a symlink.
okay, now let's see about symlinks,
symlink is nothing but shortcuts, for example if
a file is requiered in two different places instead
of copy pasting the file
in two different locations, the file is copied to
one of the two locations and in the other
location a shortcut to the file(symlink)
is created. the source and the symlink can have
different names (actually this is the prime use
of symlinks).
to explain in a noob friendly manner,
take the above symlink, it creates a shortcut
(symlink) for the command "mksh" and places
it in the path of the operating system.
the shortcut(symlink) directs to the file "/
system/bin/sh" , so whenever the os gets a
request to execute the "mksh" command, the
actual
binary that gets excuted will be "/system/bin/
sh" .
creating symlinks saves a lot of space because
instead of copying the whole file and placing it
in requiered places we are just
creating shortcuts which directs to the source
file which can be placed anywhere in the file
system (generally placed in the path of the os)
i think you understood...if you not then dont
use...its just use then when you want to add
somethings on system/bin folder and its for
advance user..
______________________
ok now seting permission..its not need if you
wont want anything in system/bin...but if add
then you must need add permission for this gile
and seting petmission are really too much easy
and so funny just see what is it and how to
set>>>
set_perm_recursive - This command sets
permission for folders
here android uses unix permission system
in unix
4 – read
2 – write
1 – execute
so
rwx is 4+2+1 = 7
rw is 4+2 = 6
rx is 4+1 = 5
Example - set_perm_recursive(0, 0, 0755,
0644, “/system”);
In this 0 is a user id for owner that refers to
root. It means that permission owner for
system folder. and 0 is root user means it
unrestricted access to system. it is given in
order to run programs to run properly
second 0 also refers to root. but here it refers
to group id 0
we are only seeing about folders because
“set_perm_recursive” is a command that sets
permission to folders
next 0755 it means rwxr-xr-x permission has
been given to system folder and rw-r-r is set
for all folders inside system folder
hope you understan...
___________________
Now another things...and its use in seting
permissions to but its defferent just see>>>
set_perm – This command sets permission for
a specific file
Example - set_perm(1000, 1000, 0640, “/
system/etc/bluetooth/auto_pairing.conf”);
here the 1000 refers to user id system and
0640 is rw-r—–
and this command sets the permission rw-r—–
for the file auto_pairing.conf
this is use for one files auto_praing.conf
__________________
Now you need to unmount these folder which you
mounted...see it>>>
unmount – This command unmounts the
partition
Example - unmount(“/system”); – unmounts
system...you need to unmount another folder
too..like for unmount data>>>
unmount(“/data”);
___________________
ok guys all done...i hope you understood all that i
have told...if you not then ignore it...and now try
to make a script for your modpack...
____________________
now give you a short example of my modpack and
update script...
...................
in my modpack i have these folders>>>
1.meta_inf,
2.data,
3.sdcard,
4.system,
.....now have a look in my script >>>
ui_print("====================
===============");
ui_print("Installing cayno x v2 modpack for all
cayno x users");
ui_print(" ");
ui_print(" By: MD.Shafikul main dev of cayno x ");
ui_print("====================
===============");
ui_print("");
ui_print("mounting system");
show_progress(0.500000, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/
system");
ui_print("mounting data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/
data");
show_progress(0.200000, 0);
ui_print("[ ] Installing all files");
package_extract_dir("system", "/system");
show_progress(0.200000, 0);
package_extract_dir("data", "/data");
ui_print("installing themes ");
package_extract_dir("sdcard", "/sdcard");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/
busybox");
ui_print("letast busybox installed");
run_program("/system/xbin/busybox", "--install", "-
s", "/system/xbin");
ui_print("installing abrouted!");
show_progress(0.500000, 0);
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
set_perm_recursive(0, 0, 0777, 0777, "/system/etc/
init.d");
ui_print("init.d activated!");
ui_print("jocking man... ");
show_progress(0.200000, 0);
unmount("/system");
ui_print("[*] unmount system succeced! ");
unmount("/data");
ui_print("[*] unmount dataoo succeced! ");
unmount("/sdcard");
ui_print("");
ui_print(" Thanks for downloading cayno x ");
ui_print(" Auto rebooting ");
sleep(2);
ui_print(" Please wait... ");
sleep(2);
run_program("/sbin/sleep", "5");
run_program("/sbin/reboot");
^^^^^thats all that i wrote
_______________________________________
NB.(must read)>>>1.General rule in updater-script
– all commands
should end with semi colon ; otherwise it
will show error and if cwm or twrp shows status
7 error the error is in updater-script
2.if you dont understand then ignore beacuse its
can bootlooped...
3.if felt in installing zip then pm me pr comment
here or give me your script i will try my best to
correct it...
4.if the post help you,then give me some
respect...please..
5.dont forget to click on like botton its can
inspared me to write more post...
6.if you copy these post then give me credit,if
you not then i will understood that you are a
busted...
7.and never stop customization
Credit goes to my friend Md. Shafiqul for writting this..
HIT A THANKS IF I HAVE HELPED YOU
I am trying to get my android updater-script to selectively change permissions based on filename. I want all files under a certain subdirectory following the naming pattern "A.xy" set to 0755 and all other files set to 0644
So I first set all of them to 0644, then tried to selectively set the rest to 0755 by piping commands using xargs and exec. However, neither of the following commands worked but neither of them gave an error. Does anyone have a better way of doing this, or have an idea why neither of these worked?
run_program("/sbin/busybox", "find", " /data/app", "-name", "A.xy", "-type", "f", "-print0", "|", "/sbin/busybox", "xargs", "-0", "chmod", "0644");
run_program("/sbin/busybox find /data/app -name A.xy -type f -exec chmod 0644 {} \;");
It seems like update-binary doesn't allow piping? It doesn't give an error though.
Any idea how I can set all files of one type to be one permission, and all files of another type to be a different permission?
Thread closed.
Please see the continuation of this topic here: http://forum.xda-developers.com/android/help/edify-question-how-to-pipe-t3509804
Thanks!
I am trying to get my android updater-script to selectively change permissions based on filename. I want all files under a certain subdirectory following the naming pattern "A.xy" set to 0755 and all other files set to 0644
So I first set all of them to 0644, then tried to selectively set the rest to 0755 by piping commands using xargs and exec. However, neither of the following commands worked but neither of them gave an error. Does anyone have a better way of doing this, or have an idea why neither of these worked?
run_program("/sbin/busybox", "find", " /data/app", "-name", "A.xy", "-type", "f", "-print0", "|", "/sbin/busybox", "xargs", "-0", "chmod", "0644");
run_program("/sbin/busybox find /data/app -name A.xy -type f -exec chmod 0644 {} \;");
It seems like update-binary doesn't allow piping? It doesn't give an error though.
Any idea how I can set all files of one type to be one permission, and all files of another type to be a different permission?
Thread closed.
Please see the continuation of this topic here: http://forum.xda-developers.com/android/help/edify-question-how-to-pipe-t3509804
Thanks!
I am trying to get my android updater-script to selectively change permissions based on filename. I want all files under a certain subdirectory following the naming pattern "A.xy" set to 0755 and all other files set to 0644
So I first set all of them to 0644, then tried to selectively set the rest to 0755 by piping commands using xargs and exec. However, neither of the following commands worked but neither of them gave an error. Does anyone have a better way of doing this, or have an idea why neither of these worked?
run_program("/sbin/busybox", "find", " /data/app", "-name", "A.xy", "-type", "f", "-print0", "|", "/sbin/busybox", "xargs", "-0", "chmod", "0644");
run_program("/sbin/busybox find /data/app -name A.xy -type f -exec chmod 0644 {} \;");
It seems like update-binary doesn't allow piping? It doesn't give an error though.
Any idea how I can set all files of one type to be one permission, and all files of another type to be a different permission?
Thread closed.
Please see the continuation of this topic here: http://forum.xda-developers.com/android/help/edify-question-how-to-pipe-t3509804
Thanks!