Commit 921facc2 authored by Jonathan Swaelens's avatar Jonathan Swaelens
Browse files

fix(script): Correct some lines based on shellcheck and add...



 fix(script): Correct some lines based on shellcheck and add TFTPROOT_EFI 32 and 64 variable and DISTRELEASE use

Correct some lines based on shellcheck and add TFTPROOT_EFI 32 and 64 variable and DISTRELEASE use
Signed-off-by: default avatarJonathan Swaelens <swaelens.jonathan@opensides.be>
parent d7c09548
......@@ -31,10 +31,10 @@ mkdir -p "${NFSROOT}"/etc/argonaut
if [ -n "$FAI_ARGONAUT" ]; then
msg "removing argonaut.conf installed by the package"
rm -Rf ${NFSROOT}/etc/argonaut/argonaut.conf
rm -Rf "${NFSROOT}"/etc/argonaut/argonaut.conf
msg "installing $FAI_ARGONAUT into ${NFSROOT}"
cp ${FAI_ARGONAUT} ${NFSROOT}${FAI_ARGONAUT}
cp "${FAI_ARGONAUT}" "${NFSROOT}${FAI_ARGONAUT}"
if [ -f "$NFSROOT"/etc/argonaut/argonaut.conf ]; then
msg "Using the classical argonaut.conf nothing left to do"
......@@ -48,7 +48,7 @@ else
fi
if [ -n "$FAI_CONF" ]; then
cp ${FAI_CONF} ${NFSROOT}${FAI_CONF}
cp "${FAI_CONF}" "${NFSROOT}${FAI_CONF}"
else
msg "FAI_CONF not mentionned in /etc/fai/nfsroot.conf"
msg "installation will not work please indicate the file to be copied into FAI_CONF"
......@@ -56,7 +56,7 @@ fi
if [ -n "$FAI_LDAP" ]; then
msg "installing $FAI_LDAP into ${NFSROOT}"
cp ${FAI_LDAP} ${NFSROOT}${FAI_LDAP}
cp "${FAI_LDAP}" "${NFSROOT}${FAI_LDAP}"
else
msg "FAI_LDAP not mentionned in /etc/fai/nfsroot.conf"
msg "installation will not work please indicate the file to be copied into FAI_LDAP"
......@@ -64,7 +64,7 @@ fi
if [ -n "$FAI_SSL_CERT" ]; then
msg "installing ssl certificate into nfs root"
cp ${FAI_SSL_CERT} ${NFSROOT}/etc/ssl/certs
cp "${FAI_SSL_CERT}" "${NFSROOT}"/etc/ssl/certs
else
msg "FAI_SSL_CERT not mentionned in /etc/fai/nfsroot.conf"
msg "installation will not be able to use ssl certificate with ldap, please indicate the certs to be copied into FAI_SSL_CERT"
......@@ -72,7 +72,7 @@ fi
if [ -n "$FAI_SSL_CERT_KEY" ]; then
msg "installing ssl certificate private key into nfs root"
cp ${FAI_SSL_CERT_KEY} ${NFSROOT}/etc/ssl/private
cp "${FAI_SSL_CERT_KEY}" "${NFSROOT}"/etc/ssl/private
else
msg "FAI_SSL_CERT_KEY not mentionned in /etc/fai/nfsroot.conf"
msg "installation will not be able to use ssl certifcate with ldap, please indicate the certificate private key to be copied into FAI_SSL_CERT_KEY"
......@@ -80,28 +80,113 @@ fi
if [ -n "$FAI_SSL_CERT_CA" ]; then
msg "installing ssl ca certificate into nfs root"
cp ${FAI_SSL_CERT_CA} ${NFSROOT}/etc/ssl/certs
cp "${FAI_SSL_CERT_CA}" "${NFSROOT}"/etc/ssl/certs
else
msg "FAI_SSL_CERT_CA not mentionned in /etc/fai/nfsroot.conf"
msg "installation will not be able to verify ssl certificate with ldap, please indicate the ca certificate to be copied into FAI_SSL_CERT_CA"
fi
# Get newest kernel installed inside the nfsroot
version=$(echo $NFSROOT/boot/vmlinuz-* | sort -n | head -n1 | cut -d- -f2-)
version=$(echo "$NFSROOT"/boot/vmlinuz-* | sort -n | head -n1 | cut -d- -f2-)
# Copy as default kernel
if [ -f $TFTPROOT/vmlinuz-$version ]; then
# Copy as default kernel (TFTPROOT)
if [ -f "$TFTPROOT"/vmlinuz-"$version" ]; then
msg "installing vmlinuz-install"
cp -f $TFTPROOT/vmlinuz-$version $TFTPROOT/vmlinuz-install
# Change vmlinuz-install name if declared
if [ -n "$DISTRELEASE" ]; then
vmlinuxName=vmlinuz-"$DISTRELEASE"-install
else
vmlinuxName=vmlinuz-install
fi
cp -f "$TFTPROOT"/vmlinuz-"$version" "$TFTPROOT"/"$vmlinuxName"
else
msg "ERROR: cannot find kernel to use as vmlinuz-install!!!"
fi
# Copy initrd if present
if [ -f $TFTPROOT/initrd.img-$version ]; then
# Copy initrd if present (TFTPROOT)
if [ -f "$TFTPROOT"/initrd.img-"$version" ]; then
msg "installing initrd.img-install"
cp -f $TFTPROOT/initrd.img-$version $TFTPROOT/initrd.img-install
# Change initrd.img-install name if declared
if [ -n "$DISTRELEASE" ]; then
initrdName=initrd.img-"$DISTRELEASE"-install
else
initrdName=initrd.img-install
fi
cp -f "$TFTPROOT"/initrd.img-"$version" "$TFTPROOT"/"$initrdName"
else
msg "ERROR: cannot find initrd image to use as initrd.img-xx !!!"
fi
# Actions for TFTPROOT_EFI32 if declared
if [ -n "$TFTPROOT_EFI32" ]; then
# Copy as default kernel (TFTPROOT_EFI32)
if [ -f "$TFTPROOT_EFI32"/vmlinuz-"$version" ]; then
msg "installing vmlinuz-install"
# Change vmlinuz-install name if declared
if [ -n "$DISTRELEASE" ]; then
vmlinuxName=vmlinuz-"$DISTRELEASE"-install
else
vmlinuxName=vmlinuz-install
fi
cp -f "$TFTPROOT_EFI32"/vmlinuz-"$version" "$TFTPROOT_EFI32"/"$vmlinuxName"
else
msg "ERROR: cannot find kernel to use as vmlinuz-install!!!"
fi
# Copy initrd if present (TFTPROOT_EFI32)
if [ -f "$TFTPROOT_EFI32"/initrd.img-"$version" ]; then
msg "installing initrd.img-install"
# Change initrd.img-install name if declared
if [ -n "$DISTRELEASE" ]; then
initrdName=initrd.img-"$DISTRELEASE"-install
else
initrdName=initrd.img-install
fi
cp -f "$TFTPROOT_EFI32"/initrd.img-"$version" "$TFTPROOT_EFI32"/"$initrdName"
else
msg "ERROR: cannot find initrd image to use as initrd.img-xx !!!"
fi
fi
# Actions for TFTPROOT_EFI64 if declared
if [ -n "$TFTPROOT_EFI64" ]; then
# Copy as default kernel (TFTPROOT_EFI64)
if [ -f "$TFTPROOT_EFI64"/vmlinuz-"$version" ]; then
msg "installing vmlinuz-install"
# Change vmlinuz-install name if declared
if [ -n "$DISTRELEASE" ]; then
vmlinuxName=vmlinuz-"$DISTRELEASE"-install
else
vmlinuxName=vmlinuz-install
fi
cp -f "$TFTPROOT_EFI64"/vmlinuz-"$version" "$TFTPROOT_EFI64"/"$vmlinuxName"
else
msg "ERROR: cannot find kernel to use as vmlinuz-install!!!"
fi
# Copy initrd if present (TFTPROOT_EFI64)
if [ -f "$TFTPROOT_EFI64"/initrd.img-"$version" ]; then
msg "installing initrd.img-install"
# Change initrd.img-install name if declared
if [ -n "$DISTRELEASE" ]; then
initrdName=initrd.img-"$DISTRELEASE"-install
else
initrdName=initrd.img-install
fi
cp -f "$TFTPROOT_EFI64"/initrd.img-"$version" "$TFTPROOT_EFI64"/"$initrdName"
else
msg "ERROR: cannot find initrd image to use as initrd.img-xx !!!"
fi
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment