Skip to content
Permalink
Browse files

Some minor improvements to AWS boot

  • Loading branch information...
NEMS Linux
NEMS Linux committed Aug 24, 2019
1 parent 9a6ec70 commit 3b5a6ff9151fab26bcaad10f305cac1d6071b02d
Showing with 26 additions and 22 deletions.
  1. +13 −10 build/160-aws
  2. +13 −12 build/200-hostname
@@ -12,16 +12,19 @@ if (( $platform == 22 )); then
echo "PATCH-000002" >> /var/log/nems/patches.log
fi

addition="# Amazon Web Services Hostname Override\n/root/nems/nems-admin/build/200-hostname\n\n"
if grep -q "exit" /etc/rc.local; then
# This file contains an exit command, so make sure our new command comes before it
/bin/sed -i -- 's,exit,'"$addition"'exit,g' /etc/rc.local
else
# No exit command within the file, so just add it
echo "PLACEHERE" >> /etc/rc.local
/bin/sed -i -- 's,PLACEHERE,'"$addition"'exit 0,g' /etc/rc.local
if ! grep -q "NEMS00003" /etc/rc.local; then

addition="# NEMS00003 Amazon Web Services Hostname Override\n/root/nems/nems-admin/build/200-hostname\n\n"
if grep -q "exit" /etc/rc.local; then
# This file contains an exit command, so make sure our new command comes before it
/bin/sed -i -- 's,exit,'"$addition"'exit,g' /etc/rc.local
else
# No exit command within the file, so just add it
echo "PLACEHERE" >> /etc/rc.local
/bin/sed -i -- 's,PLACEHERE,'"$addition"'exit 0,g' /etc/rc.local
fi
/bin/systemctl stop rc-local.service
/bin/systemctl start rc-local.service
fi
/bin/systemctl stop rc-local.service
/bin/systemctl start rc-local.service

fi
@@ -2,17 +2,18 @@
echo $0 > /var/www/html/userfiles/nems-build.cur

hn=$(/bin/hostname)
printf "Changing Hostname... "
/bin/sed -i -- 's/'"$hn"'/nems/g' /etc/hosts
/bin/sed -i -- 's/'"$hn"'/nems/g' /etc/hostname
if [[ $hn != "nems" ]]; then
printf "Changing Hostname... "
/bin/sed -i -- 's/'"$hn"'/nems/g' /etc/hosts
/bin/sed -i -- 's/'"$hn"'/nems/g' /etc/hostname

platform=$(/usr/local/share/nems/nems-scripts/info.sh platform)
if (( $platform == 22 )); then
/bin/sed -i -- 's/ {{hostname}}/ nems/g' /etc/cloud/templates/hosts.debian.tmpl
/bin/sed -i -- 's/127.0.0.1 localhost/127.0.0.1 localhost nems/g' /etc/cloud/templates/hosts.debian.tmpl
fi

hostnamectl set-hostname nems
echo Done.
echo Change will take effect at next reboot.
platform=$(/usr/local/share/nems/nems-scripts/info.sh platform)
if (( $platform == 22 )); then
/bin/sed -i -- 's/ {{hostname}}/ nems/g' /etc/cloud/templates/hosts.debian.tmpl
/bin/sed -i -- 's/127.0.0.1 localhost/127.0.0.1 localhost nems/g' /etc/cloud/templates/hosts.debian.tmpl
fi

hostnamectl set-hostname nems
echo Done.
echo Change will take effect at next reboot.
fi

0 comments on commit 3b5a6ff

Please sign in to comment.
You can’t perform that action at this time.