A sanity check to stop you accidentally installing packages to the wrong filesystem.

Robert Bragg bob at o-hand.com
Thu May 22 13:24:54 CEST 2008

On Thu, 2008-05-22 at 10:54 +0100, Thomas Wood wrote:
> On Wed, 2008-05-21 at 18:40 +0100, Robert Bragg wrote:
> > Hi,
> > 
> > I'm currently using opkg-cl to directly install packages to a
> > development filesystem that is exported from the same machine via NFS. I
> > specifically don't want to depend on the device being booted to install
> > packages.
> > 
> > As you can guess, this requires some amount of evil since opkg-cl must
> > be run as root to do this. (I know I'm evil, so please no need to
> > explain the potential woes of running as root :-) )
> I don't think opkg-cl itself has any requirements that it must be run as
> root, it should work perfectly well as a normal user.
Sure, the problem is only that the filesystem itself needs root
permissions to modify, unless I do something like chmod a+w -R etc,
which I guess I might get away with, but I think I'd prefer not to
require sweeping changes like that to the filesystems.

> > 
> > To give me _some_ sense of confidence though that I _probably_ wont
> > accidentally trash my development machine when passing the wrong -o path
> > I have added a local sanity check to my opkg that will verify that an
> > opkg_dir already exists on the target filesystem instead of
> > automatically trying to create it for me.
> I often use alias opkg='opkg-cl -o /foo' to help with this :-)
Sure this would give some security too.

I personally tend to use shell variables to point to my current fs
($PLATFORM_FS) and I sometimes switch between a number of filesystems
quite a bit e.g. I have 3 i'm interested in using at times with my
current platform, 1) poky trunk, 2) pre-built poky, 3) a generic
arm.com/arm_embedded filesystem. I'd add risk if I were to setup such an
alias using the $PLATFORM_FS variable, in case it effectively came out
as '/', or '////' due to a broken script, so I'd have to manage the
alias in a more carefully specified way - though I could do that if
really needs be.

I guess I just mean, I'd be a bit happier with a more hard coded
failsafe so mistakes in my shell scripts are less likely to bite me, but
this a good suggestion too.

> > 
> > Since it seems like a fairly sensible failsafe safe check, I'm posting
> > the tweak here to see if anyone would object to something similar being
> > committed?
> > 
> > A noticeable affect this change would have is when creating new
> > filesystems built of ipks. It becomes your responsibility to ensure this
> > directory exists first, though I think it should be simple enough to
> > handle that.
> Richard Purdie informs me that this shouldn't be a problem, so unless
> anyone has any other comments, I'll commit the patch.
Thanks Thomas.

kind regards,
- Robert

More information about the opkg-devel mailing list