diff --git a/launch/src/opendev_launch/mirror_volumes.sh b/launch/src/opendev_launch/mirror_volumes.sh index c23dfe2275..6142d79071 100644 --- a/launch/src/opendev_launch/mirror_volumes.sh +++ b/launch/src/opendev_launch/mirror_volumes.sh @@ -94,15 +94,9 @@ if blkid | grep -q $PV_DEVICE ; then exit 1 fi -# Because images may not have all the things we need. -# TODO(tonyb): 1) Do we really care about yum here? ; -# 2) Audit script for other tools perl/parted etc -# 3) Also other scipts in this dir -if which apt-get ; then - apt-get update && apt-get install -y lvm2 -elif which yum ; then - yum -y install lvm2 -fi +# NOTE: This isn't expected to install any packages but just in case let us +# list the script requirements here +apt-get update && apt-get install -y e2fsprogs lvm2 parted perl set -xeuo pipefail diff --git a/launch/src/opendev_launch/mount_volume.sh b/launch/src/opendev_launch/mount_volume.sh index 74db995cd2..79c6dd61d7 100644 --- a/launch/src/opendev_launch/mount_volume.sh +++ b/launch/src/opendev_launch/mount_volume.sh @@ -18,12 +18,9 @@ DEVICE=$1 MOUNT_PATH=$2 FS_LABEL=$3 -# Because images may not have all the things we need. -if which apt-get ; then - apt-get update && apt-get install -y lvm2 -elif which yum ; then - yum -y install lvm2 -fi +# NOTE: This isn't expected to install any packages but just in case let us +# list the script requirements here +apt-get update && apt-get install -y e2fsprogs lvm2 parted perl # Sanity check that we don't break anything that already has an fs. if ! blkid | grep $DEVICE ; then @@ -37,6 +34,9 @@ if ! blkid | grep $DEVICE ; then tune2fs -i 0 -c 0 /dev/main/$FS_LABEL # Remove existing fstab entries for this device. + # As this script is expected to be run on a "brand new" server this is + # reasonably safe. If /dev/main/$FS_LABEL already exists lvcreate will + # have failed and the script aborted anyway. perl -nle "m,/dev/main/$FS_LABEL, || print" -i /etc/fstab if [ ! -d $MOUNT_PATH ] ; then