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#1 by abelM » 22 Oct 2017, 13:00

Hi guys!

I'm using Porteus 3.2.2 on a laptop with sdcard storage and I've added `changes=EXIT:porteussave.dat' to the command line in order to decrease writes as possible. I see `cleanup' script copies the whole content from folders in the live directory to persistent media applying a `cp -af --parents' statement. I wonder if `cp -afu --parents' could be a better choice. The cp command with the `-u' option just updates files so writes would be less yet. What do you think?

Greetings,

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#2 by brokenman » 22 Oct 2017, 20:36

Thanks abelM. I've updated the cleanup script with your suggestion.
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#3 by Ed_P » 22 Oct 2017, 21:22

:thumbsup:
Ed

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#4 by Ed_P » 22 Oct 2017, 23:04

BTW Where is this script located guys? I'd like to make the change in my 3.2.2 system.
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#5 by abelM » 23 Oct 2017, 21:16

Hello brokenman. Thank you for your quick answer!
Regards,

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#6 by brokenman » 23 Oct 2017, 23:47

The script is located inside initrd.xz. It's called cleanup.
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#7 by Ed_P » 24 Oct 2017, 00:36

Thank you brokenman. :beer: I think I will wait for the fix in the next release. :happy62:

But I may look into this initrd.xz file now though. :) Never done that before.
Ed

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#8 by Ed_P » 24 Oct 2017, 03:50

Interesting. :o Cleanup is in my /mnt/live folder!! So I can update it without rebuilding the ISO. :Yahoo!:
Ed

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#9 by Ed_P » 24 Oct 2017, 05:43

Thanks brokenman. :happy62: changes=EXIT shutdowns are considerably faster now. :thumbsup:
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#10 by abelM » 24 Oct 2017, 22:48

Hello brokenman,

Something's going wrong with the new cleanup script for I can't save changes now. I'm sorry I don't understand which is the problem but it was working before. Maybe something with the aufs but I'm not sure. I've moved back to the original script for now. I suggest you to keep the original version in you tree too.

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#11 by abelM » 25 Oct 2017, 13:27

Hi guys,

I see the EXIT code is working for you with the new cleanup script. Are your files being really saved between sessions? If so the good news is you make much less writes to flash drives and you logout really faster. :D The bad news is I've messed up myself playing around with different persistent devices. :mega_shok: Please tell me!!!

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#12 by abelM » 25 Oct 2017, 13:30

Hi brokenman,
I'd like to know what you think about this stuff. 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#13 by Ed_P » 25 Oct 2017, 20:45

:shock: Wow!! I'm glad one of us checked that aspect of the change. :oops:

You are correct abelM. :happy62:

Because I ISO boot Porteus the cleanup script in my /mnt/live/ folder is fresh with each boot so I made a script to edit it like you directed that I run before shutting down.

cleanup.sh

Code: Select all

#!/bin/sh
echo guest | sudo -S sed -i 's/cp -af /cp -afu /' /mnt/live/cleanup
echo
It works and the access rights of the cleanup file do not change.

Code: Select all

guest@porteus:~$ ls -l /mnt/live/cleanup
-rwxr-xr-x 1 root root 4048 Apr 15  2016 /mnt/live/cleanup*
guest@porteus:~$ ./cleanup.sh
Password: 
guest@porteus:~$ ls -l /mnt/live/cleanup
-rwxr-xr-x 1 root root 4049 Oct 25 16:17 /mnt/live/cleanup*
guest@porteus:~$
Very strange that your cleanup change results in changes not being saved. And no error msg to indicate that or why. :%)
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#14 by abelM » 25 Oct 2017, 22:09

Thank you Ed! If I'm right cleanup uses cp from /mnt/live/bin/cp --really busybox v1.21.1-- and it seems the -u flag doesn't work. But I must investigate a bit more. I'll also try your way to see what goes on here. :teehee:

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#15 by Ed_P » 25 Oct 2017, 23:49

Well, no error msg when using the u.

Code: Select all

guest@porteus:~$ mkdir /tmp/test ; cp -afu Savedat /tmp/test 
guest@porteus:~$ ls /tmp/test/
Savedat/
guest@porteus:~$ 
guest@porteus:~$ ls /tmp/test/Savedat/
Rebuild.sh*   colors.rc     recover.sh         savedat.sh*      spaceused.sh*
bluebkgrd.rc  greentxt.rc*  redtxt.rc          savedat2xzm.sh*
bluetxt.rc    msgbox.sh*    removewhfiles.sh*  spaceck.sh*
guest@porteus:~$ cp -afu Savedat /tmp/test 
guest@porteus:~$ ls /tmp/test/Savedat/
Rebuild.sh*   colors.rc     recover.sh         savedat.sh*      spaceused.sh*
bluebkgrd.rc  greentxt.rc*  redtxt.rc          savedat2xzm.sh*
bluetxt.rc    msgbox.sh*    removewhfiles.sh*  spaceck.sh*
guest@porteus:~$ 
:unknown:
Ed

Post Reply