cirros-logo图标与提示语等

 1. logo与提示语:/etc/rc3.d/S99-logo,/etc/issue

# /etc/rc3.d/S99-logo start
  ____               ____  ____
 / __/ __ ____ ____ / __ \/ __/
/ /__ / // __// __// /_/ /\ \
\___//_//_/  /_/   \____/___/
   http://cirros-cloud.net
# cat /etc/rc3.d/S99-logo
#!/bin/sh
# vi: ts=4 noexpandtab
# load modules

LOGO=/usr/share/cirros/logo

case "$1" in
        start)
                [ ! -f "$LOGO" ] || cat "$LOGO"
                ;;
        stop|restart|reload) : ;;
  *)
        echo $"Usage: $0 {start}"
        exit 1
esac

exit $?
# cat /usr/share/cirros/logo
  ____               ____  ____
 / __/ __ ____ ____ / __ \/ __/
/ /__ / // __// __// /_/ /\ \
\___//_//_/  /_/   \____/___/
   http://cirros-cloud.net
# cat /etc/issue
login as 'cirros' user. default password: 'gocubsgo'. use 'sudo' for root.
#

 2.ext3- resizefs

# cat /etc/rc3.d/S55-resizefs
#!/bin/sh
# vi: ts=4 noexpandtab

RESIZE_MODE="background"
GROWROOT="enabled"
if [ -f /etc/default/resizefs ]; then
        . /etc/default/resizefs
fi

case "$1" in
        start)
                lxc-is-container && exit 0
                [ -e /dev/root ] || exit 0
                case "$GROWROOT" in
                        disabled|off|0) :;;
                        *)
                                growroot /dev/root ||
                                        { echo "failed growing /dev/root"; exit 1; }
                esac
                # here we have to use start-stop-daemon or the resize
                # process gets killed when rc.sysinit ends (LP: #1261710)
                case "$RESIZE_MODE" in
                        background)
                                cirros-per once resize-rootfs -- \
                                        start-stop-daemon --start --background \
                                                --exec=/sbin/resize-filesystem -- \
                                                /dev/root /run/resize.rootfs /dev/console
                                ;;
                        foreground)
                                cirros-per once resize-rootfs -- \
                                                /sbin/resize-filesystem \
                                                /dev/root /run/resize.rootfs /dev/console
                                ;;
                        disabled) : ;;
                        *)
                                echo "resizefs: unknown RESIZE_MODE='$RESIZE_MODE'." \
                                        "Doing nothing." 1>&2
                                ;;
                esac
                ;;
        stop|restart|reload) : ;;
        *)
                echo $"Usage: $0 {start}"
                exit 1
                ;;
esac

exit $?
# df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
/dev                 devtmpfs      224.6M         0    224.6M   0% /dev
/dev/vda1            ext3          960.8M     42.7M    886.4M   5% /
tmpfs                tmpfs         233.1M         0    233.1M   0% /dev/shm
tmpfs                tmpfs         233.1M     92.0K    233.0M   0% /run
#

# cat /etc/default/resizefs
# RESIZE_MODE can be one of 'disabled', 'foreground' or 'background'
RESIZE_MODE='background'
# GROWROOT can be 'enabled' or 'disabled'
GROWROOT='enabled'

 

 

# cat /etc/init.d/rc.sysinit
#!/bin/sh
# vi: ts=4 noexpandtab

. /lib/cirros/shlib

write_lxc_is_container() {
        cat <<"EOF"
#!/bin/sh
# This program is written by /etc/rc.d/rc.sysinit.
# It simply reports whether or not this system is in an lxc container

EOF
        if is_lxc; then
                echo "# This is an LXC container"
                echo '[ "$1" = "-v" ] && echo '"$_LXC_CONTAINER"
                echo "exit 0"
        else
                echo "# This is NOT an LXC container"
                echo '[ "$1" = "-v" ] && echo none'
                echo "exit 1"
        fi
}

fail() { echo "FAIL:" "$@"; }
warn() { echo "WARN:" "$@"; }

### begin init ###

if [ ! -d /proc/1 ]; then
        mount -n -t proc /proc /proc || fail "failed mount /proc"
fi

read uptime cputime < /proc/uptime
iinfo "$0: up at $uptime"

if (: >/.testrw; ) >/dev/null 2>&1; then
        rm -f /.testrw
else
        mount -o remount,rw / || fail "failed mount / rw"
fi

is_mounted sysfs "" /sys ||
        mount -t sysfs sysfs /sys || fail "failed mount /sys!"

if ! is_lxc; then
        mount_once devtmpfs /dev /dev || fail "failed mount /dev"
fi
iinfo "container: $_LXC_CONTAINER"

mkdir -p /dev/pts /dev/shm /run

mount -a

mkdir /run/var.tmp

hostname -F /etc/hostname

filecap /usr/bin/traceroute NET_RAW

f="/bin/lxc-is-container" && write_lxc_is_container > "$f" && chmod 755 "$f"

if ! is_lxc; then
        for d in $(awk '$2 == "/" { print $1 }' /proc/mounts); do
                [ -e "/dev/${d#/dev}" ] && ln -sf "${d#/dev/}" /dev/root && break
        done
fi

## pretend you're runlevel 3
set +f
for s in /etc/rc3.d/S*; do
        [ -x "$s" ] || continue
        "$s" "start" </dev/null || warn "$s failed"
done
set -f

if is_lxc; then
        grep -q "^pts/0$" /etc/securetty || echo "pts/0" >> /etc/securetty
        if ! [ /dev/tty1 -ef /dev/console ]; then
                # on libvirt lxc, /dev/console is a symlink to /dev/pts0
                # and /dev/tty1 is also a symlink to /dev/pts/0. So using
                # the tty1 gets us a getty on "console"
                #
                # on upstream lxc, /dev/console is a character device
                # so we run a getty there if so.
                lxc_console="console"
        fi
fi

s_args=""
for tty in $lxc_console tty1 ttyS0 hvc0 ttyAMA0; do
        if [ -e /dev/$tty ] && { echo "" >> "/dev/$tty" ; } 2>/dev/null ; then
                s_args="${s_args:+${s_args} }s/^#$tty:\(.*\)/$tty:\1/;"
        else
                s_args="${s_args:+${s_args} }s/^$tty:\(.*\)/#$tty:\1/;"
        fi
done
[ -z "$s_args" ] ||
        { sed -i "$s_args" /etc/inittab && kill -HUP 1; }

if [ -f /etc/rc.local -a -x /etc/rc.local ]; then
        /etc/rc.local
fi
#

 

posted @ 2023-06-26 14:18  咿呀哒喏  阅读(23)  评论(0编辑  收藏  举报