fixed install_base, added more color 8)

This commit is contained in:
Marcus 2023-05-01 13:35:59 +02:00
parent faa1866049
commit 788eb85de1

View file

@ -14,10 +14,6 @@ then
MIRROR="http://ftp.gwdg.de/debian/" MIRROR="http://ftp.gwdg.de/debian/"
fi fi
##message () {
## echo "== " $1
##}
# colors for colored output 8) # colors for colored output 8)
RED="\e[31m" RED="\e[31m"
GREEN="\e[32m" GREEN="\e[32m"
@ -82,16 +78,38 @@ sudo debootstrap bullseye build/chroot/ $MIRROR || sudo debootstrap bullseye bui
message "copy xdgmenumaker deb file into chroot" message "copy xdgmenumaker deb file into chroot"
sudo cp deb/xdgmenumaker* build/chroot/tmp || error sudo cp deb/xdgmenumaker* build/chroot/tmp || error
message "deploying install_base" message "deploying install_base"
cat <<EOF > build/chroot/tmp/install_base.sh cat <<\EOF > build/chroot/tmp/install_base.sh
#!/bin/bash #!/bin/bash
message () { RED="\e[31m"
echo "== install_base: $@" GREEN="\e[32m"
YELLOW="\e[33m"
ENDCOLOR="\e[0m"
function message() {
case $1 in
error)
MESSAGE_TYPE="${RED}ERROR${ENDCOLOR}"
;;
info|*)
MESSAGE_TYPE="${GREEN}INFO${ENDCOLOR}"
;;
esac
if [ "$1" == "info" ] || [ "$1" == "error" ]
then
MESSAGE=$2
else
MESSAGE=$1
fi
echo -e "[${MESSAGE_TYPE}] ${YELLOW}install_base${ENDCOLOR}: $MESSAGE"
} }
error () error ()
{ {
message "ERROR!!" message error "ERROR!!"
exit 1 exit 1
} }
@ -103,43 +121,43 @@ DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND export DEBIAN_FRONTEND
### packages ### packages
message "install nanodesk base packages" message "install nanodesk base packages"
apt install -y \\ apt install -y \
live-boot \\ live-boot \
linux-image-amd64 \\ linux-image-amd64 \
grub-pc \\ grub-pc \
ifupdown \\ ifupdown \
net-tools \\ net-tools \
wireless-tools \\ wireless-tools \
wpagui \\ wpagui \
isc-dhcp-client \\ isc-dhcp-client \
man \\ man \
console-data \\ console-data \
locales \\ locales \
sudo \\ sudo \
xserver-xorg \\ xserver-xorg \
jwm \\ jwm \
xdm \\ xdm \
xterm \\ xterm \
xfe \\ xfe \
pcmanfm \\ pcmanfm \
audacious \\ audacious \
htop \\ htop \
host \\ host \
mc \\ mc \
wget \\ wget \
curl \\ curl \
less \\ less \
rsync \\ rsync \
vim \\ vim \
links2 \\ links2 \
firefox-esr \\ firefox-esr \
transmission-gtk \\ transmission-gtk \
lxterminal \\ lxterminal \
arandr \\ arandr \
zenity \\ zenity \
ncdu \\ ncdu \
gparted \\ gparted \
git \\ git \
/tmp/xdgmenumaker*.deb || error /tmp/xdgmenumaker*.deb || error
message "set hostname in hosts" message "set hostname in hosts"
@ -163,28 +181,30 @@ echo -e "debian\ndebian" | (passwd debian)
#dpkg-reconfigure keyboard-configuration #dpkg-reconfigure keyboard-configuration
###https://serverfault.com/a/689947 ###https://serverfault.com/a/689947
message "set locales and tzdata" message "set locales and tzdata"
echo "Europe/Berlin" > /etc/timezone && \\ echo "Europe/Berlin" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata && \\ dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \\ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \\ echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \\ dpkg-reconfigure --frontend=noninteractive locales && \
locale-gen en_US.UTF-8 && \\ locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8 update-locale LANG=en_US.UTF-8
### clean cache ### clean cache
message "apt clean" message "apt clean"
apt clean apt clean
KERNEL_VER="$(/usr/bin/dpkg -l "linux-image-*" | grep -E '^ii'| awk '{print $2}' | grep -E 'linux-image-[0-9]\.([0-9]|[0-9][0-9])\.([0-9]|[0-9][0-9])-([0-9]|[0-9][0-9])-amd64$')" KERNEL_VER="$(dpkg -l "linux-image-*" | grep "^ii"| awk '{print $2}' | grep -E 'linux-image-[0-9]\.([0-9]|[0-9][0-9])\.([0-9]|[0-9][0-9])-([0-9]|[0-9][0-9])-amd64$')"
message "KERNEL_VER=$KERNEL_VER"
### but fetch packages for grub and kernel, so we do not need to download them ### but fetch packages for grub and kernel, so we do not need to download them
### in case nanodesk get installed to diska ### in case nanodesk get installed to diska
message "apt --download linux-image and grub packages to have them in cache for installation by user" message "apt --download linux-image and grub packages to have them in cache for installation by user"
apt -d --reinstall install \\ apt -d --reinstall install \
linux-image-amd64 \\ linux-image-amd64 \
$KERNEL_VER \\ $(echo $KERNEL_VER) \
grub-pc grub-pc-bin \\ grub-pc grub-pc-bin \
grub-common \\ grub-common \
grub2-common \\ grub2-common \
os-prober || error os-prober || error
EOF EOF
message "run install_base" message "run install_base"