about summary refs log tree commit diff stats
path: root/core/scripts/install.sh
blob: 495b3272d546c8ba3f88df8809d463dd2f404239 (plain) (blame)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
# Set Global Vars

DIR=$(dirname "$PWD");
DIR_PRT=$(dirname "$DIR")"/c9-ports";
DIR_CONF=$DIR"/conf"

printf "CHROOT="$CHROOT"\n";
printf "DIR="$DIR"\n";
printf "DIR_CONF="$DIR_CONF"\n";
printf "DIR_PRT="$DIR_PRT"\n";
read PAUSE

printf "1.1.2 EFI block; (/dev/sda1):\n"
#read BLK_EFI
BLK_EFI="/dev/sda1"

printf "1.1.2 boot block; (/dev/sda2):\n"
#read BLK_BOOT
BLK_BOOT="/dev/sda2"

printf "1.1.2 root block; (/dev/sda3):\n"
#read BLK_ROOT
BLK_ROOT="/dev/sda3"
#
printf "1.1.2 var block; (/dev/sda4):\n"
#read BLK_VAR
BLK_VAR="/dev/sda4"
#
printf "1.1.2 usr block; (/dev/sda6):\n"
#read BLK_USR
BLK_USR="/dev/sda6"
#
printf "1.1.2 home block; (/dev/sda7):\n"
#read BLK_HOME
BLK_HOME="/dev/sda7"
#
printf "1.1.2 ports block; (/dev/sda8):\n"
#read BLK_PRT
BLK_PRT="/dev/sda8"

printf "1.1.2 swap block; (/dev/sda9):\n"
#read BLK_SWP
BLK_SWP="/dev/sda9"

printf "1.1.3 mount point to chroot (/mnt):\n"
#read CHROOT
CHROOT="/mnt"

#manual_install() {

    echo "1.1.2 Creating File System on $BLK_EFI with fat32:"
    mkfs.fat -F 32 $BLK_EFI
    echo "1.1.2 Creating File System on $BLK_BOOT with ext4:"
    mkfs.ext4 $BLK_BOOT
    echo "1.1.2 Creating File System on $BLK_ROOT with ext4:"
    mkfs.ext4 $BLK_ROOT
    echo "1.1.2 Creating File System on $BLK_VAR with ext4:"
    mkfs.ext4 $BLK_VAR
    echo "1.1.2 Creating File System on $BLK_USR with ext4:"
    mkfs.ext4 $BLK_USR
    echo "1.1.2 Creating File System on $BLK_HOME with ext4:"
    mkfs.ext4 $BLK_HOME
#    echo "1.1.2 Creating File System on $BLK_PRT with ext4:"
#    mkfs.ext4 $BLK_PRT
    echo "1.1.2 Creating Swap File System on $BLK_SWP:"
    #mkswap $BLK_SWP

#}


#prepare_target(){

    printf "1.1.3 mount point to chroot (/mnt):\n"
    mount $BLK_ROOT $CHROOT

    mkdir -p $CHROOT/boot
    mkdir -p $CHROOT/var
    mkdir -p $CHROOT/usr
    mkdir -p $CHROOT/media
    mkdir -p $CHROOT/home

    mkdir -p $CHROOT/dev
    mkdir -p $CHROOT/tmp
    mkdir -p $CHROOT/proc
    mkdir -p $CHROOT/sys

    mount $BLK_BOOT $CHROOT/boot
    mkdir -p $CHROOT/boot/efi
    mount $BLK_EFI $CHROOT/boot/efi

    mount $BLK_VAR $CHROOT/var
    mkdir -p $CHROOT/var/lib/pkg

    mount $BLK_USR $CHROOT/usr
    mkdir -p $CHROOT/usr/ports
#    mount $BLK_PRT $CHROOT/usr/ports
    mount $BLK_HOME $CHROOT/home

#install_crux() {

    echo "1.1.4 Create core.lst and install pkgadd"
    for p in /media/crux/core/*; do echo $p >> $CHROOT/core.lst; done

    tar xf "/media/crux/core/pkgutils#5.36-2.pkg.tar.xz" usr/bin/pkgadd -O > $CHROOT/pkgadd

    chmod +x $CHROOT/pkgadd

    echo "1.1.4 File core.lst complete, review list of packages before continue..."
    read PAUSE
    vim $CHROOT/core.lst

    echo "1.1.4 Starting install"
    touch $CHROOT/var/lib/pkg/db

    cd $CHROOT
    while read line; do
        printf "Installing $line;\n"
        $CHROOT/pkgadd -f -r $CHROOT $line
    done < core.lst

    rm $CHROOT/pkgadd
    rm $CHROOT/core.lst

    echo "1.1.5. Install extra packages;"

	mkdir $CHROOT/usr/ports/packages
	cp /media/crux/core/* $CHROOT/usr/ports/packages
	cp /media/crux/opt/* $CHROOT/usr/ports/packages
	cp /media/crux/xorg/* $CHROOT/usr/ports/packages

	echo "Installing $CHROOT/usr/ports/packages/fakeroot#1.20.2-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/fakeroot#1.20.2-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/dbus#1.10.2-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/dbus#1.10.2-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/expat#2.1.0-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/expat#2.1.0-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/libnl#3.2.27-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libnl#3.2.27-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/libpng#1.6.19-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libpng#1.6.19-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/freetype#2.6.1-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/freetype#2.6.1-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/libffi#3.2.1-2.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libffi#3.2.1-2.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/sqlite3#3.9.2-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/sqlite3#3.9.2-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/python#2.7.10-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/python#2.7.10-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/glib#2.46.2-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/glib#2.46.2-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/grub2#2.00-7.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/grub2#2.00-7.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/grub2-efi#2.00-4.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/grub2-efi#2.00-4.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/wireless-tools#29-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/wireless-tools#29-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/wpa_supplicant#2.5-2.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/wpa_supplicant#2.5-2.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/lvm2#2.02.133-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/lvm2#2.02.133-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/mdadm#3.3.4-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/mdadm#3.3.4-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/efivar#0.21-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/efivar#0.21-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/efibootmgr#0.12-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/efibootmgr#0.12-1.pkg.tar.xz"
	echo "Installing $CHROOT/usr/ports/packages/dosfstools#3.0.26-1.pkg.tar.xz"
	$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/dosfstools#3.0.26-1.pkg.tar.xz"

    echo "1.1.6. Install extra ports;\n"

    mkdir $CHROOT/usr/ports/c9-ports
    cp -r $DIR_PRT/* $CHROOT/usr/ports/c9-ports/

    echo "1.1.7. dns resolver, copy resolv.conf;\n"
    cp /etc/resolv.conf $CHROOT/etc

    echo "1.1.8. Install Handbook\n"
    cp /media/crux/handbook.txt $CHROOT/root/

    echo "1.1.9. Install Skeletons\n"
    cp -r $DIR_CONF/skel $CHROOT/etc/
#}
printf "Ready to chroot $CHROOT /bin/bash \n"