Skip to content

Commit

Permalink
Script to create deb package.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Jan 27, 2013
1 parent 52d029d commit 3c5f16a
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
table.cache
*.deb
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ $(SERVER): shadowsocks/*.go cmd/$(PREFIX)-server/*.go
cd shadowsocks; go install
cd cmd/$(PREFIX)-server; $(CGO) go install -a

local: $(LOCAL)

server: $(SERVER)

test:
cd shadowsocks; go test
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":60
"timeout":0
}
41 changes: 41 additions & 0 deletions createdeb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

if [[ $# != 1 ]]; then
echo "$0 <arch, i386 or amd64>"
exit 1
fi

export CGO_ENABLED=0
export GOOS=linux

arch=$1
case $arch in
i386)
export GOARCH=386
;;
amd64)
export GOARCH=amd64
;;
*)
echo "arch $i not supported"
exit 1
;;
esac

# build shadowsocks server
pushd cmd/shadowsocks-server
go build -a -v || exit 1
popd

# create debian package
DEBDIR=shadowsocks-go_0.6-1-$arch
rm -rf $DEBDIR
cp -r deb $DEBDIR

sed -i -e "s/^Architecture.*$/Architecture: $arch/" $DEBDIR/DEBIAN/control || exit 1

mkdir -p $DEBDIR/usr/bin
cp cmd/shadowsocks-server/shadowsocks-server $DEBDIR/usr/bin/shadowsocks

fakeroot dpkg-deb --build $DEBDIR

9 changes: 9 additions & 0 deletions deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: shadowsocks-go
Version: 0.6-1
Section: net
Priority: optional
Architecture: i386
Depends:
Maintainer: CYF <[email protected]>
Description: shadowsocks-go is the go port of shadowsocks, a light weight tunneling proxy
This package contains only the server.
2 changes: 1 addition & 1 deletion sample-config/shadowsocks → deb/etc/init.d/shadowsocks
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Note: this script requires sudo in order to run shadowsocks as the specified
# user.

BIN=/usr/local/bin/shadowsocks
BIN=/usr/bin/shadowsocks
CONFIG_FILE=/etc/shadowsocks/config.json
LOG_FILE=/var/log/shadowsocks
USER=nobody
Expand Down
7 changes: 7 additions & 0 deletions deb/etc/shadowsocks/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"server":"127.0.0.1",
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":0
}

0 comments on commit 3c5f16a

Please sign in to comment.