とても こういうものは 最初から作成する能力は にゃんたろうには 有りません
#!/bin/sh
#
# /etc/rc.d/rc.S: Initialize system.
#
# シングルユーザモード・マルチユーザモード共通の初期化を行なう
#
# 初期化内容:
# udev・ローカルファイルシステム・ホスト名・RTC・syslogd/klogd(仮起動)・
# CPUクロック(仮設定)・ISAPnP・カーネルモジュール・フレームバッファ・unicon・
# コンソールフォント・キーマップ・motd/issue・シリアルポート
#
# Set the path.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
mkdir /dev/pts
mkdir /dev/shm
chmod 1777 /dev/shm
# ln -s /bin/true /dev/.hotplug.agent
mknod /dev/null -m 0666 c 1 3
mknod /dev/unikey -m 0644 c 10 202
mknod /dev/ppp -m 0660 c 108 0
mknod /dev/loop0 -m 0660 b 7 0
chgrp disk /dev/loop0
mknod /dev/md0 -m 0660 b 9 0
chgrp disk /dev/md0
mknod /dev/fd0 -m 0660 b 2 0
chgrp floppy /dev/fd0
ln -sf /proc/self/fd /dev/fd
# Start udev.
echo "Starting udev..."
/sbin/udevd --daemon
/sbin/udevadm monitor --environment > /dev/.udev.log 2>&1 &
/sbin/udevadm trigger --action=add --type=subsystems
/sbin/udevadm trigger --action=add --type=devices
/sbin/udevadm settle
/bin/killall udevadm
if [ -x /sbin/hwclock ]; then
# Setup timezone for now.
/sbin/hwclock --hctosys --localtime
fi
# disable unused hibernation data
if [ -x /etc/rc.d/hibernate-cleanup.sh ]; then
/etc/rc.d/hibernate-cleanup.sh start
fi
# Enable swapping.
/sbin/swapon -a
# Start update.
#/sbin/update -s 60 -f 10 &
# move udev log
/bin/mv -f /dev/.udev.log /var/log/udev.log
# Clean /etc/mtab* and create new one with a root entry.
/bin/rm -f /etc/mtab*
ln -sf /proc/mounts /etc/mtab
/sbin/mount -f -v -o remount /
/sbin/mount -f -v /proc
/sbin/mount -f -v /sys
/sbin/mount -f -v /dev
# copy the rules generated before / was mounted read-write
for file in /dev/.udev/tmp-rules--*; do
dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest
rm -f $file
done
# Set the hostname.
echo -n "Set the hostname: "
if [ ! -r /etc/HOSTNAME ]; then
# If there's no /etc/HOSTNAME, fall back on this default.
echo "darkstar.frop.org" > /etc/HOSTNAME
fi
HOST=`cat /etc/HOSTNAME`
HOST=${HOST%%.*}
echo "$HOST."
/bin/hostname "$HOST"
# Configure the system clock.
# This can be changed if your system keeps GMT.
#if [ -x /sbin/hwclock ]; then
# /sbin/hwclock --adjust
# /sbin/hwclock --hctosys
#fi
# Suppless system logs displayed into console.
if [ -x /sbin/rsyslogd ]; then
echo "*.info /tmp/bootlog" > /tmp/bootlog.conf
if [ ! -d /var/run ]; then
# Workaround when /var is on non-root partition.
mkdir /var/run
/sbin/rsyslogd -m 0 -f /tmp/bootlog.conf
sleep 1
mv -f /var/run/rsyslogd.pid /tmp
rmdir /var/run
else
/sbin/rsyslogd -m 0 -f /tmp/bootlog.conf
sleep 1
mv -f /var/run/rsyslogd.pid /tmp
fi
fi
# Set CPU frequency with the support of Speedstep technology.
#if [ ! -d /sys/devices/system/cpu/cpu0/cpufreq -a -f /proc/cpufreq ]; then
# # Old API needs setting the default governer to "performance".
# echo -n "0%50%100%performance" > /proc/cpufreq
#fi
# Configure the ISA PnP cards.
if [ -x /sbin/isapnp -a -r /etc/isapnp.conf ]; then
echo "Configuring ISA PnP cards..."
/sbin/isapnp /etc/isapnp.conf
fi
# Initializing kernel modules stuff and load necessary modules by hand.
# Any recent modules are auto-probed by murasaki.
if [ -x /etc/rc.d/rc.modules ]; then
. /etc/rc.d/rc.modules
fi
# Clean up /tmp and /media directory.
# /bin/rm -rf /tmp /media
if [ ! -d /tmp ]; then
mkdir /tmp
fi
if [ ! -d /media ]; then
mkdir /media
fi
/sbin/mount -v -o mode=0755 -t tmpfs /media /media
chmod 1777 /tmp
mkdir /tmp/.ICE-unix
chmod 1777 /tmp/.ICE-unix
# Mount local filesystems in fstab.
# But not NFS because TCP/IP is not yet configured.
echo "Mounting local filesystems..."
/sbin/mount -avt nonfs,proc,sysfs,tmpfs,nocifs
if grep -q usbfs /proc/filesystems && ! grep -q usbfs /etc/mtab; then
mount -t usbfs usbfs /proc/bus/usb
sleep 3
fi
# Clean up temporary files on the /etc and /var volume.
/bin/rm -f /etc/nologin /etc/shutdownpid
/bin/rm -f /var/run/utmp /var/run/*.pid /var/run/*/*pid /var/run/gpm* /var/run/news/*
# Looks like we have to create this.
cat /dev/null > /var/run/utmp
/bin/chown root:utmp /var/run/utmp
/bin/chmod 664 /var/run/utmp
# 起動パラメータに "vga16" を追加するとVGA16フレームバッファを使用
# それ以外を用いる場合は "vga" 等で適宜初期化のこと
# Set VGA framebuffer if necessary.
chk_parm () {
/usr/bin/sed -e "
s/\(^\|.* \)$1=\([^ ]*\).*\$/\2/
t
s/\(^\|.* \)\($1\)\( .*\|\$\)/\2/
t
d" /proc/cmdline
}
look_mod () {
[ -n "$(find /lib/modules/`uname -r` -name $1.ko)" ]
}
if look_mod vga16fb && [ -n "`chk_parm vga16`" ]; then
/sbin/modprobe vga16fb
fi
# 起動パラメータに "unicon=エンコード" を追加すると unicon を使用
# (フレームバッファ使用時のみ)
# Set console encoding mode.
UCENC="`chk_parm unicon`"
if look_mod encode-$UCENC &&
[ -x /usr/bin/uniconctrl -a -n "$UCENC" -a -n "`cat /proc/fb`" ]; then
echo "Set console encoding mode: $UCENC."
/sbin/modprobe unikey
/sbin/modprobe encode-$UCENC
/usr/bin/loadunimap /usr/share/unicon/direct.uni
TTYS="`/usr/bin/awk -F'[: ]+' '/^[^#].*:respawn:/{print $6}' /etc/inittab`"
for t in $TTYS; do
/usr/bin/uniconctrl --$UCENC $t
done
fi
# Load a custom screen font if the user has an rc.font script.
if [ -x /etc/rc.d/rc.font ]; then
. /etc/rc.d/rc.font
fi
# Load a custom keymap if the user has an rc.keymap script.
if [ -x /etc/rc.d/rc.keymap ]; then
. /etc/rc.d/rc.keymap
fi
# We need to update any files added in DOS if using UMSDOS.
if [ "$ROOTTYPE" = "umsdos" ]; then
echo "Synchronizing UMSDOS directory structure..."
umssync -r99 -v- /
fi
# /etc/issue と /etc/motd をテンプレート (*.in) から生成
# テンプレート中、%s→システム名 / %r→システムリリース / %v→OSバージョン /
# %m→ハードウェア種別 / %p→プロセッサ種別 に、それぞれ置換される
# Generate the /etc/issue and /etc/motd.
UNS=`uname -s`; UNR=`uname -r`; UNV=`uname -v`; UNM=`uname -m`; UNP=`uname -p`
makemsg () {
/usr/bin/sed -e "s/%s/$UNS/g" -e "s/%r/$UNR/g" -e "s/%v/$UNV/g" \
-e "s/%m/$UNM/g" -e "s/%p/$UNP/g" $1.in > $1
}
makemsg /etc/issue
makemsg /etc/motd
# Run serial port setup script:
# (CAREFUL! This can make some systems hang if the rc.serial script isn't
# set up correctly. If this happens, you may have to edit the file from a
# boot disk)
#
# . /etc/rc.d/rc.serial
ミクロソフト さんに 迷惑をかけない という事のみ 確認して そのまま使用します。
にゃんたろう 拝!
2014年 3月 23日 日曜日 21:12:13 JST 作成