If you've ever wanted to do something differently depending on the /etc/os-release but weren't in the mood of installing every common distribution under the sun, look no further. I give you the /etc/os-release zoo project.
A project like this is never complete so please feel free to contribute additional distribution bits there.
Wednesday, June 1, 2016
I just wanted to quickly give public thanks to Thibran who quickly fixed bug 1587445. This bug was opened less than 24 hours ago. Thibran forked the code, followed our hacking instructions, proposed the fix on github, talked to us on IRC (#snappy) and got his contribution merged.
Thank you Thibran
This is how free software is made!
Making your first contribution to snapd is quite easy but if you are not familiar with how go projects are structured it may be non-obvious where the code is or why your forked branch is not being used. Let's see how to do this step by step:
- Fork the project on github. You will need a github account.
- Set the GOPATH environment variable to something like ~/hacking or ~/fun or like I do ~/work (though I must say my work is full of fun hacking :-). You can set it directly with export GOPATH=~/hacking but I would recommend to add it to your ~/.profile file. Note that it will only be used on the next login so you can also set it directly or source the ~/.profile file with . ~/.profile after you've made the change.
- Set PATH to include $GOPATH/bin -- you will need this to run some of the programs you build and install (export PATH=$PATH:$GOPATH/bin) -- also make this persistent as described above
- Create $GOPATH/src/snapcore (mkdir -p $GOPATH/src/github.com/snapcore) and enter that directory (cd $GOPATH/src/github.com/snapcore)
- Clone your fork here (git clone email@example.com:zyga/snapd -- do replace zyga with your github account name)
- Add the upstream repository as a remote (git remote add upstream firstname.lastname@example.org:snapcore/snapd) - you will use this later to get latest changes from everyone
- Run the ./get-deps.sh script. You will probably need a few extra things (sudo apt-get install golang-go bzr)
- You are now good to go :-)
At this stage you can go build and go test individual packages. I would also advise you to have a look at my devtools repository where I've prepared useful scripts for various tasks. One thing you may want to use is the refresh-bits script. Having followed steps 1 through 8 above, let's use refresh-bits to run our locally built version of snapd and snap.
- Clone devtools to anywhere you want (git clone email@example.com:zyga/devtools) and enter the cloned repository (cd devtools)
- Assuming your GOPATH is still set, run ./refresh-bits snap snapd setup run-snapd restore
- Look at what is printed on screen, at some point you will notice that locally started snapd is running (you can always stop it by pressing ctrl+c) along with instructions on how to run your locally built snap executable to talk to it
- In another terminal, in the same directory, run sudo ./snap.amd64 --version
If you have any questions about that, please use the comments section below. Thanks!