Page 2 of 4
cleanup script copy update
Posted: 26 Oct 2017, 02:59
by abelM
Hi Ed,
I see -- but the question is ¿Does Porteus keep changes between sessions if you use `cp -ufa' in /mnt/live/cleanup?
Please look at this:
Code: Select all
guest@porteus:/$ which cp
/usr/bin/cp
guest@porteus:/$ ls -l /usr/bin/cp
lrwxrwxrwx 1 root root 12 Dec 19 2016 /usr/bin/cp -> ../../bin/cp*
guest@porteus:/$ file /bin/cp
/bin/cp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped
OK this is the binary we use from the command line which accepts the `-u' flag.
I think cleanup uses this one instead:
Code: Select all
guest@porteus:/$ ls -l /mnt/live/bin/cp
lrwxrwxrwx 1 root root 7 Oct 25 23:11 /mnt/live/bin/cp -> busybox*
Here `cp' is a symlink to `busybox' and as version 1.21.1 it does not accept the `-u' flag. It simply gives an error message and does nothing.
Why there are no error messages from cleanup? Just because it sends them to the null device.
Code: Select all
cp -uaf --parents $FOLDERS $MNAME 2>/dev/null
Maybe it doesn't work because it's an old version of busybox. I hope it will be updated. A fixed CHANGES would be much more efficient I think.
Regards!
cleanup script copy update
Posted: 26 Oct 2017, 03:36
by Ed_P
Wow! There are TWO cp commands. I hadn't pick up on the point that the one in initrd.xz was different than the one bash normally uses.
Code: Select all
guest@porteus:~$ /mnt/live/bin/cp -afu Savedat /tmp/test
/mnt/live/bin/cp: invalid option -- u
guest@porteus:~$
Yup.
Thanks for clearing this up
abelM
cleanup script copy update
Posted: 26 Oct 2017, 12:41
by abelM
Hi Ed! Changes are saved in the same session, right? Excuse me I insist on this: Are changes saved
between sessions as you apply `cp -uaf' to your /tmp/live/cleanup file?
cleanup script copy update
Posted: 26 Oct 2017, 13:07
by ncmprhnsbl
abelM wrote: ↑26 Oct 2017, 02:59
it doesn't work because it's an old version of busybox. I hope it will be updated.
looking at
https://www.busybox.net/
cp: add -u/--update and --remove-destination was added in version 1.25 ... latest stable is 1.27.2
might be time for an update...?
cleanup script copy update
Posted: 26 Oct 2017, 15:39
by Ed_P
abelM wrote: ↑26 Oct 2017, 12:41
Hi Ed! Changes are saved in the same session, right? Excuse me I insist on this: Are changes saved
between sessions as you apply `cp -uaf' to your /tmp/live/cleanup file?
I suspect they would be since doing that doesn't involve the cleanup script but I use changes=EXIT so I don't know for sure.
cleanup script copy update
Posted: 26 Oct 2017, 23:40
by brokenman
Indeed, the cp run from linuxrc during shutdown is compiled into busybox which doesn't support the -u argument. I'll look at updating busybox. Thanks, I initially didn't pick up the error.
cleanup script copy update
Posted: 27 Oct 2017, 00:45
by Ed_P
brokenman wrote: ↑26 Oct 2017, 23:40
I'll look at updating busybox. Thanks
Excellent!!
A win all around.
cleanup script copy update
Posted: 29 Oct 2017, 22:24
by abelM
Hi guys! I've deleted my two last posts because I think they were not really useful.
Regards,
cleanup script copy update
Posted: 29 Oct 2017, 23:16
by Ed_P
I thought your pointing out what file was being updated with changes was useful.
cleanup script copy update
Posted: 30 Oct 2017, 22:15
by brokenman
Actually, posting in this thread to say you deleted two other (mystery) posts is not really useful. It does, however, get your post count up there.
cleanup script copy update
Posted: 31 Oct 2017, 18:23
by abelM
Hi brokenman! Thanks for your comment. I'll take into account.
Regards
cleanup script copy update
Posted: 01 Nov 2017, 14:02
by abelM
Hi all,
I've found another way of doing the job by now. You need to edit two files as root:
Code: Select all
# /opt/porteus-scripts/dump-session
# Merge changes with 'changes=EXIT' destination:
cp -uaf $FOLDERS $MNAME
The
cp command lives in 001-core.xzm -different from the present version of busybox- so the
-u flag does work. I've deleted
2>/dev/null so I can see now error messages.
Code: Select all
# /etc/rc.d/rc.local_shutdown
dump-session && rm -f /mnt/live/tmp/changes-exit
This updates files at shutdown and prevents
cleanup script from running the exit stuff.
Ed's solution and this other one are interesting tips to know I think -- although next Porteus update will do it better.
Regards,
cleanup script copy update
Posted: 02 Nov 2017, 18:48
by jssouza
Busybox on porteus arm is already on v1.25.0. Added the change in my porteus arm tree. Thanks.
cleanup script copy update
Posted: 06 Nov 2017, 15:23
by brokenman
Thanks abelM,
I've finished updating busybox to the latest version so your edits should now work in initrd.xz. Nice fix.
cleanup script copy update
Posted: 06 Nov 2017, 15:51
by Ed_P
brokenman wrote: ↑06 Nov 2017, 15:23
I've finished updating busybox to the latest version
Is there a download for that or a new ISO?