Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@stevenhaddox

This comment has been minimized.

Owner

stevenhaddox commented Aug 2, 2015

Other common packages:

ipkg install bison bzip2 ctags expat imagemagick libxml2 libxslt openvpn openssl readline tmux vim unzip wget which zlib

@iarroyo5

This comment has been minimized.

iarroyo5 commented Oct 16, 2015

Works perfectly, @stevenhaddox thank you very much!

If I close the shell and again entry by SSH with no root user, command sudo isn't available, because export PATH=/opt/sbin:/opt/bin:$PATH is temporal for the session, to solve this i have created a .profile file in the home of this user /volume1/homes/myuser/ and I put the same code export PATH=/opt/sbin:/opt/bin:$PATH

I put this in the commentary if it can be useful to others.

@lukyer

This comment has been minimized.

lukyer commented Nov 2, 2015

works great, thank you!
just a note: you have to do ipkg update before ipkg install sudo

@lukyer

This comment has been minimized.

lukyer commented Nov 4, 2015

For me, to have persistent links to downloaded applications i had to edit /root/.profile and prepend "/opt/sbin:/opt/bin:" of PATH variable. It is what export command was supposed to do but it didn't work for me.

@ffeldhaus

This comment has been minimized.

ffeldhaus commented Mar 28, 2016

Thanks for the great instructions! I took them and adapted them for optware-ng in this gist https://gist.github.com/ffeldhaus/226f2c5743a7f631806d

@hanyong37

This comment has been minimized.

hanyong37 commented Apr 1, 2016

Thanks a lot, it works for me!

@mguimas

This comment has been minimized.

mguimas commented Aug 18, 2016

To configure DS215j just go to Optware-ng and run the script for "ARMv7 EABI hardfloat". Then add export PATH=/opt/bin:/opt/sbin:$PATH to your .bashrc in your home directory so that ipkg is in your path. To add ipkg to the path of all users just put the export ... in file /etc/profile. Simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment