Rename squashfs file, add .squashfs syntax
This commit is contained in:
parent
f759784652
commit
bc4d1af428
3 changed files with 20 additions and 7 deletions
10
Makefile
10
Makefile
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue