Skip to content

Instantly share code, notes, and snippets.

@drew1kun
Forked from stevenhaddox/ds215j_provisioner.md
Created March 26, 2016 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drew1kun/8cc23c6d73ebec344098 to your computer and use it in GitHub Desktop.
Save drew1kun/8cc23c6d73ebec344098 to your computer and use it in GitHub Desktop.
Bootstrap Synology DS215j DSM 5.x provisioner steps

Boostrap the Synology DS215j with optware, ipkg, and sudo

Inspired mostly from the Bootstrap DS215j blog post

Download & Install ipkg in a persistent manner

# Create a directory that won't get nuked during DSM security updates
mkdir /volume1/@optware
cd /volume1/@optware

# Download & configure ipkg
feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipkg_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipkg_name
tar -xOvzf $ipkg_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf

# Move the extracted /opt files to our persistent optware directory & symlink /opt
mv /opt/* /volume1/@optware/
rm -r /opt
ln -s /volume1/@optware /opt

# Make ipkg available immediately to root
export PATH=/opt/sbin:/opt/bin:$PATH

Create a service script to recreate the symlink to persistent optware directory if needed at reboot

mkdir -p /usr/local/etc/rc.d/
wget -O /usr/local/etc/rc.d/optware.sh https://gist.githubusercontent.com/stevenhaddox/cead26111aea3fdcc9a5/raw/optware.sh
chmod 755 /usr/local/etc/rc.d/optware.sh

Setup sudo

ipkg install sudo
visudo
# Add the following line to visudo
# %wheel ALL=(ALL) ALL
%administrators ALL=(ALL) ALL
#!/bin/sh
#
# Optware setup
# Alternatives Optware Startup und Shutdown Script #/usr/local/etc/rc.d/optware.sh
#
case $1 in
start)
[ ! -h /opt -a ! -d /opt ] && ln -s /volume1/@optware /opt
for i in /opt/etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
;;
stop)
for i in /opt/etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set stop
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i stop
;;
esac
done
;;
*)
echo "Usage: $0 [start|stop]"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment