#!/bin/sh LLIUREX_GRUB_TOKENS_DIR="/etc/lliurex-grub-custom" TOKEN_DISTRIBUTOR="lliurex-distributor" TOKEN_GFXMODE="lliurex-gfxmode" TOKEN_GRUB_HIDDEN_TIMEOUT="lliurex-hiddent-timeout" TOKEN_GRUB_HIDDEN_TIMEOUT_2="lliurex-hiddent-timeout-2" TOKEN_GRUB_BACKGROUND="lliurex-grub-background" TOKEN_GRUB_RW="lliurex-grub-rw" mkdir -p ${LLIUREX_GRUB_TOKENS_DIR} [ -e /etc/default/grub ] || cp /usr/share/grub/default/grub /etc/default/grub if [ -f /etc/default/grub ]; then grep "Simple configuration" /etc/default/grub 1>/dev/null || { cp /usr/share/grub/default/grub /etc/default/grub ; rm -rf /etc/lliurex-grub-custom/* ; } echo " [ LLiureX Grub Custom ] : Settings for LliureX Grub" # Set distribution only one time if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_DISTRIBUTOR} ] ; then echo " [ LLiureX Grub Custom ] : Setting DISTRIBUTION" sed -i "s%^GRUB_DISTRIBUTOR=.*%GRUB_DISTRIBUTOR=\"LliureX 15.05\"%g" /etc/default/grub || echo "Not find the line" date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_DISTRIBUTOR} fi # Set GFXMODE only one time if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GFXMODE} ] ; then echo " [ LLiureX Grub Custom ] : Setting GFXMODE" sed -i "s%^#GRUB_GFXMODE=.*%GRUB_GFXMODE=1024x768%g" /etc/default/grub || echo "Not find the line" date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GFXMODE} fi # Set HIDDENT_TIMEOUT only one time if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_HIDDEN_TIMEOUT} ] ; then echo " [ LLiureX Grub Custom ] : Setting HIDDENT_TIMEOUT" sed -i "s%^GRUB_HIDDEN_TIMEOUT_QUIET=true%#GRUB_HIDDEN_TIMEOUT_QUIET=true%g" /etc/default/grub || echo "Not find the line" date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_HIDDEN_TIMEOUT} fi # Set HIDDENT_TIMEOUT only one time if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_HIDDEN_TIMEOUT_2} ] ; then echo " [ LLiureX Grub Custom ] : Setting HIDDENT_TIMEOUT" sed -i "s%^GRUB_HIDDEN_TIMEOUT=.*%GRUB_HIDDEN_TIMEOUT=%g" /etc/default/grub || echo "Not find the line" date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_HIDDEN_TIMEOUT_2} fi # Set GRUB_BACKGROUND only one time if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_BACKGROUND} ] ; then echo " [ LLiureX Grub Custom ] : Setting GRUB_BACKGROUND" echo 'GRUB_BACKGROUND="/usr/share/lliurex-grub-custom/backgrounds/trusty.png"' >> /etc/default/grub date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_BACKGROUND} fi # Set GRUB rw only one time #if [ ! -f ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_RW} ] ; then # echo " [ LLiureX Grub Custom ] : Setting GRUB_RW" # sed -i "s%^GRUB_CMDLINE_LINUX_DEFAULT=.*%GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash rw\"%g" /etc/default/grub || echo "Not find the line" # date +%F_%R > ${LLIUREX_GRUB_TOKENS_DIR}/${TOKEN_GRUB_RW} #fi fi # Template for diversions ORIG_FILE="/etc/grub.d/10_linux" OUR_FILE="/etc/lliurex-grub/10_linux_lliurex" OUR_PACKAGE="lliurex-grub-custom" case $1 in configure) mkdir -p /etc/lliurex-grub/ if dpkg-divert --package ${OUR_PACKAGE} --add --rename --divert /etc/lliurex-grub/10_linux.real ${ORIG_FILE} ; then ln -fs ${OUR_FILE} ${ORIG_FILE} else echo "Unabe to divert file ${ORIG_FILE}" fi ;; *) echo "Nothing to do" ;; esac # Other Stuff # # To clean initramfs scripts if type update-initramfs >/dev/null 2>&1; then update-initramfs -u || true fi #DEBHELPER# update-grub2 || true #DEBHELPER#