[ale] Tar with links
Chris Fowler
cfowler at outpostsentinel.com
Wed Sep 28 11:08:10 EDT 2016
> From: "Jim Kinney" <jim.kinney at gmail.com>
> To: "Atlanta Linux Enthusiasts - Yes! We run Linux!" <ale at ale.org>
> Sent: Tuesday, September 27, 2016 9:24:00 PM
> Subject: Re: [ale] Tar with links
> Nice work Chris!
I may need to do some conversion in /etc because I don't think I could or should modify some of the programs (like shadow)
I'm guessing that useradd uses 'cp -a'.
In my post install of profile, /etc/skel/*, etc
cat > ${DESTDIR}/.stow-post-install << "EOF"
#!/bin/sh
id -u lfs 2>/dev/null 1>/dev/null \
|| (groupadd lfs &&
useradd -m -c 'LFS User' \
-g lfs \
-p 'lfs' \
-s /bin/sh \
lfs)
EOF
Stuff
When ran I see this:
root:/tools/scripts/8# ls -la /home/lfs/
total 20
drwxr-xr-x 2 lfs lfs 4096 Sep 28 14:52 .
drwxr-xr-x 3 root root 4096 Sep 28 14:52 ..
lrwxrwxrwx 1 lfs lfs 62 Sep 28 14:45 .bash_logout -> ../../usr/pkg/blfs-shellstartup-7.10.000/etc/skel/.bash_logout
lrwxrwxrwx 1 lfs lfs 63 Sep 28 14:45 .bash_profile -> ../../usr/pkg/blfs-shellstartup-7.10.000/etc/skel/.bash_profile
lrwxrwxrwx 1 lfs lfs 57 Sep 28 14:45 .bashrc -> ../../usr/pkg/blfs-shellstartup-7.10.000/etc/skel/.bashrc
lrwxrwxrwx 1 lfs lfs 60 Sep 28 14:45 .dircolors -> ../../usr/pkg/blfs-shellstartup-7.10.000/etc/skel/.dircolors
root:/tools/scripts/8#
I'm thinking of something like this to convert the link to real. Instead of converting /home/*/.* I'll just convert /etc/skel in stow-post-install
http://superuser.com/questions/303559/replace-symbolic-links-with-files
#!/bin/sh
set - e for link ; do test - h "$link" || continue dir = $ ( dirname "$link" ) reltarget = $ ( readlink "$link" ) case $reltarget in /*) abstarget = $reltarget ;; *) abstarget = $dir / $reltarget ;; esac rm - fv "$link" cp - afv "$abstarget" "$link" || { # on failure, restore the symlink rm - rfv "$link" ln - sfv "$reltarget" "$link" } done
> On Sep 27, 2016 7:13 PM, "Chris Fowler" < cfowler at outpostsentinel.com > wrote:
>>> From: "Jim Kinney" < jim.kinney at gmail.com >
>>> To: "Atlanta Linux Enthusiasts" < ale at ale.org >
>>> Sent: Tuesday, September 27, 2016 6:25:14 PM
>>> Subject: Re: [ale] Tar with links
>>> Hmm. Cool hack. I thought cp -a was OK with full path links.
>> The problem is that cp is being told to archive /lib/udev, but there are links
>> in there that point to ../../usr/pkg........
>> The hack is on the idea of I really want /lib/udev to be copied to another / and
>> everything that exists outside of /lib/udev as links in /lib/udev should be
>> considered part of what I need.
>> Where the GNU stow idea breaks is when scripts use '-f' test. Almost no file
>> exists outside of /usr/pkg/* I've taken GNU Stow far past its intention. If you
>> look at the script in the mkinitramfs link you will see many '-f'. I've changed
>> some of those. The kernel module 'find ... -f' works because I told stow to not
>> fold that package. /lib/modules/4.7.2 is a link that points into /usr/pkg/.....
>> In simple terms 'no-folding' means that stow creates real directories when
>> needed. The opposite is that it will stop recursion in the tree and just
>> symlink the directory instead. So, with folding turned off /lib/modules/4.7.2
>> is a link. With folding turned on it is a directory.
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20160928/c1fb01ec/attachment.html>
More information about the Ale
mailing list