Rename squashfs file, add .squashfs syntax

This commit is contained in:
jalr 2018-03-01 19:52:24 +01:00
parent f759784652
commit bc4d1af428
3 changed files with 20 additions and 7 deletions

View file

@ -5,6 +5,11 @@ WEBSEED ?= http://10.2.2.1
PACKER_DOCKER_IMAGE ?= labsync-packer
MKTORRENT_DOCKER_IMAGE ?= labsync-mktorrent
CWD=$(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
.PHONY: default
default: clean dockerimg images/debian-stretch.squashfs images/debian-stretch.torrent
.PHONY: clean
clean:
rm -f images/*
@ -15,7 +20,7 @@ dockerimg:
docker build -t "$(PACKER_DOCKER_IMAGE)" --build-arg "PACKER_VERSION=$(PACKER_VERSION)" packer/docker
docker build -t "$(MKTORRENT_DOCKER_IMAGE)" mktorrent
images/debian-stretch:
images/debian-stretch.squashfs:
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
@ -26,7 +31,6 @@ images/debian-stretch:
"$(PACKER_DOCKER_IMAGE)" \
debian-stretch
#images/debian-stretch.squashfs
images/debian-stretch.torrent:
docker run \
--rm \
@ -36,4 +40,4 @@ images/debian-stretch.torrent:
-e "ANNOUNCE=$(ANNOUNCE)" \
-e "WEBSEED=$(WEBSEED)" \
"$(MKTORRENT_DOCKER_IMAGE)" \
debian-stretch
debian-stretch.squashfs

View file

@ -2,7 +2,10 @@
set -e
NAME="$1"
if [ "$NAME" = "" ]; then
# remove file extension
NAME="$(echo "$1" | sed 's/\.[^.]*//')"
fi
if [ "$WEBSEED" = "" ]; then
echo '$WEBSEED not provided' >&2
@ -14,11 +17,17 @@ if [ "$ANNOUNCE" = "" ]; then
fi
TORRENT_FILE="$NAME.torrent"
WEBSEED_URL="$WEBSEED/$NAME"
WEBSEED_URL="$WEBSEED/$1"
if [ -e "$TORRENT_FILE" ]; then rm "$TORRENT_FILE"; fi
mktorrent-borg -a "$ANNOUNCE" -o "$TORRENT_FILE" -l 22 -w "$WEBSEED_URL" "$NAME"
mktorrent-borg \
-n "$NAME" \
-a "$ANNOUNCE" \
-o "$TORRENT_FILE" \
-l 22 \
-w "$WEBSEED_URL" \
"$1"
if [ "$user" != "" ] && [ "$group" != "" ]; then
chown "$user:$group" "$TORRENT_FILE"

View file

@ -12,7 +12,7 @@ fi
PACKER_JSON="$NAME.json"
INITRAMFS_FILE="$NAME.initramfs"
LINUX_FILE="$NAME.linux"
SQUASHFS_FILE="$NAME"
SQUASHFS_FILE="$NAME.squashfs"
packer build "$PACKER_JSON"