Snake OS has basic support for installing Opkg packages. This makes it possible to easily and safely add new programs to the system.
Note: Package support is still fairly early and subject to changes. Suggestions and critique welcome.
To enable the Opkg service, navigate to Services -> Opkg in the web interface, check the "Enable opkg" box and select the disk that will hold the package data. Packages will be installed to the .optware directory on the specified disk.
Save your config to make the changes persistent.
To install a package download its .opk file and upload it from System -> Opkg. It may be necesary to reboot the system to afterwards.
Warning: Packages have to be specifially built for Snake OS. Installing packages for other systems can break things!
Uninstall packages from System -> Opkg.
Reseting the Snake OS config will disable any Opkg services.
To get rid of all packages delete the .optware directory on the Opkg disk.
The opk format is based on the one used by Debian. It's an "ar" archive containing:
Here you have a bunch of scripts and control information. Check http://inportb.com/2010/10/19/making-an-opkg-package/ to understand how it works. Control.tar.gz must have all scripts and files on its root, which means that, when extracting it, no other folders should be created (all files must be extract to the current folder). It must have inside of it a file called "control" with this information (just an example):
Package: dnsmasq
Version: 2.59
Description: Dnsmasq is a lightweight, easy to configure DNS forwarder and
DHCP server.
Section: snakeos/applications
Priority: optional
Maintainer:
Architecture: all
Homepage: http://thekelleys.org.uk/dnsmasq/doc.html
Source:
Depends:
Mainly this is all files as if they were in /. For example, if something should be put in /etc/ (in a normal environment), you should create a folder called etc/ and put your file inside of it. Binaries should be put inside a bin/ folder. The result could be something like this:
bin/dnsmasq
etc/dnsmasq.conf
etc/init.d/dnsmasq
All files will be inside /opt/ after they're loaded into SnakeOS. If you need to, for example reference some configuration file, you must use /opt/etc/file.conf.
Packages can have scripts in certain directories to better integrate into SnakeOS.
When a menu entry is clicked opkg-config-service.cgi is run with the name of the script as parameter. Like this: http://192.168.0.240/cgi-bin/opkg-config-service.cgi?page=dnsmasq
Forms in a service script must pass the script name to the action parameter. For example for dnsmasq that that would be:
<form id="dnsmasq" name="dnsmasq" action="<%= ${SCRIPT_NAME} %>?page=dnsmasq" method="POST">
A simple file with "2.0" inside of it.
Assuming that you already have all the necessary files, you can use the following Makefile to help you creating the package.
DATADIR=_data
CONTROLDIR=_control
PKGNAME=dnsmasq-2.59.opk
all: clean package
clean:
@echo " CLEAN"
@rm -rf data.tar.gz control.tar.gz "$(PKGNAME)"
package: data control
@echo " AR $(PKGNAME)"
@ar -r "$(PKGNAME)" debian-binary control.tar.gz data.tar.gz
data: $(DATADIR)
@echo " TAR data.tar.gz"
@tar -czf data.tar.gz -C $(DATADIR) .
control: $(CONTROLDIR)
@echo " TAR control.tar.gz"
@tar -czf control.tar.gz -C $(CONTROLDIR) .
On top of it you have some setup to do:
So, after you put everything you need inside the correct folders and changed the variables in the Makefile, you can just type "make" and it'll do the entire job for you. The result will be a simple .opk file which you can upload to your NAS in the end.
---
Thanks to Ricardo Gomes da Silva for expanding the initial howto.
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: bb.bobb...@gmail.com
Thanks, this is a great way to install and update individual packages! Will try it out when I get the chance.
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: oscar.ca...@gmail.com
So ¿Will every-service be a package from now on?
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: stefansc...@googlemail.com
I think the plan is to move samba into a package aswell because newer versions won't fit into the flash. Beyond that I don't know.
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: bb.bobb...@gmail.com
The package manager seems to crash on larger packages (>10MB) that I try to install, any reasons for this?
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: stefansc...@googlemail.com
The upload limit for the packages script is set to 10mb. I didn't know if the whole file will be stored in memory at some point so I went for a safe sounding value.
I wasn't expecting that packages would get anywhere near that..
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: arionkra...@gmail.com
"Warning: Packages have to be specifially built for Snake OS. Installing packages for other systems can break things!"
How can I build a package specifically for Snake OS? Is there any tutorial or manual? Anything?
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: stefansc...@googlemail.com
It's mostly about filesystem layout. Lining things up a little more with how the nslu2/optware people do it would have save saved some headaches. I was plannign ot do that at some point but it would break all existing packages...
There's some info under "Package Creation" on the page. You compile your binaries with the toolchain and then put them and a control file into an archive.
You can use the packaging tree in the svn repo as a starting point. http://code.google.com/p/snake-os/source/browse/#svn%2Fpackages The build of most packages in the download section is automated using those Makefiles.
Last edit: Anonymous 2017-05-19