export PB_SUITE=$DISTRIBUTION
export TARGET_BASE=/srv/storage-kernels
+# get the last build number of the given target,
+# parsing tarball's file name under /srv/storage-kernels/.
function get_last_target_build_no() {
TARGET_NAME=$1
if [ -n "$TARGET_NAME" ]; then
- retval=$(find $TARGET_BASE/$TARGET_NAME -maxdepth 1 -type d \
- | grep -v "^.$" | sort -n | tail -n 1 \
- | sed -e "s|^\.\/||g" | sed -e "s|.*\/\([^\.]*\)$|\1|g")
+ retval=$(find $TARGET_BASE/$TARGET_NAME -maxdepth 1 -type f \
+ -name 'linux-storage*tar.xz' | grep -v "^.$" \
+ | sed -e "s|$TARGET_BASE/$TARGET_NAME||g" \
+ | sed -e "s|.*\/linux-storage_[0-9a-zA-Z\.]*\.\([^\.]*\).tar.xz$|\1|g" \
+ | sort -n | tail -n 1)
[ -z "$retval" ] && retval="0"
else
retval="0"
export TARGET_NAME=develop
;;
experimental)
- export TARGET_NAME=$PB_SUITE
+ [ -n "$PB_SUITE" ] && export TARGET_NAME=$PB_SUITE || export TARGET_NAME="master"
LAST_DEVELOP_BUILD_NO=$(get_last_target_build_no develop)
BUILD_NUMBER="$LAST_DEVELOP_BUILD_NO.$(printf %03d $BUILD_NUMBER)"
FEATURE_APTCMD="
- echo \"deb http://alexandria.pb.local/dev-repository $DISTRIBUTION main contrib non-free\" \
- > /etc/apt/sources.list.d/profitbricks-linux-image-storage-$DISTRIBUTION.list
+ echo \"deb http://alexandria.pb.local/dev-repository $TARGET_NAME main contrib non-free\" \
+ > /etc/apt/sources.list.d/profitbricks-linux-image-storage-$TARGET_NAME.list
+ "
+ FEATURE_VERSCMD="
+ export FEATURE_VERSION=\`apt-cache showpkg profitbricks-linux-image-storage -a \
+ | grep $TARGET_NAME | grep \) | sed -e \"s|\([^\.]*\)\ .*$|\1|g\"\`
"
;;
*)
apt-get update
# grub is needed in the postinst...
apt-get install -y grub2
-apt-get -t $DISTRIBUTION -y install profitbricks-linux-image-storage || true
+$FEATURE_VERSCMD
+[ -n "###FEATURE_VERSION" ] && export FEATURE_VERSION="=###FEATURE_VERSION"
+apt-get -t $DISTRIBUTION -y install profitbricks-linux-image-storage###FEATURE_VERSION || true
apt-get -y install profitbricks-andbd-modules-storage || true
mkdir -p $TARGET_DIR
export KERNEL_VERSION=###(ls /boot/vmlinu* | cut -d "-" -f2-)