View Single Post
Old 04-30-2007, 01:34 PM   #45
Antartica
Evangelist
Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.
 
Antartica's Avatar
 
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
Quote:
Originally Posted by Adam B.
But perhaps a chrooted sandbox may be a better idea. It does seem like an awful lot of work though... Maybe something simpler? /mnt/settings remains unchanged throughout an upgrade right? Why not put the symlinks there?
I'm unconvinced because of the convoluted of the solution. But it's not a lot of work, on the contrary, the script is rather simple (untested, is just an example):

Code:
#!/bin/sh
# Prepare the sandbox
mkdir /tmp/sandbox
mount -t tmpfs - /tmp/sandbox
mkdir -p /tmp/sandbox/usr/local /tmp/sandbox/bin /tmp/sandbox/lib /tmp/sandbox/card /tmp/sandbox/free
cp /bin/ipkg /tmp/sandbox/bin
cp /usr/lib/libipkg.so.0 /lib/libgcc_s.so.1 /lib/libc.so.0 /lib/ld-uClibc.so.0 /tmp/sandbox/lib
mount --bind /media/cf/ /tmp/sandbox/card
cd /tmp/sandbox/usr/local
for i in lib bin etc var share include home; do
   ln -s /card/_local/$i .
done
ln -s /card/Programs programs
mount --bind /mnt/free/ /tmp/sandbox/free
# call ipkg
chroot /tmp/sandbox /bin/ipkg install /free/$1
# umount the sandbox
umount /tmp/sandbox/free
umount /tmp/sandbox/card
umount /tmp/sandbox
Clearly, it's not overly complicated (nor rocket science). Beware: the paths I've used have been as I recall them, and the deps of ipkg are from OpenWRT, and I expect that it will need also tar and gzip to work.

So, coding it is not the difficult part. But... is it too convoluted?

Last edited by Antartica; 04-30-2007 at 01:39 PM. Reason: little fixes on the sample script
Antartica is offline   Reply With Quote