Browse code

Remove tools.tar from iso, install rpms without using chroot

Vinay Kulkarni authored on 2015/06/21 10:56:17
Showing 7 changed files
... ...
@@ -207,11 +207,21 @@ class Installer(object):
207 207
 
208 208
     def install_package(self,  package_name):
209 209
         rpm_params = ''
210
-        
210
+
211
+        os.environ["RPMROOT"] = self.photon_root + '/RPMS'
212
+        rpm_params = rpm_params + ' --force '
213
+        rpm_params = rpm_params + ' --root ' + self.photon_root
214
+
211 215
         if ('type' in self.install_config and (self.install_config['type'] in ['micro', 'minimal'])) or self.install_config['iso_system']:
212 216
             rpm_params = rpm_params + ' --excludedocs '
213 217
 
214
-        process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, self.install_package_command, '-w', self.photon_root, package_name, rpm_params],  stdout=self.output)
218
+        if self.iso_installer:
219
+            rpm_params = rpm_params + ' --dbpath ' + '/var/lib/rpm '
220
+        else:
221
+            rpm_params = rpm_params + ' --dbpath ' + self.photon_root + '/var/lib/rpm '
222
+
223
+        process = subprocess.Popen([self.install_package_command, '-w', self.photon_root, package_name, rpm_params],  stdout=self.output)
224
+
215 225
         return process.wait()
216 226
 
217 227
     def execute_modules(self, phase):
... ...
@@ -22,15 +22,13 @@ LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"	#	set log file name
22 22
 
23 23
 # Grab the name of the iso file 
24 24
 if [ $# -lt 2 ]
25
-	then
26
-		echo "Usage : " $0 " <output-iso-with-path>  <tools path>"
27
-		exit 1
25
+then
26
+    echo "Usage : " $0 " <output-iso-with-path>  <rpms-path> <pkg-list-path>"
27
+    exit 1
28 28
 fi
29 29
 ISO_OUTPUT_NAME=$1
30
-TOOLS_PATH=$2
31
-RPMS_PATH=$3
32
-PACKAGE_LIST_FILE=$4
33
-
30
+RPMS_PATH=$2
31
+PACKAGE_LIST_FILE=$3
34 32
 
35 33
 #- Step 3 Setting up the boot loader
36 34
 WORKINGDIR=${BUILDROOT}
... ...
@@ -90,7 +88,6 @@ sed -i "s/root:.*/root:x:0:0:root:\/root:\/bin\/bootphotoninstaller/g" ${BUILDRO
90 90
 mkdir -p ${BUILDROOT}/mnt/photon-root/photon-chroot
91 91
 rm -rf ${BUILDROOT}/RPMS
92 92
 cp -r ${RPMS_PATH} ${WORKINGDIR}/
93
-cp $TOOLS_PATH/tools.tar.gz ${WORKINGDIR}/
94 93
 
95 94
 #creating rpm repo in cd..
96 95
 createrepo --database ${WORKINGDIR}/RPMS
... ...
@@ -105,7 +102,6 @@ for i in `ls ${BUILDROOT}/usr/share/`; do
105 105
 		rm -rf ${BUILDROOT}/usr/share/$i
106 106
 	fi
107 107
 done
108
-rm -rf $BUILDROOT/tools
109 108
 
110 109
 # Generate the intird
111 110
 pushd $BUILDROOT
... ...
@@ -20,17 +20,16 @@ RPM_PARAMS="-Uvh"
20 20
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"
21 21
 
22 22
 if [ $# -ge 2 ]
23
-  then
23
+then
24 24
     RPM_PARAMS="-Uvh $2"
25 25
 fi
26 26
 
27 27
 [ ${EUID} -eq 0 ] 	|| fail "${PRGNAME}: Need to be root user: FAILURE"
28
+
28 29
 RPMPKG=""
29
-RPMPKG=$(find ../RPMS -name "$1-[0-9]*.rpm" -print)
30
+RPMPKG=$(find ${RPMROOT} -name "$1-[0-9]*.rpm" -print)
30 31
 [ -z $RPMPKG ] && fail "installation error: rpm package not found\n"
31
-case $1 in
32
-	linux-dev | linux-docs | glibc | gmp | gcc | bzip2 | ncurses | util-linux | e2fsprogs | shadow | bison | perl | texinfo | vim | linux | udev | rpm | dbus)
33
-		run_command "Installing: $1" "rpm --nodeps ${RPM_PARAMS} ${RPMPKG}" "${LOGFILE}" ;;
34
-	*)	run_command "Installing: $1" "rpm --nodeps ${RPM_PARAMS} ${RPMPKG}" "${LOGFILE}" ;;
35
-esac
32
+
33
+run_command "Installing: $1" "rpm --nodeps ${RPM_PARAMS} ${RPMPKG}" "${LOGFILE}"
34
+
36 35
 exit 0
... ...
@@ -37,19 +37,8 @@ if mountpoint ${BUILDROOT}/dev/pts	>/dev/null 2>&1; then umount ${BUILDROOT}/dev
37 37
 if mountpoint ${BUILDROOT}/dev	>/dev/null 2>&1; then umount ${BUILDROOT}/dev; fi
38 38
 [ ${EUID} -eq 0 ]	|| fail "${PRGNAME}: Need to be root user: FAILURE"
39 39
 
40
-#
41
-# Setup tools if tools.tar.gz already exists
42
-#
43
-[ -b $TOOLS_PATH/tools.tar.gz ] || {
44
-	run_command " Uncompressing tools" "tar -C ${BUILDROOT} -xzvf $TOOLS_PATH/tools.tar.gz" "${LOGFILE}"
45
-		
46
-	rm -rf /tools || true
47
-	if [ ! -e /tools ]; then 
48
-		ln -s ${BUILDROOT}/tools /tools || true
49
-    fi
50
-    PATH=$PATH:/tools/bin
51
-    }
52 40
 cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"
41
+
53 42
 #
54 43
 #	Setup the filesystem for chapter 06
55 44
 #
... ...
@@ -57,18 +46,12 @@ mkdir -p LOGS
57 57
 RPMPKG="$(find RPMS -name 'filesystem-[0-9]*.rpm' -print)"
58 58
 [ -z ${RPMPKG} ] && fail "	Filesystem rpm package missing: Can not continue"
59 59
 run_command "	Installing filesystem" "rpm -Uvh --nodeps --root ${BUILDROOT} ${RPMPKG}" "LOGS/filesystem.completed"
60
-run_command "	Creating symlinks: /tools/bin/{bash,cat,echo,pwd,stty}" "ln -fsv /tools/bin/{bash,cat,echo,pwd,stty} ${BUILDROOT}/bin"   "LOGS/filesystem.completed"
61
-run_command "	Creating symlinks: /tools/bin/perl /usr/bin" "ln -fsv /tools/bin/perl ${BUILDROOT}/usr/bin" "LOGS/filesystem.completed"
62
-run_command "	Creating symlinks: /tools/lib/libgcc_s.so{,.1}" "ln -fsv /tools/lib/libgcc_s.so{,.1} ${BUILDROOT}/usr/lib" "LOGS/filesystem.completed"
63
-run_command "	Creating symlinks: /tools/lib/libstdc++.so{,.6} /usr/lib" "ln -fsv /tools/lib/libstdc++.so{,.6} ${BUILDROOT}/usr/lib"	 "LOGS/filesystem.completed"
64
-#run_command "	Sed: /usr/lib/libstdc++.la" "sed 's/tools/usr/' ${BUILDROOT}/tools/lib/libstdc++.la > ${BUILDROOT}/usr/lib/libstdc++.la" "LOGS/filesystem.completed"
65
-run_command "	Creating symlinks: bash /bin/sh" "ln -fsv bash ${BUILDROOT}/bin/sh" "LOGS/filesystem.completed"
66 60
 
67 61
 # 	Ommited in the filesystem.spec file - not needed for booting
68 62
 [ -e ${BUILDROOT}/dev/console ]	|| mknod -m 600 ${BUILDROOT}/dev/console c 5 1
69
-[ -e ${BUILDROOT}/dev/null ]		|| mknod -m 666 ${BUILDROOT}/dev/null c 1 3
70
-[ -e ${BUILDROOT}/dev/random ]    || mknod -m 444 ${BUILDROOT}/dev/random c 1 8
71
-[ -e ${BUILDROOT}/dev/urandom ]    || mknod -m 444 ${BUILDROOT}/dev/urandom c 1 9
63
+[ -e ${BUILDROOT}/dev/null ]    || mknod -m 666 ${BUILDROOT}/dev/null c 1 3
64
+[ -e ${BUILDROOT}/dev/random ]  || mknod -m 444 ${BUILDROOT}/dev/random c 1 8
65
+[ -e ${BUILDROOT}/dev/urandom ] || mknod -m 444 ${BUILDROOT}/dev/urandom c 1 9
72 66
 
73 67
 chown -R 0:0 ${BUILDROOT}/*	|| fail "${PRGNAME}: Changing ownership: ${BUILDROOT}: FAILURE"
74 68
 
... ...
@@ -28,11 +28,11 @@ LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"	#	set log file name
28 28
 #	Goto chroot and run the command specified as parameter.
29 29
 #
30 30
 chroot "${BUILDROOT}" \
31
-	/tools/bin/env -i \
31
+	/usr/bin/env -i \
32 32
 	HOME=/root \
33 33
 	TERM="$TERM" \
34 34
 	PS1='\u:\w\$ ' \
35
-	PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
36
-	/tools/bin/bash --login +h -c "cd installer;$*"
35
+	PATH=/bin:/usr/bin:/sbin:/usr/sbin \
36
+	/usr/bin/bash --login +h -c "cd installer;$*"
37 37
 
38 38
 exit 0
... ...
@@ -173,7 +173,7 @@ if __name__ == '__main__':
173 173
 
174 174
     # Making the iso if needed
175 175
     if config['iso_system']:
176
-        process = subprocess.Popen(['./mk-install-iso.sh', '-w', options.working_directory, options.iso_path, options.tools_path, options.rpm_path, options.package_list_file])
176
+        process = subprocess.Popen(['./mk-install-iso.sh', '-w', options.working_directory, options.iso_path, options.rpm_path, options.package_list_file])
177 177
         retval = process.wait()
178 178
 
179 179
     # Cleaning up for vmdk
... ...
@@ -20,6 +20,9 @@ class constants(object):
20 20
     listCoreToolChainRPMPackages=["linux-api-headers", "glibc","glibc-devel",  "zlib","zlib-devel",  "file",
21 21
         "binutils","binutils-devel",  "gmp","gmp-devel", "mpfr", "mpfr-devel", "mpc",
22 22
         "libgcc","libgcc-devel","libstdc++","libstdc++-devel","libgomp","libgomp-devel","gcc",
23
+        "pkg-config","bash", "glibc","glibc-devel", "zlib","zlib-devel", "file",
24
+        "binutils","binutils-devel",  "gmp","gmp-devel", "mpfr", "mpfr-devel", "mpc",
25
+        "libgcc","libgcc-devel","libstdc++","libstdc++-devel","libgomp","libgomp-devel","gcc",
23 26
         "pkg-config","bash"]
24 27
     
25 28
     listToolChainRPMPkgsToInstall=["linux-api-headers", "glibc","glibc-devel",  "zlib","zlib-devel",  "file",