Skip to content
Permalink
Browse files

Don't install grub on Docker container

  • Loading branch information...
RobbieF committed Aug 18, 2019
1 parent e126f97 commit 0e0350aee26b8fb72910161acc3e82b0acb1bece
Showing with 42 additions and 32 deletions.
  1. +42 −32 build/020-grub
@@ -1,41 +1,51 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

if [[ -d /boot/grub/ ]]; then
# Determine the platform
if [[ -d /usr/lib/arm-linux-gnueabihf ]]; then
# Raspberry Pi / ARM
echo Raspberry Pi does not use Grub...
exit
elif [[ -d /usr/lib/aarch64-linux-gnu ]]; then
# Pine A64+ aarch64
echo This board does not use Grub...
exit
elif [[ -d /usr/lib/i386-linux-gnu ]]; then
# 32-Bit
echo This is a 32-bit build. Installing Grub...
elif [[ -d /usr/lib/x86_64-linux-gnu ]]; then
# 64-Bit
echo This is a 64-bit build. Installing Grub...
fi
platform=$(/usr/local/share/nems/nems-scripts/info.sh platform)

if (( $platform == 21 )); then

echo "Docker does not need grub."

else

if [[ -d /boot/grub/ ]]; then
# Determine the platform
if [[ -d /usr/lib/arm-linux-gnueabihf ]]; then
# Raspberry Pi / ARM
echo Raspberry Pi does not use Grub...
exit
elif [[ -d /usr/lib/aarch64-linux-gnu ]]; then
# Pine A64+ aarch64
echo This board does not use Grub...
exit
elif [[ -d /usr/lib/i386-linux-gnu ]]; then
# 32-Bit
echo This is a 32-bit build. Installing Grub...
elif [[ -d /usr/lib/x86_64-linux-gnu ]]; then
# 64-Bit
echo This is a 64-bit build. Installing Grub...
fi

# Delete current settings
sed -i '/GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
sed -i '/GRUB_TIMEOUT/d' /etc/default/grub
# Delete current settings
sed -i '/GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
sed -i '/GRUB_TIMEOUT/d' /etc/default/grub

# Add NEMS settings
echo "
# Hide GRUB Menu
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=0" >> /etc/default/grub
# Add NEMS settings
echo "
# Hide GRUB Menu
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=0" >> /etc/default/grub

# Add nomodeset to grub (otherwise display may turn off after boot if connected to a TV)
if ! grep -q "nomodeset" /etc/default/grub; then
sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nomodeset /g' /etc/default/grub
# Add nomodeset to grub (otherwise display may turn off after boot if connected to a TV)
if ! grep -q "nomodeset" /etc/default/grub; then
sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="nomodeset /g' /etc/default/grub
fi

# Update grub
/usr/sbin/update-grub
else
echo "This device does not appear to use grub."
fi

# Update grub
/usr/sbin/update-grub
else
echo "This device does not appear to use grub."
fi

0 comments on commit 0e0350a

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