|
@@ -3,7 +3,7 @@
|
|
|
|
|
|
Usage_C(){
|
|
Usage_C(){
|
|
cat<<EOF
|
|
cat<<EOF
|
|
-Usage: $(basename $0) {--version [version]} {--arch [arch]} {--category [categories]} {--dist-upgrade} {--target [target]} {--with-compat32} {--bootstrap-dir [directory]} {--cache-dir [directory]} {--built-rpms-dir [directory]} {clean|build|build-rpm [src.rpm]|install-rpm [arch.rpm|package]|remove-rpm [package]|show-info}
|
|
|
|
|
|
+Usage: $(basename $0) {--version [version]} {--arch [arch]} {--category [categories]} {--dist-upgrade} {--target [target]} {--with-compat32} {--sign} {--bootstrap-dir [directory]} {--cache-dir [directory]} {--built-rpms-dir [directory]} {clean|build|build-rpm [src.rpm]|install-rpm [arch.rpm|package]|remove-rpm [package]|show-info}
|
|
|
|
|
|
Options:
|
|
Options:
|
|
--version: set [version] (default: ${DEFAULT_VERSION})
|
|
--version: set [version] (default: ${DEFAULT_VERSION})
|
|
@@ -13,6 +13,7 @@ Options:
|
|
--unionfs: cover a bootstrap with unionfs
|
|
--unionfs: cover a bootstrap with unionfs
|
|
--target: build rpms with [target]
|
|
--target: build rpms with [target]
|
|
--with-compat32: build rpms with compat32 on boostrap
|
|
--with-compat32: build rpms with compat32 on boostrap
|
|
|
|
+ --sign: sign built rpms
|
|
--bootstrap-dir: set a bootstrap directory (default: ${VBOOTSTRAP_DIR})
|
|
--bootstrap-dir: set a bootstrap directory (default: ${VBOOTSTRAP_DIR})
|
|
--cache-dir: set a directory to cache rpms (default: ${CACHE_DIR})
|
|
--cache-dir: set a directory to cache rpms (default: ${CACHE_DIR})
|
|
--built-rpms-dir: set a directory to store built rpms in chroot (default: ${BUILT_RPMS_DIR})
|
|
--built-rpms-dir: set a directory to store built rpms in chroot (default: ${BUILT_RPMS_DIR})
|
|
@@ -174,6 +175,18 @@ E: $RPM_PKG はソース RPM パッケージでありません
|
|
EOF
|
|
EOF
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Msg_SUDO_USERisEmpty_C(){
|
|
|
|
+cat<<EOF
|
|
|
|
+W: \$SUDO_USER is empty
|
|
|
|
+EOF
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+Msg_SUDO_USERisEmpty_ja(){
|
|
|
|
+cat<<EOF
|
|
|
|
+W: \$SUDO_USER が空です
|
|
|
|
+EOF
|
|
|
|
+}
|
|
|
|
+
|
|
##############################################################################
|
|
##############################################################################
|
|
|
|
|
|
check-parameter(){
|
|
check-parameter(){
|
|
@@ -191,7 +204,7 @@ check-parameter(){
|
|
shift
|
|
shift
|
|
check-next-parameter $1 || return 1
|
|
check-next-parameter $1 || return 1
|
|
;;
|
|
;;
|
|
- --dist-upgrade|--unionfs|--with-compat32)
|
|
|
|
|
|
+ --dist-upgrade|--unionfs|--with-compat32|--sign)
|
|
[ $with_actions -eq 1 ] && \
|
|
[ $with_actions -eq 1 ] && \
|
|
Msg_GiveNoMoreOptions_$LOCALE && return 1
|
|
Msg_GiveNoMoreOptions_$LOCALE && return 1
|
|
;;
|
|
;;
|
|
@@ -231,6 +244,7 @@ setup-vbuilder(){
|
|
VBUILDER_CONF=/etc/vbootstrap/vbuilder.conf
|
|
VBUILDER_CONF=/etc/vbootstrap/vbuilder.conf
|
|
if [ -r $VBUILDER_CONF ]; then
|
|
if [ -r $VBUILDER_CONF ]; then
|
|
. $VBUILDER_CONF
|
|
. $VBUILDER_CONF
|
|
|
|
+ [ $? -eq 1 ] && return 1
|
|
fi
|
|
fi
|
|
[ -z "${DEFAULT_VERSION}" ] && \
|
|
[ -z "${DEFAULT_VERSION}" ] && \
|
|
DEFAULT_VERSION=@@VBUILDER_DEFAULT_VERSION@@
|
|
DEFAULT_VERSION=@@VBUILDER_DEFAULT_VERSION@@
|
|
@@ -257,8 +271,9 @@ setup-vbuilder(){
|
|
|
|
|
|
## set boolian
|
|
## set boolian
|
|
with_setup_vbootstrap=0
|
|
with_setup_vbootstrap=0
|
|
- with_unionfs=0
|
|
|
|
with_dist_upgrade=0
|
|
with_dist_upgrade=0
|
|
|
|
+ with_unionfs=0
|
|
|
|
+ with_sign=0
|
|
with_actions=0
|
|
with_actions=0
|
|
with_category_main=0
|
|
with_category_main=0
|
|
with_category_plus=0
|
|
with_category_plus=0
|
|
@@ -266,6 +281,8 @@ setup-vbuilder(){
|
|
with_category_test=0
|
|
with_category_test=0
|
|
with_category_proposed_updates=0
|
|
with_category_proposed_updates=0
|
|
with_category_security=0
|
|
with_category_security=0
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
setup-vbootstrap(){
|
|
setup-vbootstrap(){
|
|
@@ -284,18 +301,18 @@ setup-vbootstrap(){
|
|
case "${VARCH}" in
|
|
case "${VARCH}" in
|
|
i386|i686|x86_64)
|
|
i386|i686|x86_64)
|
|
[ "$(uname -i)" = "ppc" ] && \
|
|
[ "$(uname -i)" = "ppc" ] && \
|
|
- Msg_NoSupportVARCH_$LOCALE && exit 1
|
|
|
|
|
|
+ Msg_NoSupportVARCH_$LOCALE && return 1
|
|
;;
|
|
;;
|
|
ppc)
|
|
ppc)
|
|
[ "$(uname -i)" = "i386" -o "$(uname -i)" = "i686" -o "$(uname -i)" = "x86_64" ] && \
|
|
[ "$(uname -i)" = "i386" -o "$(uname -i)" = "i686" -o "$(uname -i)" = "x86_64" ] && \
|
|
- Msg_NoSupportVARCH_$LOCALE && exit 1
|
|
|
|
|
|
+ Msg_NoSupportVARCH_$LOCALE && return 1
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
|
|
##!! 4.2 is NO support on VARCH=x86_64
|
|
##!! 4.2 is NO support on VARCH=x86_64
|
|
if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
|
|
if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
|
|
- Msg_NoSupportVERSION_${LOCALE} && exit 1
|
|
|
|
|
|
+ Msg_NoSupportVERSION_${LOCALE} && return 1
|
|
fi
|
|
fi
|
|
|
|
|
|
## support i386 chroot on x86_64 below:
|
|
## support i386 chroot on x86_64 below:
|
|
@@ -303,13 +320,13 @@ setup-vbootstrap(){
|
|
|
|
|
|
## check support ${VERSION}
|
|
## check support ${VERSION}
|
|
if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
|
|
if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
|
|
- Msg_NoSupportVERSION_$LOCALE && exit 1
|
|
|
|
|
|
+ Msg_NoSupportVERSION_$LOCALE && return 1
|
|
fi
|
|
fi
|
|
|
|
|
|
## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
|
|
## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
|
|
if [ $with_dist_upgrade -eq 1 ]; then
|
|
if [ $with_dist_upgrade -eq 1 ]; then
|
|
if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then
|
|
if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then
|
|
- Msg_NoSupportDistUpgradeVERSION_$LOCALE && exit 1
|
|
|
|
|
|
+ Msg_NoSupportDistUpgradeVERSION_$LOCALE && return 1
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
@@ -333,24 +350,24 @@ setup-vbootstrap(){
|
|
test)
|
|
test)
|
|
## "test" category only exists in VineSeed
|
|
## "test" category only exists in VineSeed
|
|
[ "${MAJOR_VERSION}" = "VineSeed" ] || \
|
|
[ "${MAJOR_VERSION}" = "VineSeed" ] || \
|
|
- Msg_NoSuchCategoryExists_$LOCALE ${cat} && exit 1
|
|
|
|
|
|
+ Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
|
|
with_category_test=1
|
|
with_category_test=1
|
|
;;
|
|
;;
|
|
proposed-updates)
|
|
proposed-updates)
|
|
##!! "proposed-updates" category does not exist in 4.2
|
|
##!! "proposed-updates" category does not exist in 4.2
|
|
[ "${MAJOR_VERSION}" = "4.2" ] && \
|
|
[ "${MAJOR_VERSION}" = "4.2" ] && \
|
|
- Msg_NoSuchCategoryExists_$LOCALE ${cat} && exit 1
|
|
|
|
|
|
+ Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
|
|
|
|
|
|
with_category_proposed_updates=1
|
|
with_category_proposed_updates=1
|
|
;;
|
|
;;
|
|
security)
|
|
security)
|
|
## "security" category does not exist in VineSeed
|
|
## "security" category does not exist in VineSeed
|
|
[ "${MAJOR_VERSION}" = "VineSeed" ] && \
|
|
[ "${MAJOR_VERSION}" = "VineSeed" ] && \
|
|
- Msg_NoSuchCategoryExists_$LOCALE ${cat} && exit 1
|
|
|
|
|
|
+ Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
|
|
with_category_security=1
|
|
with_category_security=1
|
|
;;
|
|
;;
|
|
*)
|
|
*)
|
|
- Msg_NoSuchCategoryExists_$LOCALE ${cat} && exit 1
|
|
|
|
|
|
+ Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
done
|
|
done
|
|
@@ -359,12 +376,18 @@ setup-vbootstrap(){
|
|
if [ ! -z "${TARGET}" ]; then
|
|
if [ ! -z "${TARGET}" ]; then
|
|
RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
|
|
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
|
|
if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
|
|
- Msg_NoSupportTARGET_$LOCALE && exit 1
|
|
|
|
|
|
+ Msg_NoSupportTARGET_$LOCALE && return 1
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+ ## set ${RPM_PKG_ARCH_LIST}
|
|
|
|
+ RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/i686 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
|
|
|
|
+ [ -z "${TARGET}" ] || \
|
|
|
|
+ RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
|
|
|
|
+
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+ ## set global variables
|
|
BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
|
|
BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
|
|
BUILD_USER=vbuilder
|
|
BUILD_USER=vbuilder
|
|
BUILD_DIR=/home/${BUILD_USER}/rpm
|
|
BUILD_DIR=/home/${BUILD_USER}/rpm
|
|
@@ -376,10 +399,12 @@ setup-vbootstrap(){
|
|
__chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c"
|
|
__chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c"
|
|
|
|
|
|
mkdir -p $VBOOTSTRAP_DIR
|
|
mkdir -p $VBOOTSTRAP_DIR
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
setup-vbootstrap-rpm(){
|
|
setup-vbootstrap-rpm(){
|
|
- setup-vbootstrap
|
|
|
|
|
|
+ setup-vbootstrap || return 1
|
|
|
|
|
|
## check ${BUILD_ROOT}
|
|
## check ${BUILD_ROOT}
|
|
[ -d ${BUILD_ROOT} ] || Build
|
|
[ -d ${BUILD_ROOT} ] || Build
|
|
@@ -392,6 +417,8 @@ setup-vbootstrap-rpm(){
|
|
else
|
|
else
|
|
BASE_RPM_PKG=$RPM_PKG
|
|
BASE_RPM_PKG=$RPM_PKG
|
|
fi
|
|
fi
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
## recover apt-get data on host/chroot
|
|
## recover apt-get data on host/chroot
|
|
@@ -438,7 +465,6 @@ mount-chroot-umount(){
|
|
[ -d ${BUILD_ROOT}${fs} ] || return 1
|
|
[ -d ${BUILD_ROOT}${fs} ] || return 1
|
|
[ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
|
|
[ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
|
|
umount ${BUILD_ROOT}${fs}
|
|
umount ${BUILD_ROOT}${fs}
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
vfs)
|
|
vfs)
|
|
# for dir in /sys /proc /dev/shm /dev/pts /dev; do
|
|
# for dir in /sys /proc /dev/shm /dev/pts /dev; do
|
|
@@ -447,13 +473,11 @@ mount-chroot-umount(){
|
|
[ -d ${BUILD_ROOT}/proc ] || return 1
|
|
[ -d ${BUILD_ROOT}/proc ] || return 1
|
|
[ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
|
|
[ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
|
|
umount ${BUILD_ROOT}/proc
|
|
umount ${BUILD_ROOT}/proc
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
archives_dir)
|
|
archives_dir)
|
|
[ -d ${ARCHIVES_DIR} ] || return 1
|
|
[ -d ${ARCHIVES_DIR} ] || return 1
|
|
[ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
|
|
[ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
|
|
umount ${ARCHIVES_DIR}
|
|
umount ${ARCHIVES_DIR}
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
unionfs_dir)
|
|
unionfs_dir)
|
|
[ -d ${BUILD_ROOT} ] || return 1
|
|
[ -d ${BUILD_ROOT} ] || return 1
|
|
@@ -464,13 +488,13 @@ mount-chroot-umount(){
|
|
umount -l ${BUILD_ROOT}
|
|
umount -l ${BUILD_ROOT}
|
|
echo "done."
|
|
echo "done."
|
|
fi
|
|
fi
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
*)
|
|
*)
|
|
echo mount-chroot-umount: unknown file system $fs
|
|
echo mount-chroot-umount: unknown file system $fs
|
|
exit 1
|
|
exit 1
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
## mount-chroot-mount [file system|name]
|
|
## mount-chroot-mount [file system|name]
|
|
@@ -492,14 +516,12 @@ mount-chroot-mount(){
|
|
[ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
|
|
[ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
|
|
[ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
|
|
[ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
|
|
mount ${mnt_opts} ${fs} ${BUILD_ROOT}${fs}
|
|
mount ${mnt_opts} ${fs} ${BUILD_ROOT}${fs}
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
vfs)
|
|
vfs)
|
|
# for dir in /dev /dev/pts /dev/shm /proc /sys; do
|
|
# for dir in /dev /dev/pts /dev/shm /proc /sys; do
|
|
# mount-chroot-mount ${dir} || return 1
|
|
# mount-chroot-mount ${dir} || return 1
|
|
# done
|
|
# done
|
|
mount-chroot-mount /proc || return 1
|
|
mount-chroot-mount /proc || return 1
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
archives_dir)
|
|
archives_dir)
|
|
[ -d ${EXTERNAL_ARCHIVES_DIR} ] || mkdir -p ${EXTERNAL_ARCHIVES_DIR}
|
|
[ -d ${EXTERNAL_ARCHIVES_DIR} ] || mkdir -p ${EXTERNAL_ARCHIVES_DIR}
|
|
@@ -507,7 +529,6 @@ mount-chroot-mount(){
|
|
[ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
|
|
[ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
|
|
mount ${mnt_opts} ${EXTERNAL_ARCHIVES_DIR} ${ARCHIVES_DIR}
|
|
mount ${mnt_opts} ${EXTERNAL_ARCHIVES_DIR} ${ARCHIVES_DIR}
|
|
[ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
|
|
[ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
unionfs_dir)
|
|
unionfs_dir)
|
|
if [ $with_unionfs -eq 1 ]; then
|
|
if [ $with_unionfs -eq 1 ]; then
|
|
@@ -516,13 +537,13 @@ mount-chroot-mount(){
|
|
mount -t unionfs -o dirs=${UNIONFS_DIR}=rw:${BUILD_ROOT}=ro unionfs ${BUILD_ROOT}
|
|
mount -t unionfs -o dirs=${UNIONFS_DIR}=rw:${BUILD_ROOT}=ro unionfs ${BUILD_ROOT}
|
|
unionctl ${BUILD_ROOT} --list
|
|
unionctl ${BUILD_ROOT} --list
|
|
fi
|
|
fi
|
|
- return 0
|
|
|
|
;;
|
|
;;
|
|
*)
|
|
*)
|
|
echo mount-chroot-mount: unknown file system $fs
|
|
echo mount-chroot-mount: unknown file system $fs
|
|
exit 1
|
|
exit 1
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
write-vbuilder-log(){
|
|
write-vbuilder-log(){
|
|
@@ -560,12 +581,14 @@ EOF
|
|
$*
|
|
$*
|
|
EOF
|
|
EOF
|
|
fi
|
|
fi
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
##############################################################################
|
|
##############################################################################
|
|
|
|
|
|
Clean(){
|
|
Clean(){
|
|
- setup-vbootstrap
|
|
|
|
|
|
+ setup-vbootstrap || return 1
|
|
|
|
|
|
# # output end-of-line in $VBUILDER_LOG
|
|
# # output end-of-line in $VBUILDER_LOG
|
|
# [ -f $VBUILDER_LOG ] && write-vbuilder-log ${HRULE}
|
|
# [ -f $VBUILDER_LOG ] && write-vbuilder-log ${HRULE}
|
|
@@ -593,10 +616,11 @@ Clean(){
|
|
fi
|
|
fi
|
|
|
|
|
|
echo "Cleanup a build farm for ${VERSION} done."
|
|
echo "Cleanup a build farm for ${VERSION} done."
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
Build(){
|
|
Build(){
|
|
- setup-vbootstrap
|
|
|
|
|
|
+ setup-vbootstrap || return 1
|
|
|
|
|
|
if [ $with_dist_upgrade -eq 1 ]; then
|
|
if [ $with_dist_upgrade -eq 1 ]; then
|
|
## make bootstrap of ${STABLE_VERSION}
|
|
## make bootstrap of ${STABLE_VERSION}
|
|
@@ -681,22 +705,25 @@ Build(){
|
|
apt-get-update --host
|
|
apt-get-update --host
|
|
|
|
|
|
echo "Making a build farm for ${VERSION} done."
|
|
echo "Making a build farm for ${VERSION} done."
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
Show-Info(){
|
|
Show-Info(){
|
|
- setup-vbootstrap
|
|
|
|
|
|
+ setup-vbootstrap || return 1
|
|
|
|
|
|
[ -f $VBUILDER_LOG ] && cat $VBUILDER_LOG
|
|
[ -f $VBUILDER_LOG ] && cat $VBUILDER_LOG
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
RPM_Remove(){
|
|
RPM_Remove(){
|
|
- setup-vbootstrap-rpm
|
|
|
|
|
|
+ setup-vbootstrap-rpm || return 1
|
|
mount-chroot unionfs_dir
|
|
mount-chroot unionfs_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot vfs
|
|
mount-chroot vfs
|
|
apt-get-update --chroot
|
|
apt-get-update --chroot
|
|
|
|
|
|
- [ -f $RPM_PKG ] && Msg_NotPackageName_$LOCALE $RPM_PKG && exit 1
|
|
|
|
|
|
+ [ -f $RPM_PKG ] && Msg_NotPackageName_$LOCALE $RPM_PKG && return 1
|
|
$__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
|
|
$__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
|
|
|
|
|
|
write-vbuilder-log "remove-rpm $RPM_PKG"
|
|
write-vbuilder-log "remove-rpm $RPM_PKG"
|
|
@@ -705,10 +732,12 @@ RPM_Remove(){
|
|
mount-chroot --umount archives_dir
|
|
mount-chroot --umount archives_dir
|
|
mount-chroot --umount unionfs_dir
|
|
mount-chroot --umount unionfs_dir
|
|
apt-get-update --host
|
|
apt-get-update --host
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
RPM_Install(){
|
|
RPM_Install(){
|
|
- setup-vbootstrap-rpm
|
|
|
|
|
|
+ setup-vbootstrap-rpm || return 1
|
|
mount-chroot unionfs_dir
|
|
mount-chroot unionfs_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot vfs
|
|
mount-chroot vfs
|
|
@@ -722,25 +751,24 @@ RPM_Install(){
|
|
mount-chroot --umount archives_dir
|
|
mount-chroot --umount archives_dir
|
|
mount-chroot --umount unionfs_dir
|
|
mount-chroot --umount unionfs_dir
|
|
apt-get-update --host
|
|
apt-get-update --host
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
RPM_Build(){
|
|
RPM_Build(){
|
|
- setup-vbootstrap-rpm
|
|
|
|
|
|
+ setup-vbootstrap-rpm || return 1
|
|
mount-chroot unionfs_dir
|
|
mount-chroot unionfs_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot archives_dir
|
|
mount-chroot vfs
|
|
mount-chroot vfs
|
|
apt-get-update --chroot
|
|
apt-get-update --chroot
|
|
|
|
|
|
- [ ! -f $RPM_PKG ] && Msg_NotSourceRPM_$LOCALE $RPM_PKG && exit 1
|
|
|
|
|
|
+ [ ! -f $RPM_PKG ] && Msg_NotSourceRPM_$LOCALE $RPM_PKG && return 1
|
|
|
|
|
|
RPM_PKG_USER=$(stat -c %U $RPM_PKG)
|
|
RPM_PKG_USER=$(stat -c %U $RPM_PKG)
|
|
RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
|
|
RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
|
|
[ ! -z "${SUDO_UID}" ] && RPM_PKG_USER=${SUDO_UID}
|
|
[ ! -z "${SUDO_UID}" ] && RPM_PKG_USER=${SUDO_UID}
|
|
[ ! -z "${SUDO_GID}" ] && RPM_PKG_GROUP=${SUDO_GID}
|
|
[ ! -z "${SUDO_GID}" ] && RPM_PKG_GROUP=${SUDO_GID}
|
|
local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
|
|
local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
|
|
- RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/i686 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
|
|
|
|
- [ -z "${TARGET}" ] || \
|
|
|
|
- RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
|
|
|
|
|
|
|
|
## make src.rpm for $VERSION
|
|
## make src.rpm for $VERSION
|
|
$__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
|
|
$__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
|
|
@@ -776,12 +804,25 @@ RPM_Build(){
|
|
apt-get-update --host
|
|
apt-get-update --host
|
|
|
|
|
|
echo "done."
|
|
echo "done."
|
|
|
|
+ return 0
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+RPM_Sign(){
|
|
|
|
+ if [ $with_sign -eq 1 ]; then
|
|
|
|
+ if [ -z "${SUDO_USER}" ]; then
|
|
|
|
+ Msg_SUDO_USERisEmpty_$LOCALE
|
|
|
|
+ else
|
|
|
|
+ su ${SUDO_USER} -c "rpm --addsign $(for i in $RPM_PKG_ARCH_LIST; do find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm'; done | sed -e s,$BUILD_ROOT${BUILD_DIR},${BUILT_RPMS_DIR}/${MAJOR_VERSION},g -e 's/$/ \\/g')"
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ return 0
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
##############################################################################
|
|
|
|
|
|
-setup-vbuilder
|
|
|
|
|
|
+setup-vbuilder || exit 1
|
|
|
|
|
|
check-parameter $* || exit 1
|
|
check-parameter $* || exit 1
|
|
|
|
|
|
@@ -791,7 +832,7 @@ while [ $# -gt 0 ]; do
|
|
--version|--arch|--category|--target|--bootstrap-dir|--cache-dir|--built-rpms-dir)
|
|
--version|--arch|--category|--target|--bootstrap-dir|--cache-dir|--built-rpms-dir)
|
|
shift
|
|
shift
|
|
;;
|
|
;;
|
|
- --dist-upgrade|--unionfs|--with-compat32)
|
|
|
|
|
|
+ --dist-upgrade|--unionfs|--with-compat32|--sign)
|
|
;;
|
|
;;
|
|
--build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
|
|
--build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
|
|
shift
|
|
shift
|
|
@@ -827,6 +868,9 @@ while [ $# -gt 0 ]; do
|
|
--with-compat32)
|
|
--with-compat32)
|
|
RPM_OPTS="${RPM_OPTS} --with compat32"
|
|
RPM_OPTS="${RPM_OPTS} --with compat32"
|
|
;;
|
|
;;
|
|
|
|
+ --sign)
|
|
|
|
+ with_sign=1
|
|
|
|
+ ;;
|
|
--bootstrap-dir)
|
|
--bootstrap-dir)
|
|
VBOOTSTRAP_DIR=$1
|
|
VBOOTSTRAP_DIR=$1
|
|
;;
|
|
;;
|
|
@@ -849,16 +893,18 @@ while [ $# -gt 0 ]; do
|
|
RPM_Remove || exit 1
|
|
RPM_Remove || exit 1
|
|
;;
|
|
;;
|
|
--show-info|show-info)
|
|
--show-info|show-info)
|
|
- Show-Info
|
|
|
|
|
|
+ Show-Info || exit 1
|
|
;;
|
|
;;
|
|
--build|build)
|
|
--build|build)
|
|
- Build
|
|
|
|
|
|
+ Build || exit 1
|
|
;;
|
|
;;
|
|
--clean|clean)
|
|
--clean|clean)
|
|
- Clean
|
|
|
|
|
|
+ Clean || exit 1
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
shift
|
|
shift
|
|
done
|
|
done
|
|
|
|
|
|
|
|
+RPM_Sign
|
|
|
|
+
|
|
exit
|
|
exit
|