cpio symlink trick (tar workaround) & sandbox applications

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
s243a
Posts: 501
Joined: Mon Dec 09, 2019 7:29 pm
Has thanked: 90 times
Been thanked: 37 times

cpio symlink trick (tar workaround) & sandbox applications

Post by s243a »

So say you extract Puppy Arcade and you want to run it in a sandbox. The sandbox code is in a directory given by a symlink that is located in the same directory that Puppy Arcade is extracted. The idea here is to create an archive which has both the sandbox code as while as the Puppy Arcade folder. However, the sandbox code is symlinked to a folder outside of the Puppy Arcade code. The reason to do this is that you might want to use the same sandbox code to run multiple versions of puppy in a chroot.

I have two approach here. One uses that tar command and one uses the cpio command. The tar command is commented out because it doesn't work as well.

Code: Select all

#!/bin/bash
#tar -czvf ../slacko_arcade_sandbox.tar.gz $(find -L . -name '*' | grep -v "^[.]/psandbox$" ) 
find -L . -name '*' | grep -v "^[.]/psandbox$" | cpio -o -O ../slacko_arcade_sandbox.cpio

This scipt is located in the same folder where puppy arcade is extracted. It will create an archive as described above which contains both the arcade and the sandbox code. Both the commented out line (i.e. the tar command) and the uncommented line (the cpio command work). However, the tar command is more difficult to extract because it wants to extract the psandbox symlink which points outside of the folder. Even excluding it when creating the archive doesn't stop the tar command from including this symlink when creating the archive.

If you have the full version of tar though you might be able to exclude the symlink when you extract the archive. If you do this then it might create a folder rather than a symlink to place the files within from the archive.

Post Reply

Return to “Programming”