My aim was to "remaster" (e.g. customize and modify) a MetaROUTER image *before* installing it on a Mikrotik device. This allows deployment of a standardized image and hopefully saves the labor of having to manually customize each instance *after* installing it. It also makes it more practical to really strip down a distribution so that it uses less RAM.
This was all done using a x86 Ubuntu-based Linux PC distribution; your mileage may vary.
What was essential was the "archivemount" package that allows mounting of tarballs. (I originally tried using tar directly to modify the tarball, but RouterOS always complained "Couldn't continue - import failed: could not extract: archive is too short (6)".)
The following suggested steps also assume that /mnt is unused on the Linux PC; if not, you need to replace /mnt with a mount location that is more suitable for you.
archivemount is installed so:
Code: Select all
sudo apt-get install archivemount
http://wiki.mikrotik.com/wiki/Metaroute ... al_machine
http://www.mikrotik.com/download/metaro ... rootfs.tgz
and then make a copy of that file for testing:
Code: Select all
cp openwrt-mr-mips-rootfs.tgz otest.tgz
Code: Select all
sudo archivemount otest.tgz /mnt -o allow_other
Then change current directory to be at the base of the tarball file image:
Code: Select all
cd /mnt
Code: Select all
sudo umount /mnt
I *think* there is the potential to use the "opkg" package manager to remove and add packages. I tried compiling the opkg source code and using command-line options like "--add-arch mr-mips:20" and "--offline-root /mnt", but could not get it to do anything useful. Perhaps someone else will figure out the necessary procedure and add this to the thread.
There is a brute-force method of removing an opkg package, but only do this if you are comfortable with what the following does. The example here is removing "dnsmasq":
Code: Select all
cd /mnt
cat ./usr/lib/opkg/info/dnsmasq.list | sed 's/.*/.&/' | xargs rm