blob: 509f8582c5d29ead37b6a42d7a3db9ef3a81c101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
# This Script builds a Slackware domU Xen Guest on a Slackware host,
# Although it might work correctly, this script is intended as a template, so
# simplicity is the priority here.
# Written by Chris Abela <chris.abela@maltats.com>, 20100308
# Updated by mario <mario@slackverse.org>, 2010-2012
set -e
KERNEL=${KERNEL:-3.2.29}
# Build an image for the root file system and another for the swap
# Default values : 8GB and 500MB resepectively.
ROOT_MB=${ROOT_MB:-8000}
SWAP_MB=${SWAP_MB:-500}
dd if=/dev/zero of=slackware.img bs=1M count=0 seek=$ROOT_MB
mkfs.ext4 -F slackware.img
dd if=/dev/zero of=swap_file bs=1M count=0 seek=$SWAP_MB
mkswap swap_file
# Make a mountpoint for the root file system and mount it
mkdir -p mnt
mount -o loop slackware.img mnt
# Make a mountpoint for proc and mount it
mkdir -p mnt/proc
mount --bind /proc mnt/proc
##############################################################################
# #
# IMPORTANT : This assumes that you have mounted your Slackware DVD on #
# /media/SlackDVD #
# #
##############################################################################
# This will install a domU with the listed packages
for i in a ap d e f k l n t tcl; do
installpkg --root mnt/ /media/SlackDVD/slackware*/$i/*.t?z
done
chroot mnt /sbin/ldconfig
# create fstab
cat >mnt/etc/fstab <<EOF
/dev/xvda2 swap swap defaults 0 0
/dev/xvda1 / ext4 defaults 1 1
#/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
EOF
chroot mnt /usr/sbin/timeconfig # Set the time
chroot mnt /sbin/netconfig # Set the network
chroot mnt /usr/bin/passwd # Set root's password
# Before we could use xencons=tty and leave inittab and securetty files intact,
# but that stopped working as of Xen-4.x, so this has to be fixed by adding hvc0.
sed -i 's/^\(c[1-6]:123\)/#\1/' /etc/inittab
echo -e '\nc1:12345:respawn:/sbin/agetty 38400 hvc0 linux' >> /etc/inittab
echo -e '\nhvc0' >> /etc/securetty
# This will save us an alarming (yet harmless) warning
(cd mnt/lib/modules
if [ -d $KERNEL-smp ]; then
# for Slack32
ln -s $KERNEL-smp $KERNEL-xen
else
# for Slack64
ln -s $KERNEL $KERNEL-xen
fi
)
# unmount proc and the filesystem
umount mnt/proc
umount mnt
|