LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-09-2022, 08:54 AM   #1
opty
Member
 
Registered: Mar 2021
Posts: 183

Rep: Reputation: Disabled
pkgtools' directories migration results in unnecessary metadata loss


In pkgtools' doinst.sh, why do we use

Code:
mkdir -p var/lib/pkgtools/$directory
mv var/log/$directory/* var/lib/pkgtools/$directory 2> /dev/null
rm -rf var/log/$directory
which results in unnecessary metadata loss (at least directory's birth and its files ctime), instead of just

Code:
mv var/log/$directory/ var/log/pkgtools/ 2> /dev/null
?

If I migrated "manually" before the pkgtools upgrade (14.2 to 15.0), would it work?
 
Old 05-09-2022, 10:20 AM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657
Quote:
Originally Posted by opty View Post
which results in unnecessary metadata loss (at least directory's birth and its files ctime)
This doesn't cause the loss of the package or scripts logs ctime.

The directories were already created in the SlackBuild and are part of the package when you install it. The code to create /var/lib/pkgtools/{packages,scripts} in the doinst.sh is redundant.

Code:
mkdir -p $PKG/var/lib/pkgtools/{packages,scripts,douninst.sh}
 
Old 05-10-2022, 01:42 AM   #3
opty
Member
 
Registered: Mar 2021
Posts: 183

Original Poster
Rep: Reputation: Disabled
It does:

Code:
opty@kiwi:~/tmp$ mkdir -pv dir1/ && touch dir1/file && stat dir1/file && mkdir -pv dir2/ && echo sleep 10 && sleep 10 && mv -v dir1/file dir2/ && stat dir2/file
mkdir: created directory 'dir1/'
  File: dir1/file
  Size: 0               Blocks: 1          IO Block: 131072 regular empty file
Device: c000a1h/12583073d       Inode: 998066      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    opty)   Gid: ( 1001/    opty)
Access: 2022-05-10 08:34:55.912716481 +0200
Modify: 2022-05-10 08:34:55.912716481 +0200
Change: 2022-05-10 08:34:55.912716481 +0200
 Birth: 2022-05-10 08:34:55.911716454 +0200
mkdir: created directory 'dir2/'
sleep 10
renamed 'dir1/file' -> 'dir2/file'
  File: dir2/file
  Size: 0               Blocks: 1          IO Block: 131072 regular empty file
Device: c000a1h/12583073d       Inode: 998066      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    opty)   Gid: ( 1001/    opty)
Access: 2022-05-10 08:34:55.912716481 +0200
Modify: 2022-05-10 08:34:55.912716481 +0200
Change: 2022-05-10 08:35:05.921984544 +0200
 Birth: 2022-05-10 08:34:55.911716454 +0200
 
Old 05-10-2022, 08:52 AM   #4
opty
Member
 
Registered: Mar 2021
Posts: 183

Original Poster
Rep: Reputation: Disabled
I created a script which basically

Code:
mkdir -p /var/log/pkgtools/
for directory in removed_{packages,scripts}; do
    mv /var/log/$directory/ /var/log/pkgtools/
    
    (cd /var/log/; ln -s pkgtools/$directory/ .)
done

mkdir -p /var/lib/pkgtools/
for directory in packages scripts setup; do
    mv /var/log/$directory/ /var/lib/pkgtools/
    
    (cd /var/log/; ln -s ../lib/pkgtools/$directory/ .)
done
That should end up with a migration according to my liking.

Last edited by opty; 05-11-2022 at 08:21 AM. Reason: Incomplete and possibly dangerous code fixed.
 
Old 05-10-2022, 10:28 AM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657
Quote:
Originally Posted by opty View Post
It does:

Code:
opty@kiwi:~/tmp$ mkdir -pv dir1/ && touch dir1/file && stat dir1/file && mkdir -pv dir2/ && echo sleep 10 && sleep 10 && mv -v dir1/file dir2/ && stat dir2/file
mkdir: created directory 'dir1/'
  File: dir1/file
  Size: 0               Blocks: 1          IO Block: 131072 regular empty file
Device: c000a1h/12583073d       Inode: 998066      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    opty)   Gid: ( 1001/    opty)
Access: 2022-05-10 08:34:55.912716481 +0200
Modify: 2022-05-10 08:34:55.912716481 +0200
Change: 2022-05-10 08:34:55.912716481 +0200
 Birth: 2022-05-10 08:34:55.911716454 +0200
mkdir: created directory 'dir2/'
sleep 10
renamed 'dir1/file' -> 'dir2/file'
  File: dir2/file
  Size: 0               Blocks: 1          IO Block: 131072 regular empty file
Device: c000a1h/12583073d       Inode: 998066      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    opty)   Gid: ( 1001/    opty)
Access: 2022-05-10 08:34:55.912716481 +0200
Modify: 2022-05-10 08:34:55.912716481 +0200
Change: 2022-05-10 08:35:05.921984544 +0200
 Birth: 2022-05-10 08:34:55.911716454 +0200
Oops, I thought ctime was creation time, not change time.

However, since -current leading up to 15.0 had several mass rebuilds, every official package file in the package database will be new. And you really should be rebuilding any 3rd-party packages since 15.0's system libraries had many, many updates over its almost 6 year development. I'm not seeing an issue with how the database migration was handled.

Either way, 15.0 has been finalized and ISOs created, so it's a little late to try and get it changed.
 
Old 05-11-2022, 02:15 AM   #6
opty
Member
 
Registered: Mar 2021
Posts: 183

Original Poster
Rep: Reputation: Disabled
Right, it affects mainly /var/log/removed_{packages,scripts}/ but the principle remains the same.

Better late than never as it may still help someone and I can still do it my way. :-)
 
2 members found this post helpful.
Old 05-11-2022, 02:37 AM   #7
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,994

Rep: Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565
Quote:
Originally Posted by opty View Post
I can still do it my way. :-)
The beauty of Slackware!
 
2 members found this post helpful.
Old 05-12-2022, 04:34 AM   #8
opty
Member
 
Registered: Mar 2021
Posts: 183

Original Poster
Rep: Reputation: Disabled
"Manual" migration and pkgtools upgrade (14.2 to 15.0) successful! \o/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Curious: pkgtools Directories and SymlLnks with pkgtools-15.0-noarch-20.txz on Thu Jun 21 22:58:42 UTC 2018 kjhambrick Slackware 4 06-23-2018 01:16 AM
Current's pkgtools directories move burdi01 Slackware 20 06-22-2018 08:50 AM
Image viewer that supports editing metadata and sorting/viewing by metadata? ahc_fan Linux - Software 1 12-02-2015 11:08 AM
Loss Of Network Connection After Power Loss etpoole60 Linux - Virtualization and Cloud 2 10-27-2014 03:14 PM
Network Connection Loss And USB Connection Loss. Novatian Linux - Desktop 1 11-07-2008 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration