vbuilder.sh.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. #!/bin/bash
  2. # -*- coding: utf-8-unix -*-
  3. Usage_C(){
  4. cat<<EOF
  5. Usage: $(basename $0) {--version [version]} {--arch [arch]} {--dist-upgrade} {--target [target]} {--with-compat32} {--build|--clean|--build-rpm [src.rpm]|--install-rpm [arch.rpm|package]|--remove-rpm [package]}
  6. Options:
  7. --version: set [version] (default: ${DEFAULT_VERSION})
  8. --arch: set [arch] (default: $(uname -i))
  9. --dist-upgrade: make VineSeed bootstrap via ${STABLE_VERSION}
  10. --target: build rpms with [target]
  11. --with-compat32: build rpms with compat32 on boostrap
  12. Actions:
  13. --clean: clean boostrap of [version]
  14. --build: build boostrap of [version]
  15. --build-rpm: build [src.rpm] on boostrap
  16. --install-rpm: install [arch.rpm|package] on boostrap
  17. --remove-rpm: remove [package] on boostrap
  18. For example,
  19. * make a clean/plain build environment on the current archtecture:
  20. $(basename $0) --clean --build
  21. * build rpms from the specified source rpm:
  22. $(basename $0) --build-rpm [src.rpm]
  23. * make a plain build environment for Vine Linux 4.2:
  24. $(basename $0) --version 4.2 --clean --build
  25. * make a i386 chroot on x86_64:
  26. $(basename $0) --arch i386 --clean --build
  27. * build a kernel package with target i686
  28. $(basename $0) --target i686 --build-rpm [kernel src.rpm]
  29. * build a compat32 package:
  30. $(basename $0) --arch i386 --with-compat32 --build-rpm [src.rpm]
  31. $(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*//)
  32. EOF
  33. }
  34. Usage_ja(){
  35. Usage_C
  36. }
  37. Msg_MissingParameter_C(){
  38. para=$1
  39. cat<<EOF
  40. E: Missing some parameters after ${para}
  41. EOF
  42. }
  43. Msg_MissingParameter_ja(){
  44. para=$1
  45. cat<<EOF
  46. E: ${para} 以後のいくつかのパラメータに間違いがあります
  47. EOF
  48. }
  49. Msg_NoSupportVARCH_C(){
  50. cat<<EOF
  51. E: arch ${VARCH} is NOT supported on $(uname -i)
  52. EOF
  53. }
  54. Msg_NoSupportVARCH_ja(){
  55. cat<<EOF
  56. E: ${VARCH} アーキテクチャは $(uname -i) 上で非サポートです
  57. EOF
  58. }
  59. Msg_NoSupportVERSION_C(){
  60. cat<<EOF
  61. E: ${VERSION} is NOT supported
  62. EOF
  63. }
  64. Msg_NoSupportVERSION_ja(){
  65. cat<<EOF
  66. E: バージョン ${VERSION} は非サポートです
  67. EOF
  68. }
  69. Msg_NoSupportDistUpgradeVERSION_C(){
  70. cat<<EOF
  71. E: version ${VERSION} does not support --dist-upgrade option
  72. EOF
  73. }
  74. Msg_NoSupportDistUpgradeVERSION_ja(){
  75. cat<<EOF
  76. E: バージョン ${VERSION} では --dist-upgrade オプションはサポートされていません
  77. EOF
  78. }
  79. Msg_NoSupportTARGET_C(){
  80. cat<<EOF
  81. E: rpm build target ${TARGET} is NOT supported
  82. EOF
  83. }
  84. Msg_NoSupportTARGET_ja(){
  85. cat<<EOF
  86. E: rpm ビルドターゲット ${TARGET} はサポートされていません
  87. EOF
  88. }
  89. Msg_NotPackageName_C(){
  90. cat<<EOF
  91. E: $RPM_PKG is not a package name
  92. EOF
  93. }
  94. Msg_NotPackageName_ja(){
  95. cat<<EOF
  96. E: $RPM_PKG はパッケージ名でありません
  97. EOF
  98. }
  99. Msg_NotSourceRPM_C(){
  100. cat<<EOF
  101. E: $RPM_PKG is not a source RPM package
  102. EOF
  103. }
  104. Msg_NotSourceRPM_ja(){
  105. cat<<EOF
  106. E: $RPM_PKG はソース RPM パッケージでありません
  107. EOF
  108. }
  109. ##############################################################################
  110. check-parameter(){
  111. if [ -z "$*" ]; then
  112. Usage_$LOCALE
  113. return 1
  114. fi
  115. while [ ! -z "$*" ]; do
  116. case $1 in
  117. --version|--arch|--target|--build-rpm|--install-rpm|--remove-rpm)
  118. shift
  119. check-next-parameter $1 || return 1
  120. ;;
  121. --dist-upgrade|--with-compat32|--build|--clean)
  122. ;;
  123. *)
  124. Msg_MissingParameter_$LOCALE $1
  125. return 1
  126. ;;
  127. esac
  128. shift
  129. done
  130. return 0
  131. }
  132. check-next-parameter(){
  133. arg=$1
  134. if [ -z "${arg}" ]; then
  135. Msg_MissingParameter_$LOCALE ${arg}
  136. return 1
  137. fi
  138. if [ $(echo ${arg} | grep '^-') ]; then
  139. Msg_MissingParameter_$LOCALE ${arg}
  140. return 1
  141. fi
  142. return 0
  143. }
  144. setup-vbuilder(){
  145. ## load default settings
  146. if [ -r /etc/vbootstrap/vbuilder.conf ]; then
  147. . /etc/vbootstrap/vbuilder.conf
  148. fi
  149. [ -z "${VBOOTSTRAP_DIR}" ] && \
  150. VBOOTSTRAP_DIR=@@VBUILDER_VBOOTSTRAP_DIR@@
  151. [ -z "${DEFAULT_VERSION}" ] && \
  152. DEFAULT_VERSION=@@VBUILDER_DEFAULT_VERSION@@
  153. [ -z "${BUILT_RPMS_DIR}" ] && \
  154. BUILT_RPMS_DIR=@@VBUILDER_BUILT_RPMS_DIR@@
  155. [ -d $VBOOTSTRAP_DIR ] || mkdir -p $VBOOTSTRAP_DIR
  156. VERSION=$DEFAULT_VERSION
  157. ## current stable relase version
  158. STABLE_VERSION=@@VBUILDER_STABLE_VERSION@@
  159. ## set locale
  160. case $LANG in
  161. ja*) LOCALE=ja ;;
  162. *) LOCALE=C ;;
  163. esac
  164. ## set boolian
  165. with_setup_vbootstrap=0
  166. with_dist_upgrade=0
  167. }
  168. setup-vbootstrap(){
  169. if [ ${with_setup_vbootstrap} -eq 0 ]; then
  170. with_setup_vbootstrap=1
  171. ## check a chroot archtecture
  172. if [ ! -z ${VARCH} ]; then
  173. case "${VARCH}" in
  174. i386)
  175. [ "$(uname -i)" = "ppc" ] && \
  176. Msg_NoSupportVARCH_$LOCALE
  177. [ $? -eq 0 ] && exit 1
  178. ;;
  179. i686)
  180. [ "$(uname -i)" = "ppc" ] && \
  181. Msg_NoSupportVARCH_$LOCALE
  182. [ $? -eq 0 ] && exit 1
  183. ;;
  184. x86_64)
  185. [ "$(uname -i)" = "ppc" ] && \
  186. Msg_NoSupportVARCH_$LOCALE
  187. [ $? -eq 0 ] && exit 1
  188. ;;
  189. ppc)
  190. [ "$(uname -i)" = "i386" -o "$(uname -i)" = "i686" -o "$(uname -i)" = "x86_64" ] && \
  191. Msg_NoSupportVARCH_$LOCALE
  192. [ $? -eq 0 ] && exit 1
  193. ;;
  194. esac
  195. fi
  196. [ -z ${VARCH} ] && VARCH=$(uname -i)
  197. ##!! 4.2 is NO support on VARCH=x86_64
  198. if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
  199. Msg_NoSupportVERSION_${LOCALE}
  200. exit 1
  201. fi
  202. ## support i386 chroot on x86_64 below:
  203. [ "${VARCH}" != "$(uname -i)" ] && VERSION=${VERSION}_${VARCH}
  204. ## check support ${VERSION}
  205. if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
  206. Msg_NoSupportVERSION_$LOCALE
  207. exit 1
  208. fi
  209. ## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
  210. if [ $with_dist_upgrade -eq 1 ]; then
  211. if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then
  212. Msg_NoSupportDistUpgradeVERSION_$LOCALE
  213. exit 1
  214. fi
  215. fi
  216. ## check build target option ${TARGET}
  217. if [ ! -z "${TARGET}" ]; then
  218. RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
  219. if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
  220. Msg_NoSupportTARGET_$LOCALE
  221. exit 1
  222. fi
  223. fi
  224. fi
  225. BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
  226. BUILD_USER=vbuilder
  227. BUILD_DIR=/home/${BUILD_USER}/rpm
  228. ARCHIVES_DIR=${BUILD_ROOT}/var/cache/apt/archives
  229. CACHE_DIR=${VBOOTSTRAP_DIR}/cache/${VERSION}/apt/archives
  230. __chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c"
  231. mkdir -p $VBOOTSTRAP_DIR
  232. }
  233. setup-vbootstrap-rpm(){
  234. setup-vbootstrap
  235. ## check ${BUILD_ROOT}
  236. [ -d ${BUILD_ROOT} ] || Build
  237. DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  238. if [ -f $RPM_PKG ]; then
  239. BASE_RPM_PKG=$(basename $RPM_PKG)
  240. cp -f $RPM_PKG $BUILD_ROOT${BUILD_DIR}
  241. else
  242. BASE_RPM_PKG=$RPM_PKG
  243. fi
  244. }
  245. ## recover apt-get data on host/chroot
  246. apt-get-update(){
  247. case $1 in
  248. --host)
  249. echo -n "apt-get update on host ... "
  250. apt-get -qq update > /dev/null 2>&1
  251. echo "done."
  252. ;;
  253. --chroot)
  254. echo -n "apt-get update on chroot ... "
  255. $__chroot_sh 'apt-get -qq update' > /dev/null 2>&1
  256. echo "done."
  257. ;;
  258. *)
  259. echo apt-get-update: unknown option $1
  260. exit 1
  261. ;;
  262. esac
  263. }
  264. ## mount-chroot {|--umount} [file system|name]
  265. ## support file systems: /home /tmp /sys /proc /dev/shm /dev/pts /dev
  266. ## support name: vfs chache_dir
  267. ## NOTE: /tmp needs for applications which use X
  268. ## vfs is virtual file systems
  269. ## cache_dir is ${CACHE_DIR} to ${ARCHIVES_DIR}
  270. mount-chroot(){
  271. if [ "$1" = "--umount" ]; then
  272. mount-chroot-umount $2 || return 1
  273. else
  274. mount-chroot-mount $1 || return 1
  275. fi
  276. return 0
  277. }
  278. ## mount-chroot-umount [file system|name]
  279. mount-chroot-umount(){
  280. local fs=$1
  281. case $fs in
  282. /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
  283. [ -d ${BUILD_ROOT}${fs} ] || return 1
  284. [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
  285. umount ${BUILD_ROOT}${fs}
  286. return 0
  287. ;;
  288. vfs)
  289. # for dir in /sys /proc /dev/shm /dev/pts /dev; do
  290. # mount-chroot-umount ${dir} || return 1
  291. # done
  292. [ -d ${BUILD_ROOT}/proc ] || return 1
  293. [ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
  294. umount ${BUILD_ROOT}/proc
  295. return 0
  296. ;;
  297. cache_dir)
  298. [ -d ${ARCHIVES_DIR} ] || return 1
  299. [ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
  300. umount ${ARCHIVES_DIR}
  301. return 0
  302. ;;
  303. *)
  304. echo mount-chroot-umount: unknown file system $fs
  305. exit 1
  306. ;;
  307. esac
  308. }
  309. ## mount-chroot-mount [file system|name]
  310. mount-chroot-mount(){
  311. local fs=$1
  312. local mnt_opts=""
  313. case $fs in
  314. /home)
  315. mnt_opts="-o rbind"
  316. ;;
  317. *)
  318. mnt_opts="--bind"
  319. ;;
  320. esac
  321. case $fs in
  322. /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
  323. [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
  324. [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
  325. mount ${mnt_opts} ${fs} ${BUILD_ROOT}${fs}
  326. return 0
  327. ;;
  328. vfs)
  329. # for dir in /dev /dev/pts /dev/shm /proc /sys; do
  330. # mount-chroot-mount ${dir} || return 1
  331. # done
  332. mount-chroot-mount /proc || return 1
  333. return 0
  334. ;;
  335. cache_dir)
  336. [ -d ${CACHE_DIR} ] || mkdir -p ${CACHE_DIR}
  337. [ -d ${ARCHIVES_DIR} ] || mkdir -p ${ARCHIVES_DIR}
  338. [ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
  339. mount ${mnt_opts} ${CACHE_DIR} ${ARCHIVES_DIR}
  340. [ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
  341. return 0
  342. ;;
  343. *)
  344. echo mount-chroot-mount: unknown file system $fs
  345. exit 1
  346. ;;
  347. esac
  348. }
  349. ##############################################################################
  350. Clean(){
  351. setup-vbootstrap
  352. # mount-chroot --umount /home
  353. # mount-chroot --umount /tmp
  354. mount-chroot --umount vfs
  355. mount-chroot --umount cache_dir
  356. apt-get-update --host
  357. if [ -d ${BUILD_ROOT} ]; then
  358. echo -n "Cleaning build root \"${BUILD_ROOT}\" ... "
  359. rm -rf ${BUILD_ROOT}
  360. echo "done."
  361. fi
  362. echo "Cleanup a build farm for ${VERSION} done."
  363. }
  364. Retry_vbootstrap-post(){
  365. local CHROOT_DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  366. local DIST_RELEASE=$(cat /etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  367. if [ "${CHROOT_DIST_RELEASE}" != "${DIST_RELEASE}" ]; then
  368. . /usr/share/vbootstrap/scripts/${VERSION}
  369. $__chroot_sh "rm /var/lib/rpm/*"
  370. $__chroot_sh "rpmdb --initdb"
  371. $__chroot_sh "apt-get -qq update"
  372. $__chroot_sh "apt-get -qq -y install ${BASE_PKGS}"
  373. fi
  374. }
  375. Build(){
  376. setup-vbootstrap
  377. if [ $with_dist_upgrade -eq 1 ]; then
  378. ## make bootstrap of ${STABLE_VERSION}
  379. /usr/sbin/vbootstrap \
  380. $(echo ${VERSION} | sed -e "s/VineSeed/${STABLE_VERSION}/") \
  381. ${BUILD_ROOT}
  382. ## aim apt-line to VineSeed
  383. sed -i "s/apt ${STABLE_VERSION}/apt VineSeed/g" \
  384. ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
  385. else
  386. /usr/sbin/vbootstrap ${VERSION} ${BUILD_ROOT}
  387. fi
  388. ## retry vbootstrap post in Build()
  389. Retry_vbootstrap-post
  390. mount-chroot cache_dir
  391. mount-chroot vfs
  392. # mount-chroot /tmp
  393. # mount-chroot /home
  394. $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
  395. ##!! 4.2 has no apt-sourceslist-{plus,nonfree} packages
  396. if [ "$(echo ${VERSION} | sed s/_i386//)" != "4.2" ]; then
  397. $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus'
  398. $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree'
  399. fi
  400. if [ $with_dist_upgrade -eq 1 ]; then
  401. $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
  402. fi
  403. $__chroot_sh 'apt-get -qq -y install build-essential'
  404. $__chroot_sh 'apt-get -qq -y install self-build-setup'
  405. $__chroot_sh 'apt-get -qq -y install etcskel shadow-utils'
  406. $__chroot_sh 'cd /dev && /sbin/MAKEDEV console'
  407. $__chroot_sh 'cd /dev && /sbin/MAKEDEV null'
  408. $__chroot_sh 'cd /dev && /sbin/MAKEDEV zero'
  409. $__chroot_sh '/usr/sbin/pwconv'
  410. $__chroot_sh "/usr/sbin/useradd ${BUILD_USER}"
  411. ##!! for rpm-4.8.0 or higher
  412. ##!! (See http://trac.vinelinux.org/wiki/Vine6/AboutUpdateToolchain)
  413. if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" = "VineSeed" ]; then
  414. $__chroot_sh "sed -i -e 's/^%_topdir/#%_topdir/' /home/${BUILD_USER}/.rpmmacros"
  415. fi
  416. # mount-chroot --umount /home
  417. # mount-chroot --umount /tmp
  418. mount-chroot --umount vfs
  419. mount-chroot --umount cache_dir
  420. apt-get-update --host
  421. echo "Making a build farm for ${VERSION} done."
  422. }
  423. RPM_Remove(){
  424. setup-vbootstrap-rpm
  425. mount-chroot cache_dir
  426. mount-chroot vfs
  427. if [ -f $RPM_PKG ]; then
  428. Msg_NotPackageName_$LOCALE
  429. exit 1
  430. fi
  431. $__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
  432. mount-chroot --umount vfs
  433. mount-chroot --umount cache_dir
  434. apt-get-update --host
  435. }
  436. RPM_Install(){
  437. setup-vbootstrap-rpm
  438. mount-chroot cache_dir
  439. mount-chroot vfs
  440. apt-get-update --chroot
  441. $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $BASE_RPM_PKG"
  442. mount-chroot --umount vfs
  443. mount-chroot --umount cache_dir
  444. apt-get-update --host
  445. }
  446. RPM_Build(){
  447. setup-vbootstrap-rpm
  448. mount-chroot cache_dir
  449. mount-chroot vfs
  450. if [ ! -f $RPM_PKG ]; then
  451. Msg_NotSourceRPM_$LOCALE
  452. exit 1
  453. fi
  454. RPM_PKG_USER=$(stat -c %U $RPM_PKG)
  455. RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
  456. local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
  457. RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/i686 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
  458. [ -z "${TARGET}" ] || \
  459. RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
  460. ## make src.rpm for $VERSION
  461. $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
  462. $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild -bs --nodeps --clean --rmsource --rmspec ${BUILD_DIR}/SPECS/*.spec'"
  463. ## change ${DIST_RELEASE}
  464. BASE_RPM_PKG=$(echo $BASE_RPM_PKG | sed -e "s/vl\([0-9]*\)\./vl${DIST_RELEASE}\./")
  465. ## rebuild $BASE_RPM_PKG on ${DIST_RELEASE}
  466. $__chroot_sh "cd ${BUILD_DIR}/SRPMS && apt-get -y build-dep $BASE_RPM_PKG"
  467. $__chroot_sh "cd ${BUILD_DIR}/SRPMS && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
  468. $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $(find $BUILD_ROOT${BUILD_DIR}/RPMS -type f -regex '.*\.rpm' | sed -e s@${BUILD_ROOT}@@g -e 's|.*\/compat32-.*||g' -e 's|.*\/.*\.src\.rpm||g' -e 's/$/ \\/g')"
  469. ## copy built rpms to ${HOME}/rpm/ for each archtectures
  470. echo "Copying built rpms to ${HOME}/rpm/ for each archtectures ... "
  471. for i in $RPM_PKG_ARCH_LIST; do \
  472. if [ -d $BUILD_ROOT${BUILD_DIR}/${i} ]; then
  473. [ -d ${BUILT_RPMS_DIR}/${i} ] || \
  474. $__install -d ${BUILT_RPMS_DIR}/${i}/
  475. find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' \
  476. -exec $__install -m0644 {} ${BUILT_RPMS_DIR}/${i}/ \;
  477. fi
  478. done
  479. mount-chroot --umount vfs
  480. mount-chroot --umount cache_dir
  481. apt-get-update --host
  482. echo "done."
  483. }
  484. ##############################################################################
  485. setup-vbuilder
  486. check-parameter $* || exit 1
  487. while [ $# -gt 0 ]; do
  488. tmpARG=$1
  489. case $tmpARG in
  490. --version|--arch|--target|--build-rpm|--install-rpm|--remove-rpm)
  491. shift
  492. ;;
  493. --dist-upgrade|--with-compat32|--build|--clean)
  494. ;;
  495. *)
  496. echo unknown option $1
  497. exit 1
  498. ;;
  499. esac
  500. case $tmpARG in
  501. --version)
  502. VERSION=$1
  503. ;;
  504. --arch)
  505. VARCH=$1
  506. ;;
  507. --dist-upgrade)
  508. with_dist_upgrade=1
  509. ;;
  510. --target)
  511. TARGET=$1
  512. RPM_OPTS="${RPM_OPTS} --target $TARGET"
  513. ;;
  514. --with-compat32)
  515. RPM_OPTS="${RPM_OPTS} --with compat32"
  516. ;;
  517. --build-rpm)
  518. RPM_PKG=$1
  519. RPM_Build || exit 1
  520. ;;
  521. --install-rpm)
  522. RPM_PKG=$1
  523. RPM_Install || exit 1
  524. ;;
  525. --remove-rpm)
  526. RPM_PKG=$1
  527. RPM_Remove || exit 1
  528. ;;
  529. --build)
  530. Build
  531. ;;
  532. --clean)
  533. Clean
  534. ;;
  535. esac
  536. shift
  537. done
  538. exit