-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from WDCommunity/docker
Add Docker
- Loading branch information
Showing
15 changed files
with
620 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Package: docker | ||
Version: 17.12.1 | ||
Packager: TFL | ||
Email: | ||
Homepage: https://docker.com | ||
Description: Docker container management | ||
Icon: docker.png | ||
AddonShowName: Docker | ||
AddonIndexPage: index.html | ||
AddonUsedPort: | ||
InstDepend: | ||
InstConflict: | ||
StartDepend: | ||
StartConflict: | ||
CenterType: | ||
UserControl: | ||
MinFWVer: | ||
MaxFWVer: | ||
IndividualFlag: 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg | ||
|
||
# DO NOT REMOVE | ||
# I don't know if it's required for backward compatibility | ||
# I don't have time to figure it out | ||
APKG_MODULE="docker" | ||
|
||
APKG_PATH="" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
APP_NAME="$(basename $(pwd))" | ||
DATE="$(date +"%m%d%Y")" | ||
CWD="$(pwd)" | ||
VERSION="$(awk '/Version/{print $NF}' apkg.rc)" | ||
|
||
echo "Building ${APP_NAME} version ${VERSION}" | ||
|
||
MODELS="WDMyCloudEX4 WDMyCloudEX2 WDMyCloudEX4100 WDMyCloudDL4100 WDMyCloudEX2100 WDMyCloudDL2100 MyCloudEX2Ultra MyCloudPR4100 MyCloudPR2100" | ||
|
||
for model in $MODELS; do | ||
../../mksapkg -E -s -m $model > /dev/null | ||
done | ||
|
||
echo "Move binaries" | ||
|
||
mkdir -p ../../packages | ||
find .. -maxdepth 1 -name "*.bin*" -exec rename 's#\('$DATE'\)##' {} \; | ||
mv ../*.bin ../../packages | ||
|
||
echo "Bundle sources" | ||
SRC_TAR="../../packages/${APP_NAME}_src_${VERSION}.tar.gz" | ||
tar -czf $SRC_TAR . | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
# Copyright 2011 Canonical, Inc | ||
# 2014 Tianon Gravi | ||
# Author: Serge Hallyn <[email protected]> | ||
# Tianon Gravi <[email protected]> | ||
#set -e | ||
|
||
function is_mountpoint | ||
{ | ||
mnts=(`cat /proc/self/mounts | grep "$1" | awk '{print $2}'`) | ||
|
||
for i in "${mnts[@]}" | ||
do | ||
if [ "$i" == "$1" ] ; then | ||
return 0 | ||
fi | ||
done | ||
|
||
return 1 | ||
} | ||
|
||
# for simplicity this script provides no flexibility | ||
|
||
# if cgroup is mounted by fstab, don't run | ||
# don't get too smart - bail on any uncommented entry with 'cgroup' in it | ||
if grep -v '^#' /etc/fstab | grep -q cgroup; then | ||
echo 'cgroups mounted from fstab, not mounting /sys/fs/cgroup' | ||
exit 0 | ||
fi | ||
|
||
# kernel provides cgroups? | ||
if [ ! -e /proc/cgroups ]; then | ||
exit 0 | ||
fi | ||
|
||
# if we don't even have the directory we need, something else must be wrong | ||
if [ ! -d /sys/fs/cgroup ]; then | ||
exit 0 | ||
fi | ||
|
||
# mount /sys/fs/cgroup if not already done | ||
if ! is_mountpoint /sys/fs/cgroup; then | ||
if ! mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup ; then | ||
echo 'failed to mount /sys/fs/cgroup' | ||
exit 1 | ||
fi | ||
fi | ||
|
||
cd /sys/fs/cgroup | ||
|
||
# get/mount list of enabled cgroup controllers | ||
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do | ||
mkdir -p $sys | ||
if ! is_mountpoint /sys/fs/cgroup/$sys; then | ||
if ! mount -n -t cgroup -o $sys cgroup $sys; then | ||
rmdir $sys || true | ||
fi | ||
fi | ||
done | ||
|
||
# example /proc/cgroups: | ||
# #subsys_name hierarchy num_cgroups enabled | ||
# cpuset 2 3 1 | ||
# cpu 3 3 1 | ||
# cpuacct 4 3 1 | ||
# memory 5 3 0 | ||
# devices 6 3 1 | ||
# freezer 7 3 1 | ||
# blkio 8 3 1 | ||
|
||
exit 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
# Copyright 2011 Canonical, Inc | ||
# 2014 Tianon Gravi | ||
# Author: Serge Hallyn <[email protected]> | ||
# Tianon Gravi <[email protected]> | ||
#set -e | ||
|
||
# we don't care to move tasks around gratuitously - just umount the cgroups | ||
|
||
# if we don't even have the directory we need, something else must be wrong | ||
if [ ! -d /sys/fs/cgroup ]; then | ||
exit 0 | ||
fi | ||
|
||
for sys in /sys/fs/cgroup/*; do | ||
if [ -d $sys ]; then | ||
umount $sys | ||
fi | ||
if [ -d $sys ]; then | ||
rmdir $sys || true | ||
fi | ||
done | ||
|
||
# Always unmount cgroup first | ||
if ! umount /sys/fs/cgroup ; then | ||
echo 'failed to unmount /sys/fs/cgroup' | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg | ||
|
||
APP=docker | ||
WEBPATH="/var/www/$APP" | ||
|
||
# restore startup script | ||
[ -f /usr/sbin/docker_daemon.sh.bak ] && mv -f /usr/sbin/docker_daemon.sh.bak /usr/sbin/docker_daemon.sh | ||
|
||
# remove binaries | ||
|
||
# remove lib symlink | ||
rm -f /var/lib/docker | ||
|
||
# remove web | ||
rm -rf $WEBPATH |
Oops, something went wrong.