- 论坛徽章:
- 0
|
#!/bin/bash
export DEST=$1
export HOSTNAME=$2
if test "$HOSTNAME" = "" ; then
HOSTNAME="olive"
fi
install -d $DEST/{sys,proc}
install -d $DEST/{bin,boot/grub,dev,etc/{opt,sysconfig},home,lib,mnt}
install -d $DEST/{sbin,srv,usr/local,var,opt}
install -d $DEST/root -m 0750
install -d $DEST/tmp $DEST/var/tmp -m 1777
install -d $DEST/media/{floppy,cdrom}
install -d $DEST/usr/{bin,include,lib,sbin,share,src}
ln -s share/{man,doc,info} $DEST/usr
install -d $DEST/usr/share/{doc,info,locale,man}
install -d $DEST/usr/share/{misc,terminfo,zoneinfo}
install -d $DEST/usr/share/man/man{1..8}
install -d $DEST/usr/local/{bin,etc,include,lib,sbin,share,src}
ln -s share/{man,doc,info} $DEST/usr/local
install -d $DEST/usr/local/share/{doc,info,locale,man}
install -d $DEST/usr/local/share/{misc,terminfo,zoneinfo}
install -d $DEST/usr/local/share/man/man{1,2,3,4,5,6,7,8}
install -d $DEST/var/{lock,log,mail,run,spool}
install -d $DEST/var/{opt,cache,lib/{misc,locate},local}
install -d $DEST/opt/{bin,doc,include,info}
install -d $DEST/opt/{lib,man/man{1,2,3,4,5,6,7,8}}
install -d $DEST/initrd
install -d $DEST/olive/{package,system/{package,release},dist}
echo "root:$1$XUT/..g1$DlEPZUFfhyJCXnRr3xqvq/:13215:0:99999:7:::" > $DEST/etc/shadow
echo "root:x:13215:0:99999:7:::" > $DEST/etc/shadow-
echo "root:x:0:0:root:/root:/bin/bash" > $DEST/etc/passwd
echo "root:x:0:0:root:/root:/bin/bash" > $DEST/etc/passwd-
echo "root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:" > $DEST/etc/group
touch $DEST/var/run/utmp $DEST/var/log/{btmp,lastlog,wtmp}
chgrp utmp $DEST/var/run/utmp $DEST/var/log/lastlog
chmod 664 $DEST/var/run/utmp $DEST/var/log/lastlog
mknod -m 600 $DEST/dev/console c 5 1
mknod -m 666 $DEST/dev/null c 1 3
FSTAB=`grep " $DEST " /proc/mounts | gawk -F\ '{print \$1" / "\$3}'`
echo $FSTAB " defaults 1 1
proc
/proc proc
defaults
0 0
sysfs
/sys sysfs
defaults
0 0
devpts
/dev/pts devpts gid=4,mode=620
0 0
shm
/dev/shm tmpfs
defaults
0 0
usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0
" > $DEST/etc/fstab
echo "
127.0.0.1 localhost $HOSTNAME
" > $DEST/etc/hosts
echo "HOSTNAME=$HOSTNAME" > $DEST/etc/sysconfig/network
echo "
# Begin /boot/grub/menu.lst
# By default boot the first menu entry.
default 0
# Allow 30 seconds before booting the default.
timeout 30
# Use prettier colors.
color green/black light-green/black
" > $DEST/boot/grub/menu.lst
echo `grep " $DEST " /proc/mounts | gawk -F\ '{print \$1}'` > $DEST/etc/grub.dev
unset DEST
unset HOSTNAME
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21352/showart_139724.html |
|