Created
November 27, 2016 05:06
-
-
Save dapperfu/b5f21549909b1c0bab25ddb8fb3d6d69 to your computer and use it in GitHub Desktop.
FreeNAS 9.10 - Etherpad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Config | |
ETHERPAD_VER=1.6.0 | |
# Github URL to | |
URL=https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VER}.tar.gz | |
TMP_FILE=/tmp/etherpad.tar.gz | |
# Root directory for etherpad. | |
ETHER_ROOT=/srv/etherpad | |
## Setup | |
/bin/rm -rf ${TMP_FILE} ${ETHER_ROOT} | |
# Reset jail to nothing. Don't run this in a jail setup to do something else. | |
/usr/sbin/pkg info | /usr/bin/cut -f1 -d" " | /usr/bin/xargs /usr/sbin/pkg remove -y | |
# Update, upgrade and install needed packages. | |
/usr/sbin/pkg update --force | |
/usr/sbin/pkg upgrade --yes | |
/usr/sbin/pkg install --yes node npm curl daemontools | |
# Fetch the latest given etherpad version | |
/usr/bin/fetch --output=/tmp/etherpad.tar.gz ${URL} | |
# Create etherpad root directory. | |
/bin/mkdir -p ${ETHER_ROOT} | |
# | |
/usr/bin/tar -xzvf ${TMP_FILE} -C ${ETHER_ROOT} --strip-components=1 | |
# Create Etherpad User and change permissions on home directory. | |
/usr/sbin/pw useradd -u 9001 -n etherpad -d ${ETHER_ROOT} -s /bin/sh | |
/usr/sbin/chown -R etherpad:etherpad ${ETHER_ROOT} | |
## Daemon Tools | |
# Create an etherpad service | |
/bin/mkdir -p /var/service/etherpad/ | |
# Setup run file | |
echo '#!/bin/sh' > /var/service/etherpad/run | |
echo '/usr/bin/su -l etherpad -c "/bin/sh /srv/etherpad/bin/run.sh"' >> /var/service/etherpad/run | |
# Change permissions | |
/bin/chmod +x /var/service/etherpad/run | |
# Start daemon tools. | |
/usr/sbin/sysrc svscan_enable=yes | |
/usr/sbin/service svscan start | |
echo "Give it a few minutes on first run but etherpad should running at etherpad http://jail_ip:9001/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment