Remove some old CentOS compatibility and address FIXMEs

In earlier commits it was noted that we aren't as complete as we could
be with the scripts in launch.  This commit removes detection of yum as
a package manager (which stopped being a real thin in CentOS-7).

And creates a more complete list of tools used in the appropriate
scripts

Change-Id: I4cd05da18155169fd640c06a151467aed6112a3d
This commit is contained in:
Tony Breeds 2024-05-02 18:18:42 -05:00
parent 5684a75119
commit ef1f976faa
2 changed files with 9 additions and 15 deletions

View File

@ -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

View File

@ -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