cleanup script copy update

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

cleanup script copy update

Post#16 by abelM » 26 Oct 2017, 02:59

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!

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

cleanup script copy update

Post#17 by Ed_P » 26 Oct 2017, 03:36

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
Ed

User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

cleanup script copy update

Post#18 by abelM » 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? :%)

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

cleanup script copy update

Post#19 by ncmprhnsbl » 26 Oct 2017, 13:07

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...?
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

cleanup script copy update

Post#20 by Ed_P » 26 Oct 2017, 15:39

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. :unknown:
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

cleanup script copy update

Post#21 by brokenman » 26 Oct 2017, 23:40

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

cleanup script copy update

Post#22 by Ed_P » 27 Oct 2017, 00:45

brokenman wrote:
26 Oct 2017, 23:40
I'll look at updating busybox. Thanks
Excellent!! :Yahoo!: A win all around. :celebrate3:
Ed

User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

cleanup script copy update

Post#23 by abelM » 29 Oct 2017, 22:24

Hi guys! I've deleted my two last posts because I think they were not really useful.

Regards,

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

cleanup script copy update

Post#24 by Ed_P » 29 Oct 2017, 23:16

I thought your pointing out what file was being updated with changes was useful.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

cleanup script copy update

Post#25 by brokenman » 30 Oct 2017, 22:15

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. :evil:
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

cleanup script copy update

Post#26 by abelM » 31 Oct 2017, 18:23

Hi brokenman! Thanks for your comment. I'll take into account.
Regards

User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

cleanup script copy update

Post#27 by abelM » 01 Nov 2017, 14:02

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,

jssouza
Legendary
Legendary
Posts: 1165
Joined: 09 Jul 2015, 14:17
Distribution: Porteus x86 arm

cleanup script copy update

Post#28 by jssouza » 02 Nov 2017, 18:48

Busybox on porteus arm is already on v1.25.0. Added the change in my porteus arm tree. Thanks.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

cleanup script copy update

Post#29 by brokenman » 06 Nov 2017, 15:23

Thanks abelM,

I've finished updating busybox to the latest version so your edits should now work in initrd.xz. Nice fix.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

cleanup script copy update

Post#30 by Ed_P » 06 Nov 2017, 15:51

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?
Ed

Post Reply