Compare commits

...

2 Commits

Author SHA1 Message Date
Chteufleur c146c8dae2 Fix typo in README 2016-11-07 22:40:33 +01:00
Chteufleur bed3e755f7 Add packaging instructions and script 2016-11-07 22:38:49 +01:00
4 changed files with 104 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# HTTPAuthentificationOverXMPP
# HTTPAuthenticationOverXMPP
Provide an HTTP anthentification over XMPP. Implementation of [XEP-0070](https://xmpp.org/extensions/xep-0070.html).
Provide an HTTP authentication over XMPP. Implementation of [XEP-0070](https://xmpp.org/extensions/xep-0070.html).
Can be run as a XMPP client or XMPP component.

40
packaging/PACKAGE.md Normal file
View File

@ -0,0 +1,40 @@
# Packaging
## Build libraries as shared
In order to packaged the project, you will need to follow those different steps.
We will build libraries as shared libraries.
The first step is to buid the GO standard library as shared.
```
$ cd $GOPATH
$ go install -buildmode=shared std
```
Next, we will build the 2 libraries to make them shared…
```
$ cd $GOPATH
$ go install -buildmode=shared -linkshared github.com/jimlawless/cfg
$ go install -buildmode=shared -linkshared git.kingpenguin.tk/chteufleur/go-xmpp.git/src/xmpp
```
Then finally, build the project with the option that tell to use libraries as shared and not static.
```
$ cd $GOPATH
$ go install -linkshared git.kingpenguin.tk/chteufleur/HTTPAuthentificationOverXMPP.git
```
You will find shared libraries over here :
* ``$GOROOT/pkg/linux_amd64_dynlink/libstd.so``
* ``$GOPATH/pkg/linux_amd64_dynlink/libgithub.com-jimlawless-cfg.so``
* ``$GOPATH/pkg/linux_amd64_dynlink/libgit.kingpenguin.tk-chteufleur-go-xmpp.git-src-xmpp.so``
And the binary file here :
* ``$GOPATH/bin/HTTPAuthentificationOverXMPP.git``
An example can be found [here](https://github.com/jbuberel/buildmodeshared/tree/master/gofromgo).
## Configuration
At the installation, the folder ``$XDG_CONFIG_DIRS/http-auth/`` need to be created (example ``/etc/xdg/http-auth``) where to place the configuration file named ``httpAuth.conf``.

View File

@ -0,0 +1,9 @@
[Unit]
Description=Provide an HTTP authentication over XMPP (https://xmpp.org/extensions/xep-0070.html)
[Service]
ExecStart=/etc/init.d/http-auth.sh start
ExecStop=/etc/init.d/http-auth.sh stop
[Install]
WantedBy=multi-user.target

53
scripts/http-auth.sh Normal file
View File

@ -0,0 +1,53 @@
#!/bin/sh
#######################
name="httpAuth"
dirPath="/usr/local/sbin"
#######################
sh="/bin/bash"
pidPath="/var/run/http-auth/http-auth.pid"
#######################
do_start() {
nohup $dirPath/$name &
/bin/echo $! > $pidPath
}
do_stop() {
if [ -e $pidPath ]
then
pid=$(/bin/cat $pidPath)
kill $pid
rm $pidPath
fi
}
get_status() {
if [ -e $pidPath ] ; then
pid=$(/bin/cat $pidPath) ;
/bin/echo "$name is running with PID $pid" ;
else
/bin/echo "$name is stopped" ;
fi
}
case $1 in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
status)
get_status
;;
*)
/bin/echo "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac