blob: 4ba9b94ab576c5784a2a12052c55922edb7ea9af [file] [log] [blame]
Richard Felkl26525492018-02-14 17:00:40 +01001#!/bin/bash
Richard Felkl99e14182018-02-15 15:32:30 +01002WORKING_DIR="$PWD"
Richard Felkl26525492018-02-14 17:00:40 +01003while getopts "d:" option
4do
5 case "${option}"
6 in
Richard Felkl99e14182018-02-15 15:32:30 +01007 d|\?) WORKING_DIR="${OPTARG}";;
Richard Felkl26525492018-02-14 17:00:40 +01008 esac
9done
10
Richard Felkl99e14182018-02-15 15:32:30 +010011TIME=$(date +%Y%m%d-%H%M%S)
12DIR="$WORKING_DIR/aptly-packages-import-$TIME"
13mkdir -p $DIR
Richard Felkl26525492018-02-14 17:00:40 +010014
15PAYLOAD_LINE=`awk '/^__PAYLOAD_BELOW__/ {print NR + 1; exit 0; }' $0`
16
17tail -n+$PAYLOAD_LINE $0 | tar xzv -C $DIR
18
19REPOS="$(ls -1 $DIR)"
20
21for REPO in $REPOS
22do
23 aptly repo add $REPO $DIR/$REPO
Richard Felkl99e14182018-02-15 15:32:30 +010024 SNAPSHOT_NAME="$REPO-$TIME"
Richard Felkl26525492018-02-14 17:00:40 +010025 aptly snapshot create $SNAPSHOT_NAME from repo $REPO
26done
27
28aptly_publish_update.sh -av
29
30exit 0
31
Richard Felklec5941c2018-02-14 17:41:18 +010032__PAYLOAD_BELOW__