How to add a command to the Makefile

This tutorial is a quick way to understand how to add a script or something else to the Makefile installation process. This is solely for those who are building rpm/deb packages and want to add extra stuff in the installation package.

So inside your Makefile directory add the file you would like to see in the final installation:

For example:

[root@softether vpnserver_package]# ls script*
script_i_want_to_add.sh

Now edit Makefile to properly add the script to the final package.

[root@softether vpnserver_package]# vim Makefile

Look for the install and uninstall part and add the lines you need.


install:
cp vpncmd/vpncmd /usr/bin/
cp vpncmd/ham* /usr/bin/
cp -r vpnserver /usr/local/
chmod 755 vpnserver
cp vpnserver.init /etc/init.d/vpnserver
cp vpn_server.config /usr/local/vpnserver/
chmod 755 /etc/init.d/vpnserver
/sbin/chkconfig –add vpnserver
### adding install line here
cp script_i_want_to_add.sh /usr/bin
uninstall:
rm -rf /usr/local/vpnserver
#rm -f /etc/init.d/vpnserver
/sbin/chkconfig –del vpnserver
rm /usr/bin/hamco*
rm /usr/bin/vpncmd
### adding uninstall line here
rm /usr/bin/changevhub

view raw

Makefile

hosted with ❤ by GitHub

And that’s it. This script will then be accessible in the final stage of the installation, under /usr/bin/ folder which is the PATH folder.

How to compile Softether and create RPM package

This tutorial will explain how to compile and create a softether RPM package. This rpm package will have a small step to include a preset configuration.

First go to Softether and copy the source link.

First install all the dependencies you will need

yum -y install readline-devel ncurses-devel openssl-devel gcc vim wget

Then download the package, extract it, configure the system and compile it.

[root@softether ~]# cd /usr/src
[root@softether src]# wget http://www.softether-download.com/files/softether/v4.05-9423-beta-2014.02.18-tree/Source%20Code/softether-src-v4.05-9423-beta.tar.gz

[root@softether src]# tar -zxvf softether-src-v4.05-9423-beta.tar.gz
[root@softether src]# cd v4*
[root@softether v4.05-9423]# ./configure


Select your operating system below:
1: Linux
2: FreeBSD
3: Solaris
4: Mac OS X
5: OpenBSD

Which is your operating system (1 – 5) ? : 1

Select your CPU bits below:
1: 32-bit
2: 64-bit

Which is the type of your CPU (1 – 2) ? : 2

[root@softether v4.05-9423]# make

And that’s it. Now all we need to do is to add two files. One for the configuration and the other for the auto start.

Softether Package preparation

[root@softether v4.05-9423]# cd /usr/src
[root@softether src]# mkdir vpnserver_package
[root@softether src]# cd vpnserver_package
[root@softether vpnserver_package]# cp -r ../v4.05-9423/bin/vpnserver .
[root@softether vpnserver_package]# cp -r ../v4.05-9423/bin/vpncmd .

AutoStart
[root@softether vpnserver_package]# vim vpnserver.init

#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x $DAEMON || exit 0
case "$1" in
start)
$DAEMON start
touch $LOCK
;;
stop)
$DAEMON stop
rm $LOCK
;;
restart)
$DAEMON stop
sleep 3
$DAEMON start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

Get the vpnserver configuration and put it in the same folder.

[root@softether vpnserver_package]# ls *vpn
vpn_server.config

Create Makefile

[root@softether vpnserver_package]# wget https://dl.dropboxusercontent.com/u/1227943/ali/Makefile

Now all you need to do is follow this instructions and run checkinstall inside the softether compiled source directory.

Connect a Git/Bitbucket project with a Koding workspace

First create a ssh-key rsa public key.


nrmmota@vm-0:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nrmmota/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/nrmmota/.ssh/id_rsa.
Your public key has been saved in /home/nrmmota/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xxx..... nrmmota@vm-0.nrmmota.koding.kd.io
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| . o . |
| . S .= |
| . . = = |
| E . = oo . |
| . . =..o.+. |
| oo....+= |
+-----------------+

Now cat the public id and copy all of it.

nrmmota@vm-0:~$ cat .ssh/id_rsa.pub
ssh-rsa XXXXXXXXXXXXXXXXXXXXXXXXXX… nrmmota@vm-0.nrmmota.koding.kd.io

In Bitbucket go to “Manage account” -> SSH Keys. Create a new one and paste the key you just copied.

Warning: All its left is to create new Bitbucket project from scratch. Now the manual Git commands come into action. I haven’t found any versioning stuff besides clone project. This only refers to Bitbucket new projects.

nrmmota@vm-0:~$ ls
Applications Backup Documents Web
nrmmota@vm-0:~$ cd Documents/
nrmmota@vm-0:~/Documents$ ls
nrmmota@vm-0:~/Documents$ mkdir OTT
nrmmota@vm-0:~/Documents$ cd OTT/
nrmmota@vm-0:~/Documents/OTT$ git init
Initialized empty Git repository in /home/nrmmota/Documents/OTT/.git/
nrmmota@vm-0:~/Documents/OTT$ git remote add origin git@bitbucket.org:mundumelga/ott.git
nrmmota@vm-0:~/Documents/OTT$ ls
nrmmota@vm-0:~/Documents/OTT$ echo "OTT Project" >> README.md
nrmmota@vm-0:~/Documents/OTT$ git add README.md
nrmmota@vm-0:~/Documents/OTT$ git commit -m "First commit. Adding a README."
[master (root-commit) 995f512] First commit. Adding a README.
Committer: nrmmota
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

1 file changed, 1 insertion(+)
create mode 100644 README.md

nrmmota@vm-0:~/Documents/OTT$ git push -u origin master
The authenticity of host 'bitbucket.org (XXX)' can't be established.
RSA key fingerprint is XXXXXXXX
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bitbucket.org,XXX' (RSA) to the list of known hosts.

Counting objects: 3, done.
Writing objects: 100% (3/3), 242 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@bitbucket.org:mundumelga/ott.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.