|
@@ -3,10 +3,11 @@
|
|
|
|
|
|
Usage_C(){
|
|
|
cat<<EOF
|
|
|
-Usage: $(basename $0) {--version [version]} {--arch [arch]} {--with-compat32} {--build|--clean|--build-rpm [src.rpm]|--install-rpm [arch.rpm|package]|--remove-rpm [package]}
|
|
|
+Usage: $(basename $0) {--version [version]} {--arch [arch]} {--target [target]|--with-compat32} {--build|--clean|--build-rpm [src.rpm]|--install-rpm [arch.rpm|package]|--remove-rpm [package]}
|
|
|
--version: set [version] (default: ${DEFAULT_VERSION})
|
|
|
--arch: set [arch] (default: $(uname -i))
|
|
|
- --with-compat32: build with compat32 on boostrap
|
|
|
+ --target: build rpms with [target]
|
|
|
+ --with-compat32: build rpms with compat32 on boostrap
|
|
|
--clean: clean boostrap of [version]
|
|
|
--build: build boostrap of [version]
|
|
|
--build-rpm: build [src.rpm] on boostrap
|
|
@@ -16,13 +17,15 @@ Usage: $(basename $0) {--version [version]} {--arch [arch]} {--with-compat32} {-
|
|
|
For example,
|
|
|
* make a clean/plain build environment on the current archtecture:
|
|
|
$(basename $0) --clean --build
|
|
|
-* build source RPM:
|
|
|
+* build a source rpm:
|
|
|
$(basename $0) --build-rpm [src.rpm]
|
|
|
* make a plain build environment for Vine Linux 4.2:
|
|
|
$(basename $0) --version 4.2 --clean --build
|
|
|
* make a i386 chroot on x86_64:
|
|
|
$(basename $0) --arch i386 --clean --build
|
|
|
-* build compat32:
|
|
|
+* build a kernel package with target i686
|
|
|
+$(basename $0) --target i686 --build-rpm [kernel src.rpm]
|
|
|
+* build a compat32 package:
|
|
|
$(basename $0) --arch i386 --with-compat32 --build-rpm [src.rpm]
|
|
|
$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*//)
|
|
|
EOF
|
|
@@ -64,6 +67,16 @@ Msg_NoSupportVERSION_ja(){
|
|
|
Msg_NoSupportVERSION_C
|
|
|
}
|
|
|
|
|
|
+Msg_NoSupportTARGET_C(){
|
|
|
+ cat<<EOF
|
|
|
+E: rpm build target ${TARGET} is NO support
|
|
|
+EOF
|
|
|
+}
|
|
|
+
|
|
|
+Msg_NoSupportTARGET_ja(){
|
|
|
+ Msg_NoSupportTARGET_C
|
|
|
+}
|
|
|
+
|
|
|
##############################################################################
|
|
|
|
|
|
setup-vbuilder(){
|
|
@@ -139,6 +152,13 @@ setup-vbootstrap(){
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
+ ## check build target option ${TARGET}
|
|
|
+ RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
|
|
|
+ if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
|
|
|
+ Msg_NoSupportTARGET_$LOCALE
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+
|
|
|
fi
|
|
|
|
|
|
BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
|
|
@@ -154,7 +174,20 @@ setup-vbootstrap(){
|
|
|
Clean(){
|
|
|
setup-vbootstrap
|
|
|
|
|
|
- [ -d ${BUILD_ROOT}/proc ] && \
|
|
|
+ # ## umount /home
|
|
|
+ # [ -z "$(mount | grep ${BUILD_ROOT}/home)" ] || \
|
|
|
+ # umount ${BUILD_ROOT}/home
|
|
|
+
|
|
|
+ # ## umount /tmp for applications which use X
|
|
|
+ # [ -z "$(mount | grep ${BUILD_ROOT}/tmp)" ] || \
|
|
|
+ # umount ${BUILD_ROOT}/tmp
|
|
|
+
|
|
|
+ # ## umount virtual file systems
|
|
|
+ # for dir in /sys /proc /dev/shm /dev/pts /dev; do
|
|
|
+ # [ -z "$(mount | grep ${BUILD_ROOT}${dir})" ] || \
|
|
|
+ # umount ${BUILD_ROOT}${dir}
|
|
|
+ # done
|
|
|
+ [ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
|
|
|
umount ${BUILD_ROOT}/proc
|
|
|
|
|
|
if [ -d ${BUILD_ROOT}/var/cache/apt/archives ]; then
|
|
@@ -176,12 +209,22 @@ Build(){
|
|
|
|
|
|
/usr/sbin/vbootstrap ${VERSION} ${BUILD_ROOT}
|
|
|
|
|
|
+ # ## mount virtual file systems
|
|
|
+ # for dir in /dev /dev/pts /dev/shm /proc /sys; do
|
|
|
+ # [ -d ${BUILD_ROOT}${dir} ] || mkdir -p ${BUILD_ROOT}${dir}
|
|
|
+ # mount --bind ${dir} ${BUILD_ROOT}${dir}
|
|
|
+ # done
|
|
|
[ -d ${BUILD_ROOT}/proc ] || mkdir -p ${BUILD_ROOT}/proc
|
|
|
- mount -t proc proc ${BUILD_ROOT}/proc
|
|
|
+ mount --bind /proc ${BUILD_ROOT}/proc
|
|
|
|
|
|
- # ## mount /tmp with --bind option
|
|
|
+ # ## mount /tmp for applications which use X
|
|
|
+ # [ -d ${BUILD_ROOT}/tmp ] || mkdir -p ${BUILD_ROOT}/tmp
|
|
|
# mount --bind /tmp ${BUILD_ROOT}/tmp
|
|
|
|
|
|
+ # ## mount /home
|
|
|
+ # [ -d ${BUILD_ROOT}/home ] || mkdir -p ${BUILD_ROOT}/home
|
|
|
+ # mount -o rbind /home ${BUILD_ROOT}/home
|
|
|
+
|
|
|
if [ -d ${CACHE_DIR} ]; then
|
|
|
echo -n "Copying cached RPMs to ${BUILD_ROOT}/var/cache/apt/archives ... "
|
|
|
cp -f ${CACHE_DIR}/apt/archives/*.rpm ${BUILD_ROOT}/var/cache/apt/archives/
|
|
@@ -202,7 +245,7 @@ Build(){
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c 'cd /dev && /sbin/MAKEDEV console'
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c 'cd /dev && /sbin/MAKEDEV null'
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c 'cd /dev && /sbin/MAKEDEV zero'
|
|
|
-
|
|
|
+
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c '/usr/sbin/pwconv'
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c "/usr/sbin/useradd ${BUILD_USER}"
|
|
|
|
|
@@ -294,42 +337,46 @@ setup-vbuilder
|
|
|
|
|
|
[ $# -eq 0 ] && Usage_$LOCALE
|
|
|
while [ $# -gt 0 ]; do
|
|
|
+ tmpARG="$1"
|
|
|
case "$1" in
|
|
|
- --version)
|
|
|
- shift;
|
|
|
+ --version|--arch|--target|--build-rpm|--install-rpm|--remove-rpm)
|
|
|
+ shift
|
|
|
echo $1 | check-next-parameter
|
|
|
[ $? -eq 1 ] && exit 1
|
|
|
+ ;;
|
|
|
+ --with-compat32|--build|--clean)
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ Usage_$LOCALE
|
|
|
+ exit 1
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+
|
|
|
+ case "$tmpARG" in
|
|
|
+ --version)
|
|
|
VERSION=$1
|
|
|
;;
|
|
|
--arch)
|
|
|
- shift;
|
|
|
- echo $1 | check-next-parameter
|
|
|
- [ $? -eq 1 ] && exit 1
|
|
|
VARCH=$1
|
|
|
;;
|
|
|
+ --target)
|
|
|
+ TARGET=$1
|
|
|
+ RPM_OPTS="${RPM_OPTS} --target $TARGET"
|
|
|
+ ;;
|
|
|
--with-compat32)
|
|
|
- RPM_OPTS="--with compat32"
|
|
|
+ RPM_OPTS="${RPM_OPTS} --with compat32"
|
|
|
;;
|
|
|
--build-rpm)
|
|
|
- shift;
|
|
|
- echo $1 | check-next-parameter
|
|
|
- [ $? -eq 1 ] && exit 1
|
|
|
RPM_PKG=$1
|
|
|
- RPM_Build
|
|
|
+ RPM_Build || exit 1
|
|
|
;;
|
|
|
--install-rpm)
|
|
|
- shift;
|
|
|
- echo $1 | check-next-parameter
|
|
|
- [ $? -eq 1 ] && exit 1
|
|
|
RPM_PKG=$1
|
|
|
- RPM_Install
|
|
|
+ RPM_Install || exit 1
|
|
|
;;
|
|
|
--remove-rpm)
|
|
|
- shift;
|
|
|
- echo $1 | check-next-parameter
|
|
|
- [ $? -eq 1 ] && exit 1
|
|
|
RPM_PKG=$1
|
|
|
- RPM_Remove
|
|
|
+ RPM_Remove || exit 1
|
|
|
;;
|
|
|
--build)
|
|
|
Build
|
|
@@ -337,10 +384,6 @@ while [ $# -gt 0 ]; do
|
|
|
--clean)
|
|
|
Clean
|
|
|
;;
|
|
|
- *)
|
|
|
- Usage_$LOCALE
|
|
|
- exit 1
|
|
|
- ;;
|
|
|
esac
|
|
|
shift
|
|
|
done
|