Skip to content

Commit

Permalink
Optimize build.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
Jianhui Zhao committed Oct 20, 2018
1 parent bbb1812 commit 41f8e21
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 62 deletions.
10 changes: 6 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ generate() {
local dir="rttys-$os-$arch"
local bin="rttys"

mkdir -p output/$dir
cp conf/rttys.crt conf/rttys.key output/$dir
mkdir output/$dir
cp output/rttys.crt output/rttys.key output/$dir

[ "$os" = "windows" ] && {
bin="rttys.exe"
Expand All @@ -20,15 +20,17 @@ generate() {
if [ "$os" = "windows" ];
then
zip -r $dir.zip $dir
rm -r $dir
else
tar zcvf $dir.tar.gz $dir --remove-files
tar zcvf $dir.tar.gz $dir
fi

cd ..
}

rm -rf output
mkdir output

TARGET=output ./generate-CA.sh rttys

generate linux amd64
generate linux 386
Expand Down
31 changes: 0 additions & 31 deletions conf/rttys.crt

This file was deleted.

27 changes: 0 additions & 27 deletions conf/rttys.key

This file was deleted.

48 changes: 48 additions & 0 deletions scripts/rttys.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rttys
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Execute the rttys command.
# Description:
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/lsb/init-functions

RTTYSPID=/var/run/rttys.pid
PORT=5912

do_start () {
start-stop-daemon --start --make-pidfile --pidfile $RTTYSPID --background --exec /usr/local/bin/rttys -- -port $PORT -cert /etc/rttys/rttys.crt -key /etc/rttys/rttys.key
}

do_stop () {
start-stop-daemon --stop --pidfile $RTTYSPID
sleep 1
rm -f $RTTYSPID
}

case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
status)
exit 0
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac

0 comments on commit 41f8e21

Please sign in to comment.