Setup script after WD Cloud firmware updated

You lose all custom configurations whenever the WD Cloud firmware has updated. Below scripts help me to revert my settings,

Update SSH server to use public key authentication

Login to root on the WD Cloud and create .ssh on the server side,

1
mkdir ~/.ssh

Upload public key from your machine to the server, Replace nas with your host/IP address.

1
scp ~/.ssh/id_rsa.pub root@_**nas**_:~/.ssh/authorized_keys

on the server-side

1
chmod go-rwx ~/.ssh
2
sed -i.bak "s/PubkeyAuthentication no/PubkeyAuthentication yes/" /etc/ssh/sshd_config
3
/etc/init.d/ssh restart

You can ssh to the nas without entering the password. In short,

1
# run it from you own machine
2
# prerequistes, you have generated a public/pair key pair in ~/.ssh
3
4
# configuration
5
export TARGET_SERVER=nas
6
7
ssh root@$TARGET_SERVER mkdir ~/.ssh
8
Upload public key from your machine to the server, Replace nas with your host/IP address.
9
10
scp ~/.ssh/id_rsa.pub root@nas:~/.ssh/authorized_keys
11
on the server-side
12
13
ssh root@$TARGET_SERVER << EOF
14
chmod go-rwx ~/.ssh
15
sed -i.bak "s/PubkeyAuthentication no/PubkeyAuthentication yes/" /etc/ssh/sshd_config
16
/etc/init.d/ssh restart
17
EOF

If you do not want to build packages, you can download from https://app.box.com/wdcloud. I will try to keep it up-to-date.

Script to build general packages

Below script build packages such as transmission, joe, etc

1
# build useful component base on my personal preference WD Cloud (ubuntu, arm)
2
3
### configuration ###
4
# your WD cloud host name
5
export SERVER_HOST=nas
6
7
# target cloud version
8
WD_VERSION=04.04.02-105
9
10
### execute ###
11
12
# download and unpack the gpl source and build tools
13
wget http://download.wdc.com/gpl/gpl-source-wd_my_cloud-$WD_VERSION.zip
14
rm -rf packages
15
unzip gpl-source-wd_my_cloud-$WD_VERSION.zip packages/build_tools/debian/*
16
17
mkdir 64k-wheezy
18
cp -R packages/build_tools/debian/* ./64k-wheezy
19
echo '#!/bin/bash' > 64k-wheezy/build.sh
20
echo './build-armhf-package.sh --pagesize=64k $1 wheezy' >> 64k-wheezy/build.sh
21
chmod a+x 64k-wheezy/build.sh
22
23
cd 64k-wheezy
24
./setup.sh bootstrap/wheezy-bootstrap_1.24.14_armhf.tar.gz build
25
26
mv build/usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static_orig
27
cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static
28
29
# override build/etc/apt/sources.list
30
echo "deb http://security.debian.org/ wheezy/updates main contrib non-free" > build/etc/apt/sources.list
31
echo "deb-src http://security.debian.org/ wheezy/updates main contrib non-free" >> build/etc/apt/sources.list
32
echo "deb http://ftp.debian.org/debian wheezy-updates main contrib non-free" >> build/etc/apt/sources.list
33
echo "deb-src http://ftp.debian.org/debian wheezy-updates main contrib non-free" >> build/etc/apt/sources.list
34
echo "deb http://ftp.debian.org/debian wheezy main contrib non-free" >> build/etc/apt/sources.list
35
echo "deb-src http://ftp.debian.org/debian wheezy main contrib non-free" >> build/etc/apt/sources.list
36
# optional until you need to use backports packages
37
echo "deb http://ftp.debian.org/debian wheezy-backports main contrib non-free" >> build/etc/apt/sources.list
38
echo "deb http://ftp.debian.org/debian wheezy-backports main contrib non-free" >> build/etc/apt/sources.list
39
40
cp /etc/resolv.conf build/etc
41
42
# exiv2
43
./build.sh exiv2
44
45
# editor
46
./build.sh joe
47
scp build/root/joe_*.deb root@$SERVER_HOST:~
48
ssh root@$SERVER_HOST dpkg -i joe_*.deb
49
50
# htop
51
./build.sh htop
52
scp build/root/htop_*.deb root@$SERVER_HOST:~
53
ssh root@$SERVER_HOST dpkg -i htop_*.deb
54
55
# unrar
56
./build.sh unrar
57
scp build/root/unrar_*.deb root@$SERVER_HOST:~
58
ssh root@$SERVER_HOST dpkg -i unrar_*.deb
59
60
# transmission
61
# below build process will be finished after an hour or so
62
./build.sh libcurl3-gnutls
63
./build.sh libminiupnpc5
64
./build.sh libnatpmp1
65
./build.sh transmission-common
66
./build.sh transmission-daemon
67
# upload
68
scp build/root/libcurl3-gnutls_*.deb root@$SERVER_HOST:~
69
scp build/root/libminiupnpc5_*.deb root@$SERVER_HOST:~
70
scp build/root/libnatpmp1_*.deb root@$SERVER_HOST:~
71
scp build/root/transmission-common_*.deb root@$SERVER_HOST:~
72
scp build/root/transmission-daemon_*.deb root@$SERVER_HOST:~
73
# install
74
ssh root@$SERVER_HOST dpkg -i libcurl3-gnutls_*.deb
75
ssh root@$SERVER_HOST dpkg -i libminiupnpc5_*.deb
76
ssh root@$SERVER_HOST dpkg -i libnatpmp1_*.deb
77
ssh root@$SERVER_HOST dpkg -i transmission-common_*.deb
78
ssh root@$SERVER_HOST dpkg -i transmission-daemon_*.deb
79
# the transmission daemon / web should be started
80
# if not, /etc/init.d/transmission-daemon start
81
# in case you have backup settings, upload settings and restart
82
# /etc/init.d/transmission-daemon restart
83
84
# nodejs
85
./build.sh libc-ares2
86
scp build/root/libc-ares2_*.deb root@$SERVER_HOST:~
87
ssh root@$SERVER_HOST dpkg -i libc-ares2_*.deb
88
# it takes an hour to build
89
./build.sh libv8
90
scp build/root/libv8-3*.deb root@$SERVER_HOST:~
91
ssh root@$SERVER_HOST dpkg -i libv8-3*.deb
92
wget https://nodejs.org/dist/v4.2.1/node-v4.2.1-linux-armv7l.tar.gz
93
tar vfxz node-v4.2.1-linux-armv7l.tar.gz
94
cd node-v4.2.1-linux-armv7l
Share