Skip to content

Commit

Permalink
Don't install grub on Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieF committed Aug 18, 2019
1 parent e126f97 commit 0e0350a
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions build/020-grub
Original file line number Diff line number Diff line change
@@ -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.