Skip to content

Commit

Permalink
Better debian packaging.
Browse files Browse the repository at this point in the history
Add conffiles to avoid config file being overwritten from update.
  • Loading branch information
cyfdecyf committed May 16, 2013
1 parent 3e908b4 commit 05212de
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions deb/DEBIAN/conffiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/etc/shadowsocks/config.json
/etc/init.d/shadowsocks
2 changes: 1 addition & 1 deletion deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: shadowsocks-go
Version: 0.6.1-1
Version: VER-1
Section: net
Priority: optional
Architecture: any
Expand Down
5 changes: 5 additions & 0 deletions deb/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
if [ -x "/etc/init.d/shadowsocks" ]; then
update-rc.d shadowsocks defaults >/dev/null
fi
7 changes: 7 additions & 0 deletions deb/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d shadowsocks remove >/dev/null
fi
# End automatically added section
7 changes: 7 additions & 0 deletions deb/DEBIAN/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/shadowsocks" ]; then
invoke-rc.d shadowsocks stop || exit $?
fi
# End automatically added section
6 changes: 4 additions & 2 deletions deb/etc/init.d/shadowsocks
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Default-Stop: 0 1 6
# Short-Description: shadowsocks is a lightweight tunneling proxy
# Description: Modified from Linode's nginx fastcgi startup script
### END INIT INFO

# Note: this script requires sudo in order to run shadowsocks as the specified
# user.

BIN=/usr/bin/shadowsocks
BIN=/usr/bin/shadowsocks-server
CONFIG_FILE=/etc/shadowsocks/config.json
LOG_FILE=/var/log/shadowsocks
USER=nobody
Expand All @@ -25,6 +25,8 @@ PID_DIR=/var/run
PID_FILE=$PID_DIR/shadowsocks.pid
RET_VAL=0

[ -x $BIN ] || exit 0

check_running() {
if [[ -r $PID_FILE ]]; then
read PID <$PID_FILE
Expand Down
3 changes: 2 additions & 1 deletion script/createdeb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ DEBDIR=shadowsocks-go_$ver-1-$arch
rm -rf $DEBDIR
cp -r deb $DEBDIR

sed -i -e "s/VER/$ver/" $DEBDIR/DEBIAN/control || exit 1
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
cp cmd/shadowsocks-server/shadowsocks-server $DEBDIR/usr/bin/
rm -f cmd/shadowsocks-server/shadowsocks-server

fakeroot dpkg-deb --build $DEBDIR
Expand Down

0 comments on commit 05212de

Please sign in to comment.