Mirror image - added subdirectory for aptly-add packages.sh
Change-Id: Ife6de39a2e220729d0f1567ed7f3d459817187be
diff --git a/mirror-image/aptly-add-packages.sh b/mirror-image/aptly-add-packages.sh
index ea93aa0..4ba9b94 100755
--- a/mirror-image/aptly-add-packages.sh
+++ b/mirror-image/aptly-add-packages.sh
@@ -1,14 +1,16 @@
#!/bin/bash
-DIR="$PWD"
+WORKING_DIR="$PWD"
while getopts "d:" option
do
case "${option}"
in
- d|\?) DIR="${OPTARG}";;
+ d|\?) WORKING_DIR="${OPTARG}";;
esac
done
-mkdir $DIR
+TIME=$(date +%Y%m%d-%H%M%S)
+DIR="$WORKING_DIR/aptly-packages-import-$TIME"
+mkdir -p $DIR
PAYLOAD_LINE=`awk '/^__PAYLOAD_BELOW__/ {print NR + 1; exit 0; }' $0`
@@ -19,7 +21,7 @@
for REPO in $REPOS
do
aptly repo add $REPO $DIR/$REPO
- SNAPSHOT_NAME="$REPO-$(date +%Y%m%d-%H%M%S)"
+ SNAPSHOT_NAME="$REPO-$TIME"
aptly snapshot create $SNAPSHOT_NAME from repo $REPO
done