|
|
|
IMAGE_NAME=unixvoid/seedpod
|
|
|
|
WEB_THEME=https://github.com/Secretmapper/combustion/archive/v0.6.2.tar.gz
|
|
|
|
ALPINE_FS=https://cryo.unixvoid.com/bin/filesystem/alpine/linux-latest-amd64.rootfs.tar.gz
|
|
|
|
OS_PERMS=sudo
|
|
|
|
|
|
|
|
|
|
|
|
all:
|
|
|
|
@if [ ! -a deps/rootfs.tar.gz ]; then \
|
|
|
|
$(MAKE) build_filesystem; \
|
|
|
|
fi;
|
|
|
|
$(MAKE) docker_build_web
|
|
|
|
|
|
|
|
build_filesystem:
|
|
|
|
mkdir -p filesystem.tmp/
|
|
|
|
cd filesystem.tmp/ && \
|
|
|
|
wget -O rootfs.tar.gz $(ALPINE_FS) && \
|
|
|
|
tar -xzf rootfs.tar.gz && \
|
|
|
|
rm -f rootfs.tar.gz
|
|
|
|
cp deps/filesystem_setup.sh filesystem.tmp/
|
|
|
|
$(OS_PERMS) systemd-nspawn -D filesystem.tmp/ /filesystem_setup.sh
|
|
|
|
rm -rf filesystem.tmp/filesystem_setup.sh
|
|
|
|
cd filesystem.tmp/ && \
|
|
|
|
tar -czf rootfs.tar.gz *
|
|
|
|
mv filesystem.tmp/rootfs.tar.gz deps/
|
|
|
|
|
|
|
|
aci_build: pull_actool
|
|
|
|
mkdir -p seedpod-layout/rootfs/
|
|
|
|
tar -xzf deps/rootfs.tar.gz -C seedpod-layout/rootfs/
|
|
|
|
cp deps/config.ovpn seedpod-layout/rootfs/
|
|
|
|
cp deps/creds.x seedpod-layout/rootfs/
|
|
|
|
cp deps/settings.json seedpod-layout/rootfs/transmission/
|
|
|
|
cp deps/run.sh seedpod-layout/rootfs/
|
|
|
|
cp deps/manifest.json seedpod-layout/manifest
|
|
|
|
./appc-v0.8.7/actool build seedpod-layout seedpod.aci
|
|
|
|
./appc-v0.8.7/actool --debug validate seedpod.aci
|
|
|
|
rm -rf appc*
|
|
|
|
|
|
|
|
aci_build_web: pull_actool
|
|
|
|
cd deps/ && \
|
|
|
|
mkdir -p stage.tmp/theme && \
|
|
|
|
wget -O stage.tmp/theme.tar.gz $(WEB_THEME) && \
|
|
|
|
tar -xzf stage.tmp/theme.tar.gz -C stage.tmp/theme --strip-components 1
|
|
|
|
mkdir -p seedpod-layout/rootfs/
|
|
|
|
tar -xzf deps/rootfs.tar.gz -C seedpod-layout/rootfs/
|
|
|
|
cp deps/config.ovpn seedpod-layout/rootfs/
|
|
|
|
cp deps/creds.x seedpod-layout/rootfs/
|
|
|
|
cp deps/settings.json seedpod-layout/rootfs/transmission/
|
|
|
|
cp -R deps/stage.tmp/theme/ seedpod-layout/rootfs/usr/share/transmission/web/
|
|
|
|
cp deps/run.sh seedpod-layout/rootfs/
|
|
|
|
cp deps/manifest.json seedpod-layout/manifest
|
|
|
|
./appc-v0.8.7/actool build seedpod-layout seedpod.aci
|
|
|
|
./appc-v0.8.7/actool --debug validate seedpod.aci
|
|
|
|
rm -rf appc*
|
|
|
|
|
|
|
|
run_aci:
|
|
|
|
$(OS_PERMS) rkt run \
|
|
|
|
--net=host \
|
|
|
|
--insecure-options=image \
|
|
|
|
./seedpod.aci
|
|
|
|
|
|
|
|
docker_build:
|
|
|
|
cd deps/ && \
|
|
|
|
$(OS_PERMS) docker build -t $(IMAGE_NAME) .
|
|
|
|
|
|
|
|
docker_build_web:
|
|
|
|
cd deps/ && \
|
|
|
|
mkdir -p stage.tmp/theme && \
|
|
|
|
wget -O stage.tmp/theme.tar.gz $(WEB_THEME) && \
|
|
|
|
tar -xzf stage.tmp/theme.tar.gz -C stage.tmp/theme --strip-components 1 && \
|
|
|
|
$(OS_PERMS) docker build -t $(IMAGE_NAME) -f Dockerfile.web .
|
|
|
|
|
|
|
|
docker_run:
|
|
|
|
$(OS_PERMS) docker run \
|
|
|
|
-d \
|
|
|
|
--name seedpod \
|
|
|
|
--cap-add=NET_ADMIN \
|
|
|
|
--cap-add=NET_RAW \
|
|
|
|
--device=/dev/net/tun \
|
|
|
|
--dns=8.8.8.8 \
|
|
|
|
-p 9091:9091 \
|
|
|
|
-v ~/Downloads/transmission/downloads:/transmission/downloads:rw \
|
|
|
|
-v ~/Downloads/transmission/incomplete:/transmission/incomplete:rw \
|
|
|
|
$(IMAGE_NAME)
|
|
|
|
|
|
|
|
pull_actool:
|
|
|
|
wget https://github.com/appc/spec/releases/download/v0.8.7/appc-v0.8.7.tar.gz
|
|
|
|
tar -zxf appc-v0.8.7.tar.gz
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf deps/stage.tmp/
|
|
|
|
rm -rf seedpod-layout/
|
|
|
|
rm -rf appc-v0.8.7*
|
|
|
|
rm -rf seedpod.aci
|
|
|
|
@if [ -d "filesystem.tmp/" ]; then \
|
|
|
|
$(OS_PERMS) rm -rf filesystem.tmp; \
|
|
|
|
fi
|