Alpine packer fixes: autologin, reset terminal modes

This commit is contained in:
Bernhard Ehlers 2020-08-07 10:52:36 +02:00
parent c12ba1cdb1
commit 68c9e58cf1
4 changed files with 37 additions and 7 deletions

View File

@ -23,8 +23,8 @@
{
"filename": "frr-7.3.1.qcow2",
"version": "7.3.1",
"md5sum": "5ed9434e6b87df86704145d77fb7d687",
"filesize": 47535104,
"md5sum": "e6bd9591a5c630bfe2c8688dc043b20b",
"filesize": 47348224,
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/frr-7.3.1.qcow2"
}

View File

@ -18,12 +18,18 @@ cat > /root/set_hostname << 'EOF'
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: set_hostname hostname" >&2
echo "usage: set_hostname host" >&2
exit 1
fi
hostname=$1
domain=$(hostname -d)
host=$1
hostname=${host%%.*}
if [ "$host" = "$hostname" ]; then
domain=$(hostname -d)
else
domain=${host#*.}
fi
hostname "$hostname"
echo "$hostname" > /etc/hostname
sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${hostname}.${domain} ${hostname} localhost.localdomain localhost/" /etc/hosts
@ -37,9 +43,12 @@ echo "service integrated-vtysh-config" > /etc/frr/vtysh.conf
chown frr:frr /etc/frr/vtysh.conf
# run vtysh in .profile
cat > /root/.profile << EOF
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
# reset terminal modes
[ -t 1 ] && printf '\e[?5l\e[?7h\e[?8h'
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc

View File

@ -2,4 +2,4 @@
sed -i 's/\(APPEND .*\)/\1 console=ttyS0/' /boot/extlinux.conf
# autologin on serial console
sed -i 's/^#* *ttyS0.*/ttyS0::respawn:\/bin\/login -f root/' /etc/inittab
sed -i 's/^ttyS0.*/ttyS0::respawn:\/bin\/login -f root/' /etc/inittab

View File

@ -1,6 +1,27 @@
# install additional packages
apk add nano busybox-extras
# create .profile
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
# reset terminal modes
[ -t 1 ] && printf '\e[?5l\e[?7h\e[?8h'
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
EOF
find /home -type d -mindepth 1 -maxdepth 1 | while read -r home; do
cp -p /root/.profile "$home/"
chown $(stat -c '%u:%g' "$home") "$home/.profile"
done
# network configuration
cat > /etc/network/interfaces << EOF
#