上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。

kiyoshi's helpを作りやすくする

kiyoshi's help ver.13をちょっとだけ作りやすくしました。

テキストエディタ、たとえばgeditなどで、
以下の内容:


#!/bin/bash
if [ ! ./init ];
then
echo 'There is \n/init\nThis script cannot work in the directory with "init".'
exit 0
fi
if [ ! ./initrd.img-kiyo2 ];
then
echo 'There is "./initrd.img-kiyo2". This script cannot work in the directory with "initrd.img-kiyo2".'
exit 0
fi
if [ -n "$(apt-cache policy kexec-tools|grep 'インストールされているバージョン: (なし)')" ];
then
echo "Please install kexec-tools first."
exit 0
fi
mkdir init
cd init
gzip -dc /boot/initrd.img-$(uname -r) | cpio -i
cp -p /sbin/kexec sbin/
mkdir -p lib/tls/i686/cmov
ln -s ../../../libc.so.6 lib/tls/i686/cmov/libs.so.6
cp /usr/bin/file bin/
cp -p -L /usr/lib/libmagic.so.1 lib/
cp -p -L /lib/libz.so.1 lib/
cp -p /usr/share/file/magic* etc/
mkdir usr/share/misc -p
ln -s misc usr/share/file
ln -s ../../../etc/magic usr/share/misc/magic
ln -s ../../../etc/magic.mgc usr/share/misc/magic.mgc
ln -s ../../../etc/magic.mime usr/share/misc/magic.mime
rm ./scripts/init-top/plymouth ./scripts/init-bottom/plymouth
touch ./displaymessage
cat > ./displaymessage << EOF
#!/bin/sh
while [ a = a ]
do
printf "\n\033[7;31mYou can look upper by pushing SHIFT and PageUp keys at the same time\033[0m\n"
sleep 15
done
EOF
gedit ./init
find .|cpio -H newc -o|gzip -9 > ../initrd.img-kiyo2
echo "initrd.img-kiyo2 is generated. Please use it with /boot/vmlinuz-$(uname -r)"
exit 0



のファイルを作成して、適当な名前にします。たとえば、
makekiyoshishelp.sh
として、適当なディレクトリに保存します。たとえば、
/home/ユーザー名
が良いでしょう。
そのファイルを保存したディレクトリで、
$ bash ./makekiyoshishelp.sh
で実行します。
すると、しばらくして、テキストエディタが開くので、以下の内容:


#!/bin/sh

[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid none /sys
mount -t proc -o nodev,noexec,nosuid none /proc
# Some things don't work properly without /etc/mtab.
ln -sf /proc/mounts /etc/mtab

grep -q '\<quiet\>' /proc/cmdline || echo "Loading, please wait..."

# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
if ! mount -t devtmpfs -o mode=0755 none /dev; then
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
mount -t tmpfs -o mode=0755 udev /dev
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
[ -e /dev/null ] || mknod /dev/null c 1 3
fi
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true
> /dev/.initramfs-tools
mkdir /dev/.initramfs

# Export the dpkg architecture
export DPKG_ARCH=
. /conf/arch.conf

# Set modprobe env
export MODPROBE_OPTIONS="-qb"

# Export relevant variables
export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
export UBIMTD=
export break=
export init=/sbin/init
export quiet=n
export readonly=y
export rootmnt=/root
export debug=
export panic=
export blacklist=
export resume=
export resume_offset=

# Bring in the main config
. /conf/initramfs.conf
. /scripts/functions

[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"

# export BOOT variable value for compcache,
# so we know if we run from casper
export BOOT

# Don't do log messages here to avoid confusing usplash
run_scripts /scripts/init-top

[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
load_modules
[ "$quiet" != "y" ] && log_end_msg

[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
run_scripts /scripts/init-premount
[ "$quiet" != "y" ] && log_end_msg

[ -d /mnt ] || mkdir -m 0755 /mnt
rd () {
printf "\033[31m"
}
green () {
printf "\033[32m"
}
reverse () {
printf "\033[7m"
}
black () {
printf "\033[0m"
}
redr () {
printf "\033[7;31m"
}
greenr () {
printf "\033[7;32m"
}
recho () {
printf "\033[31m$*\n\033[0m"
}
gecho () {
printf "\033[32m$*\n\033[0m"
}
rdecho () {
printf "\033[7;31m$*\n\033[0m"
}
grecho () {
printf "\033[7;32m$*\n\033[0m"
}
sh /displaymessage &
grecho ==========================
grecho "Please wait until all the device you want to boot is recognized and then push ENTER key."
grecho ==========================
read -s a
reverse
echo $a
black
deviceslist=$(blkid|cut -d: -f1)
okdeviceslist=""
for a in $deviceslist
do
umount -l /mnt 2>/dev/null
mount -t $(blkid $a|sed -e "s/.*TYPE=\"//"|sed -e "s/\".*//") $a /mnt 2>/dev/null || continue
okdeviceslist="${okdeviceslist} $a"
umount -l /mnt 2>/dev/null
done
i=0
grecho ==========================
grecho "The device file names and information of partitions will be recognized and are shown below."
echo
for a in ${okdeviceslist}
do
reverse
echo $i":"$(blkid|grep "${a}:")
black
i=$(expr $i + 1)
done
echo
rdecho "You can look upper by pushing SHIFT and PageUp keys at the same time."
grecho "Please type the number of the device file name of the root partition of Ubuntu you want to boot."
panipani () {
rdecho "DAMESSU! I will try to make you use terminal"
PS1='(kiyoChelp) ' /bin/sh -i </dev/console >/dev/console 2>&1
rdecho "Please reboot by pressing CTRL+ALT+DEL or ATL+SysRq+R,S,E,I,U,B"
exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
panic "Could not execute run-init."
}
readloop () {
while [ a = a ]
do
read -s a
reverse
echo $a
black
if [ $a -ge 0 ]
then
if [ $? = 1 ]
then
rdecho "Please type number"
continue
elif [ $a -lt "$(echo $*|tr ' ' '\n'|wc -l)" ]
then
break
else
rdecho "Please type number smaller than $(echo $*|tr ' ' '\n'|wc -l)"
continue
fi
rdecho "Please type number larger than 0 or 0"
fi
done
}
checkelf () {
if [ "a$(file $1|grep -i ELF)" = "a" ]
then
elfarg=""
else
elfarg=" --args-linux "
fi
}
readloop "${okdeviceslist}"
device=$(echo ${okdeviceslist}|cut -d" " -f $(expr $a + 1))
grecho "You selected $a:$device"
mount -t $(blkid $device|sed -e "s/.*TYPE=\"//"|sed -e "s/\".*//") $device /mnt
greenr
echo "If you want to search Grub settings, please type y"
echo "If you want to get into busybox, please type zzz"
read -s aa
reverse
echo $aa
black
if [ -n "$(echo $aa|grep y)" ]
then
fakemore () {
step=$1
num=1
ln=$(wc -l $2 |sed "s/^[^0-9]*//"|sed "s/[^0-9]*$//")
while [ $num -lt $ln ]
do
reverse
sed -n "$num,$(expr $num + $step) p" $2
greenr
echo -n "## Please enter q to quit displaying: "
reverse
read b
black
if [ a"$b" = "aq" ]
then
break
fi
num=$(expr $num + $step + 1)
done
return
}
settingchange () {
while [ a = a ]
do
greenr
kernel=$(echo $kernel|sed -e "s/(hd[0-9]*,[0-9]*)//")
initrd=$(echo $initrd|sed -e "s/(hd[0-9]*,[0-9]*)//")
echo "kernel is: $kernel"
if [ -z "$(echo $initrd|tr -d " ")" ]
then
echo "initrd line is not set."
else
echo "initrd is: $initrd"
fi
echo "kernel option is: $kernelopts"
redr
echo -n "Do you want to boot with the above settings? (nothing:yes, c:edit settings, any other: quit selecting this menuentry) : "
read -s q
reverse
echo $q
black
if [ "a$q" = "a" -o "a$q" = "ay" -o "a$q" = "ayes" ]
then
checkelf /mnt/$kernel
if [ "a$initrd" = "a" ]
then
kexec -l /mnt${kernel} $elfarg --append="${kernelopts}"
else
kexec -l /mnt${kernel} $elfarg --initrd=/mnt${initrd} --append="${kernelopts}"
fi
kexec -e
sleep 10
panipani
elif [ "a$q" = "ac" ]
then
redr
echo -n "Type the kernel file in full path (nothing:unchanged): "
black
read q
reverse
echo $q
black
if [ "a$q" != "a" ]; then kernel=$q;fi
redr
echo -n "Type the initrd file in full path (nothing:unchanged. to delete, type \"d\"): "
black
read q
reverse
echo $q
black
if [ "a$q" = "ad" ]
then
initrd=""
elif [ "a$q" != "a" ]
then
initrd=$q
fi
redr
echo -n "Type the kernel option (nothing:unchanged): "
black
read q
reverse
echo $q
black
if [ "a$q" != "a" ]; then kernelopts=$q;fi
else
break
fi
done
}
if [ -e /mnt/boot/grub/grub.cfg -o -e /mnt/grub/grub.cfg ]
then
[ -e /mnt/boot/grub/grub.cfg ]&& c="/boot"||c=""
grecho "$c/grub/grub.cfg (GRUB2 settings file)is found."
while [ a = a ]
do
greenr
echo -n "? 1) show $c/grub/grub.cfg, 2) select menuentry, 3)end this function : "
read -s a
reverse
echo $a
black
if [ "$a" = 1 ]
then
fakemore 10 /mnt$c/grub/grub.cfg
elif [ "$a" = 2 ]
then
grep menuentry /mnt$c/grub/grub.cfg | sed -e "s/^[^a-zA-Z0-9#]*menuentry *//" > /tmp/menuentries
i=0
num=$(wc -l /tmp/menuentries|tr -s " "|sed -e "s/ *//"|cut -d" " -f1)
reverse
while [ $i -lt $num ]
do
i=$(expr $i + 1)
echo $(expr $i - 1):$(sed -n -e "${i}p" /tmp/menuentries)
done
rdecho "You can look upper by pushing SHIFT and PageUp keys at the same time."
grecho "Please type the number of the menu you want to look inside"
readloop "$(cat /tmp/menuentries|tr -d ' ')"
grecho "=========================================="
grecho "The contents is:"
echo
num=$(grep -A15 -e "$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt$c/grub/grub.cfg|grep -n ^}|sed -n -e 1p|cut -d: -f1)
if [ -n "$num" ]
then
num=$(expr $num - 1)
else
num=15
fi
grep -A $num -e "$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt$c/grub/grub.cfg > /tmp/grubcfg1
reverse
cat /tmp/grubcfg1
black
kernelline=$(grep ^[^a-zA-Z0-9#]*linux /tmp/grubcfg1|sed -n -e 1p)
initrdline=$(grep ^[^a-zA-Z0-9#]*initrd /tmp/grubcfg1|sed -n -e 1p)
kernel=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*linux *//"|cut -f1 -d" ")
kernelopts=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*linux *//"|sed -e "s/$(echo $kernel|sed -e 's/\//\\\//g')//"|tr -s " ")
initrd=$(echo $initrdline|sed -e "s/^[^a-zA-Z0-9#]*initrd *//"|cut -f1 -d" ")
settingchange
elif [ "$a" = 3 ]
then
break
fi
done
fi
if [ -e /mnt/boot/grub/menu.lst -o -e /mnt/grub/menu.lst ]
then
[ -e /mnt/boot/grub/menu.lst ]&& c="/boot"||c=""
grecho "GRUB legacy settings file $c/grub/menu.lst is found."
while [ a = a ]
do
greenr
echo -n "? 1) show $c/grub/menu.lst, 2) select title, 3)end this function : "
read -s a
reverse
echo $a
black
if [ "$a" = 1 ]
then
fakemore 10 /mnt$c/grub/menu.lst
elif [ "$a" = 2 ]
then
grep title /mnt$c/grub/menu.lst | sed -e "s/^[^a-zA-Z0-9#]*title *//" > /tmp/menuentries
i=0
num=$(wc -l /tmp/menuentries|tr -s " "|sed -e "s/^ *//"|cut -d" " -f1)
while [ $i -lt $num ]
do
i=$(expr $i + 1)
reverse
echo $(expr $i - 1):$(sed -n -e "${i}p" /tmp/menuentries)
black
done
grecho "Please type the number of the menu you want to look inside"
readloop "$(cat /tmp/menuentries|tr -d ' ')"
grecho "=========================================="
grecho "The contents is:"
echo
num=$(grep -A15 -e "$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt$c/grub/menu.lst|grep -n ^[^a-zA-Z0-9#]*title|sed -n -e "2p"|cut -d: -f1)
if [ -n "$num" ]
then
num=$(expr $num - 2)
else
num=15
fi
grep -A $num -e "^[^a-zA-Z0-9#]*title *$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt$c/grub/menu.lst > /tmp/grubcfg1
reverse
cat /tmp/grubcfg1
black
kernelline=$(grep ^[^a-zA-Z0-9#]*kernel /tmp/grubcfg1|sed -n -e 1p)
initrdline=$(grep ^[^a-zA-Z0-9#]*initrd /tmp/grubcfg1|sed -n -e 1p)
kernel=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*kernel *//"|cut -f1 -d" ")
kernelopts=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*kernel *//"|sed -e "s/$(echo $kernel|sed -e 's/\//\\\//g')//"|tr -s " ")
initrd=$(echo $initrdline|sed -e "s/^[^a-zA-Z0-9#]*initrd *//"|cut -f1 -d" ")
settingchange
elif [ "$a" = 3 ]
then
break
fi
done
fi
if [ -e /mnt/menu.lst ]
then
grecho "GRUB legacy settings file /menu.lst is found."
while [ a = a ]
do
grecho "? 1) show /menu.lst, 2) select title, 3)end this function : "
read -s a
reverse
echo $a
black
if [ "$a" = 1 ]
then
fakemore 10 /mnt/menu.lst
elif [ "$a" = 2 ]
then
grep title /mnt/menu.lst | sed -e "s/^[^a-zA-Z0-9#]*title *//" > /tmp/menuentries
i=0
num=$(wc -l /tmp/menuentries|tr -s " "|sed -e "s/^ *//"|cut -d" " -f1)
while [ $i -lt $num ]
do
i=$(expr $i + 1)
reverse
echo $(expr $i - 1):$(sed -n -e "${i}p" /tmp/menuentries)
black
done
grecho "Please type the number of the menu you want to look inside"
readloop "$(cat /tmp/menuentries|tr -d ' ')"
grecho "=========================================="
grecho "The contents is:"
grecho
num=$(grep -A15 -e "$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt/menu.lst|grep -n ^[^a-zA-Z0-9#]*title|sed -n -e 2p|cut -d: -f1)
if [ -n "$num" ]
then
num=$(expr $num - 2)
else
num=15
fi
grep -A $num -e "^[^a-zA-Z0-9#]*title *$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt/menu.lst > /tmp/grubcfg1
reverse
cat /tmp/grubcfg1
black
kernelline=$(grep ^[^a-zA-Z0-9#]*kernel /tmp/grubcfg1|sed -n -e 1p)
initrdline=$(grep ^[^a-zA-Z0-9#]*initrd /tmp/grubcfg1|sed -n -e 1p)
kernel=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*kernel *//"|cut -f1 -d" ")
kernelopts=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*kernel *//"|sed -e "s/$(echo $kernel|sed -e 's/\//\\\//g')//"|tr -s " ")
initrd=$(echo $initrdline|sed -e "s/^[^a-zA-Z0-9#]*initrd *//"|cut -f1 -d" ")
settingchange
elif [ "$a" = 3 ]
then
break
fi
done
fi
if [ -e /mnt/boot/syslinux/syslinux.cfg -o -e /mnt/syslinux/syslinux.cfg -o -e /mnt/syslinux.cfg -o -e /mnt/boot/extlinux.conf -o -e /mnt/extlinux.conf ]
then
[ -e /mnt/boot/syslinux/syslinux.cfg ]&& c="/boot/syslinux" && cc="syslinux.cfg"
[ -e /mnt/syslinux/syslinux.cfg ]&& c="/syslinux" && cc="syslinux.cfg"
[ -e /mnt/syslinux.cfg ]&& c="" && cc="syslinux.cfg"
[ -e /mnt/boot/extlinux.conf ]&& c="/boot" && cc="extlinux.conf"
[ -e /mnt/extlinux.conf ]&& c="" && cc="extlinux.conf"
grecho "$(echo $cc|sed -e "s/\..*//") settings file $c/$cc is found."
syslinuxfiles="/mnt$c/$cc"
addsyslinuxconf () {
aaa=$(grep -i -e "include" $1|sed -e "s/include//")
if [ -z "$aaa" ];then return;fi
for bb in $aaa
do
if [ -n "$(file /mnt$c/$bb|grep -i ASCII|grep -i text)" ]
then
syslinuxfiles="$syslinuxfiles /mnt$c/$bb"
addsyslinuxconf /mnt$c/$bb
fi
done
}
addsyslinuxconf /mnt$c/$cc
grecho "$syslinuxfiles is/are found as configuration file(s)."
while [ a = a ]
do
grecho "? 1) show syslinux configuration file(s), 2) select menuentry, 3)end this function : "
read -s a
reverse
echo $a
black
if [ "$a" = 1 ]
then
for a in $syslinuxfiles
do
fakemore 10 $a
done
elif [ "$a" = 2 ]
then
grep -H -i ^[^a-zA-Z0-9#]*label\ * $syslinuxfiles > /tmp/menuentries
i=0
num=$(wc -l /tmp/menuentries|tr -s " "|sed -e "s/^ *//"|cut -d" " -f1)
while [ $i -lt $num ]
do
i=$(expr $i + 1)
reverse
echo $(expr $i - 1):$(sed -n -e "${i}p" /tmp/menuentries)
black
done
grecho "Please type the number of the menu you want to look inside"
readloop "$(cat /tmp/menuentries|tr -d ' ')"
grecho "=========================================="
grecho "The contents is:"
echo
num=$(grep -A15 -e "$(sed -n -e $(expr $a + 1)p /tmp/menuentries|cut -d: -f2)$" "$(sed -n -e $(expr $a + 1)p /tmp/menuentries|cut -d: -f1)"|grep -i -n ^[^a-zA-Z0-9#]*label\ *|sed -n -e 2p|cut -d: -f1)
if [ -n "$num" ]
then
num=$(expr $num - 2)
else
num=15
fi
grep -i -A $num -e "^[^a-zA-Z0-9#]*$(sed -n -e $(expr $a + 1)p /tmp/menuentries|cut -d: -f2)$" "$(sed -n -e $(expr $a + 1)p /tmp/menuentries|cut -d: -f1)" > /tmp/grubcfg1
# the above line has problem when label line contains ":" or file name contains ":".
reverse
cat /tmp/grubcfg1
black
kernelline=$(grep -i ^[^a-zA-Z0-9#]*kernel /tmp/grubcfg1|sed -n -e 1p)
# linux or LINUX line should be taken into account.
initrdline=$(grep -i ^[^a-zA-Z0-9#]*initrd /tmp/grubcfg1|sed -n -e 1p)
kernel=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*kernel *//"|cut -f1 -d" ")
kernelopts=$(grep -i ^[^a-zA-Z0-9#]*append /tmp/grubcfg1|sed -e "s/^[^a-zA-Z0-9#]*append *//"|sed -e "s/^[^a-zA-Z0-9#]*APPEND *//"|tr -s " ")
if [ "a$(echo $kernelopts|grep -i initrd=)" = "a" ]
then
initrd=$(echo $initrdline|sed -e "s/^[^a-zA-Z0-9#]*initrd *//"|cut -f1 -d" ")
else
initrd=$(echo $kernelopts|sed -e "s/.*initrd=//"|cut -d" " -f1)
fi
settingchange
elif [ "$a" = 3 ]
then
break
fi
done
fi
if [ -f /mnt/etc/lilo.conf ]
then
grecho "/etc/lilo.conf (LILO settings file)is found."
while [ a = a ]
do
greenr
echo -n "? 1) show /etc/lilo.conf, 2) select menuentry, 3)end this function : "
read -s a
reverse
echo $a
black
if [ "$a" = 1 ]
then
fakemore 10 /mnt/etc/lilo.conf
elif [ "$a" = 2 ]
then
grep label= /mnt/etc/lilo.conf | sed -e "s/^[^a-zA-Z0-9#]*label=//" > /tmp/menuentries
i=0
num=$(wc -l /tmp/menuentries|tr -s " "|sed -e "s/ *//"|cut -d" " -f1)
reverse
while [ $i -lt $num ]
do
i=$(expr $i + 1)
echo $(expr $i - 1):$(sed -n -e "${i}p" /tmp/menuentries)
done
rdecho "You can look upper by pushing SHIFT and PageUp keys at the same time."
grecho "Please type the number of the menu you want to look inside"
readloop "$(cat /tmp/menuentries|tr -d ' ')"
grecho "=========================================="
grecho "The contents is:"
echo
num1=$(sed -e $(grep -n -e "label=$(sed -n -e $(expr $a + 1)p /tmp/menuentries)$" /mnt/etc/lilo.conf|cut -d: -f1)q /mnt/etc/lilo.conf|grep -n label=|cut -d: -f1|sort -n -r|sed -n -e 1p)
num2=$(grep -n image= /mnt/etc/lilo.conf|cut -d: -f1|grep -A 1 "${num1}"|sed -n -e 2p)
sed -n -e "${num1},$(expr ${num2} - 1)p" /mnt/etc/lilo.conf > /tmp/grubcfg1
reverse
cat /tmp/grubcfg1
black
initrdline=$(grep initrd= /tmp/grubcfg1|sed -n -e 1p)
initrd=$(echo $initrdline|sed -e "s/^[^a-zA-Z0-9#]*initrd *//"|cut -f1 -d" ")
kernelline=$(grep image= /tmp/grubcfg1|sed -n -e 1p)
kernel=$(echo $kernelline|sed -e "s/^[^a-zA-Z0-9#]*image=//"|cut -f1 -d" ")
kernelopts="$(grep append= /tmp/grubcfg1|sed -e "s/^[^a-zA-Z0-9#]*append=//"|sed -e "s/\"//g") $(grep read-write /tmp/grubcfg1) $(grep read-only /tmp/grubcfg1) $(grep ramdisk= /tmp/grubcfg1) $(grep literal= /tmp/grubcfg1|sed -e "s/^[^a-zA-Z0-9#]*literal=//"|sed -e "s/\"//g")"
if [ -n "$(grep root=current /tmp/grubcfg1)" ]
then
kernelopts="$(grep root= /mnt/etc/lilo.conf|sed -n -e 1p) $kernelopts"
else
kernelopts="$(grep root= /tmp/grubcfg1) $kernelopts"
fi
settingchange
elif [ "$a" = 3 ]
then
break
fi
done
fi
if [ -f /mnt/ubuntu/disks/root.disk ]
then
grecho "/ubuntu/disks/root.disk is found. Maybe this is WUBI file."
device=$(grep " /mnt " /proc/mounts|cut -d" " -f1)
mkdir /mntroot
umount $device
mount -t $(blkid $device|sed -e "s/.*TYPE=\"//"|sed -e "s/\".*//") $device /mntroot
mount -o loop /mntroot/ubuntu/disks/root.disk /mnt
if [ $? = 0 ]
then
kernel="/vmlinuz"
initrd="/initrd.img"
kernelopts="root=UUID=$(blkid $device|sed -e 's/^.*UUID=\"//'|sed -e 's/\".*//') loop=/ubuntu/disks/root.disk ro"
settingchange
else
rdecho "$device /ubuntu/disks/root.disk is failed to be mounted."
fi
fi
fi
if [ -n "$(echo $aa|grep zzz)" ]
then
PS1='(kiyoChelp) ' /bin/sh -i </dev/console >/dev/console 2>&1
fi
grecho "======================================"
grecho "The following kernels seems to be available."
kernels1=$(ls /mnt/boot/ -1|grep vmlinuz)
kernels=""
i=0
for a in $kernels1
do
if [ -n "$(ls -1 /mnt/boot/initrd*$(echo $a|cut -c9-))*" ]
then
reverse
echo $i":"$(echo $kernels1|cut -d" " -f $(expr $i + 1))
black
i=$(expr $i + 1)
kernels="$kernels $a"
fi
done
grecho "Please type the number of the kernel you want to boot."
readloop "${kernels}"
kernel=$(echo ${kernels}|cut -d" " -f $(expr $a + 1))
grecho "You selected $a:$kernel"
grecho "The following option is suggested to pass to the kernel:"
reverse
echo "root=UUID=$(blkid|grep "$device:"|sed -e "s/^.*UUID=\"//"|sed -e "s/\".*//") ro"
grecho ""
grecho "Please enter commandline parameter to pass to kernel."
grecho "If you accept the suggested option, please type nothing."
read -s a
reverse
echo $a
black
checkelf /mnt/boot/$kernel
if [ -n "$a" ]
then
kexec -l /mnt/boot/$kernel $elfarg --append="$a" --initrd=$(ls /mnt/boot/initrd*$(echo $kernel|cut -c9-)*|tail -n1)
kexec -e
else
kexec -l /mnt/boot/$kernel $elfarg --append="root=UUID=$(blkid|grep "$device:"|sed -e "s/^.*UUID=\"//"|sed -e "s/\".*//") ro" --initrd=$(ls /mnt/boot/initrd*$(echo $kernel|cut -c9-)*|tail -n1)
kexec -e
fi
umount -l /mnt
panipani



までに置き換えて、保存して、テキストエディタを終了します。
すると、
initrd.img-kiyo2 is generated. Please use it with /boot/vmlinuz-2.6.・・・
のように表示され、これでinitramfs、つまりkiyoshi's helpは完成。

あとはkiyoshi's help ver.13
「grub4dosを利用できるようにする」以降を実施すれば良いです。
プロフィール

kiyoshi

Author:kiyoshi
FC2ブログへようこそ!

最新記事
最新コメント
最新トラックバック
月別アーカイブ
カテゴリ
検索フォーム
RSSリンクの表示
リンク
ブロとも申請フォーム

この人とブロともになる

QRコード
QRコード
since 2011/9/25
現在の閲覧者数:
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。