Richard Felkl | 2652549 | 2018-02-14 17:00:40 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | DIR="$PWD" |
| 3 | while getopts "d:" option |
| 4 | do |
| 5 | case "${option}" |
| 6 | in |
| 7 | d|\?) DIR="${OPTARG}";; |
| 8 | esac |
| 9 | done |
| 10 | |
| 11 | mkdir $DIR |
| 12 | |
| 13 | PAYLOAD_LINE=`awk '/^__PAYLOAD_BELOW__/ {print NR + 1; exit 0; }' $0` |
| 14 | |
| 15 | tail -n+$PAYLOAD_LINE $0 | tar xzv -C $DIR |
| 16 | |
| 17 | REPOS="$(ls -1 $DIR)" |
| 18 | |
| 19 | for REPO in $REPOS |
| 20 | do |
| 21 | aptly repo add $REPO $DIR/$REPO |
| 22 | SNAPSHOT_NAME="$REPO-$(date +%Y%m%d-%H%M%S)" |
| 23 | aptly snapshot create $SNAPSHOT_NAME from repo $REPO |
| 24 | done |
| 25 | |
| 26 | aptly_publish_update.sh -av |
| 27 | |
| 28 | exit 0 |
| 29 | |
| 30 | __PAYLOAD_BELOW__ |