I'm working on something in a Makefile that will look something like this:
tarball: mkdir -p tmp/tarball/etc/service mkdir -p tmp/tarball/usr/local mkdir -p tmp/tarball/opt/myproject cd sensordatad; make cd sensortunneld; make device_name cp -r sensorservices tmp/tarball/etc/service # Make a tarball here, something like: # chroot tmp/tarball; tar -czvf myproject.tar.gz .
The idea is that I'll be able to move into the
./tmp/tarball directory, and create a tarball which when unpacked on a system will unpack itself to
/usr/local and to
The classical approach seems to be to use
tar -czvf -C tmp/tarball . but this leads to a tar listing of entries that start with
I'm inspired by the package from the Go language, which indicates that it should be installed with:
tar -C /usr/local -xzf go1.0.3.linux-amd64.tar.gz
Which would be ideal for my use-case, I'd like to be able to do:
tar -C / -xzf myproject.tar.gx
Which would in turn extract the files originally in
/_____, meaning that I could simply fake the installation structure.
Of course this might better be achieved with something like
fpm, which I haven't ruled out, but I'm not keen on heavy weight solutions, and I assumed that I'd be able to do this without resorting to Ruby.
I've stumbled upon
fakechroot, which seems promising, but not surprisingly, tar doesn't exist in the chroot, and when I started going down that rabbit hole I just assumed I was doing something wrong and should ask for assistance.