Skip to content

Commit

Permalink
debian installer
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ ONeal committed Apr 24, 2013
1 parent 0872c1d commit aa49a06
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions debinstall/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* http://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
* http://unix.stackexchange.com/a/30435
9 changes: 9 additions & 0 deletions debinstall/deb-src/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: hello-node
Version: 1.0-0
Section: base
Priority: optional
Architecture: i386
Depends:
Maintainer: AJ ONeal <[email protected]>
Description: HelloNode! The installable NodeJS System Service
Let's you install a nodejs app as a service, just to see how it feels.
4 changes: 4 additions & 0 deletions debinstall/deb-src/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# Start the services!

service hello-node start
22 changes: 22 additions & 0 deletions debinstall/deb-src/DEBIAN/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Installs node if it isn't already installed
#
# Don't steamroll over a previously installed node version
# TODO provide a local version of node?

VER="0.10.4"
ARCH="x86"
if [ `arch | grep 64` ]
then
ARCH="x64"
fi

# TODO test version
if [ ! -f /usr/local/bin/node ]
then
pushd /tmp
wget -quiet -c "http://nodejs.org/dist/v${VER}/node-v${VER}-linux-${ARCH}.tar.gz"
tar xvf node-v${VER}-linux-${ARCH}.tar.gz -C /tmp/
cp -a /tmp/node-v${VER}-linux-${ARCH}/* /usr/local/
fi
4 changes: 4 additions & 0 deletions debinstall/deb-src/DEBIAN/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Stop the appserver:
service hello-node stop
15 changes: 15 additions & 0 deletions debinstall/deb-src/etc/init/hello-node.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Hello Node System Service
description "Hello Node System Service"

start on filesystem
stop on runlevel [06]

console output
respawn

PATH="/opt/hello-node/bin/:/usr/local/bin:/usr/bin:${PATH}"
script
node /opt/hello-node/bin/server.js
#node /usr/local/lib/hello-node/server.js
#/opt/hello-node/bin/node /opt/hello-node/bin/server.js
end script
23 changes: 23 additions & 0 deletions debinstall/redeb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

rm -rf deb-src/opt/hello-node/
mkdir -p deb-src/opt/

rm -rf deb-dist/
mkdir -p deb-dist/

rsync -avhP ../HelloNode/ deb-src/opt/hello-node/ --delete
pushd deb-src/
tar czf ../deb-dist/data.tar.gz [a-z]*
pushd DEBIAN
tar czf ../../deb-dist/control.tar.gz *
popd
popd

pushd deb-dist/
echo 2.0 > ./debian-binary
ar r ../hellonode-1.deb debian-binary control.tar.gz data.tar.gz
popd

rm -rf deb-src/opt/hello-node/
rm -rf deb-dist/

0 comments on commit aa49a06

Please sign in to comment.