vbuilder.sh.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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 a 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 parameter 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 NO support 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 NO support
  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 NO support
  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 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 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. x86_64)
  180. [ "$(uname -i)" = "ppc" ] && \
  181. Msg_NoSupportVARCH_$LOCALE
  182. [ $? -eq 0 ] && exit 1
  183. ;;
  184. ppc)
  185. [ "$(uname -i)" = "i386" -o "$(uname -i)" = "x86_64" ] && \
  186. Msg_NoSupportVARCH_$LOCALE
  187. [ $? -eq 0 ] && exit 1
  188. ;;
  189. esac
  190. fi
  191. [ -z ${VARCH} ] && VARCH=$(uname -i)
  192. ##!! 4.2 is NO support on VARCH=x86_64
  193. if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
  194. Msg_NoSupportVERSION_${LOCALE}
  195. exit 1
  196. fi
  197. ## support i386 chroot on x86_64 below:
  198. [ "${VARCH}" != "$(uname -i)" ] && VERSION=${VERSION}_${VARCH}
  199. ## check support ${VERSION}
  200. if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
  201. Msg_NoSupportVERSION_$LOCALE
  202. exit 1
  203. fi
  204. ## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
  205. if [ $with_dist_upgrade -eq 1 ]; then
  206. if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then
  207. Msg_NoSupportDistUpgradeVERSION_$LOCALE
  208. exit 1
  209. fi
  210. fi
  211. ## check build target option ${TARGET}
  212. if [ ! -z "${TARGET}" ]; then
  213. RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
  214. if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
  215. Msg_NoSupportTARGET_$LOCALE
  216. exit 1
  217. fi
  218. fi
  219. fi
  220. BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
  221. BUILD_USER=vbuilder
  222. BUILD_DIR=/home/${BUILD_USER}/rpm
  223. ARCHIVES_DIR=${BUILD_ROOT}/var/cache/apt/archives
  224. CACHE_DIR=${VBOOTSTRAP_DIR}/cache/${VERSION}/apt/archives
  225. __chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c"
  226. mkdir -p $VBOOTSTRAP_DIR
  227. }
  228. setup-vbootstrap-rpm(){
  229. setup-vbootstrap
  230. ## check ${BUILD_ROOT}
  231. [ -d ${BUILD_ROOT} ] || Build
  232. DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  233. if [ -f $RPM_PKG ]; then
  234. BASE_RPM_PKG=$(basename $RPM_PKG)
  235. cp -f $RPM_PKG $BUILD_ROOT${BUILD_DIR}
  236. else
  237. BASE_RPM_PKG=$RPM_PKG
  238. fi
  239. }
  240. ## recover apt-get data on host/chroot
  241. apt-get-update(){
  242. case $1 in
  243. --host)
  244. echo -n "apt-get update on host ... "
  245. apt-get -qq update > /dev/null 2>&1
  246. echo "done."
  247. ;;
  248. --chroot)
  249. echo -n "apt-get update on chroot ... "
  250. $__chroot_sh 'apt-get -qq update' > /dev/null 2>&1
  251. echo "done."
  252. ;;
  253. *)
  254. echo apt-get-update: unknown option $1
  255. exit 1
  256. ;;
  257. esac
  258. }
  259. ## mount-chroot {|--umount} [file system|name]
  260. ## support file systems: /home /tmp /sys /proc /dev/shm /dev/pts /dev
  261. ## support name: vfs chache_dir
  262. ## NOTE: /tmp needs for applications which use X
  263. ## vfs is virtual file systems
  264. ## cache_dir is ${CACHE_DIR} to ${ARCHIVES_DIR}
  265. mount-chroot(){
  266. if [ "$1" = "--umount" ]; then
  267. mount-chroot-umount $2 || return 1
  268. else
  269. mount-chroot-mount $1 || return 1
  270. fi
  271. return 0
  272. }
  273. ## mount-chroot-umount [file system|name]
  274. mount-chroot-umount(){
  275. local fs=$1
  276. case $fs in
  277. /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
  278. [ -d ${BUILD_ROOT}${fs} ] || return 1
  279. [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
  280. umount ${BUILD_ROOT}${fs}
  281. return 0
  282. ;;
  283. vfs)
  284. # for dir in /sys /proc /dev/shm /dev/pts /dev; do
  285. # mount-chroot-umount ${dir} || return 1
  286. # done
  287. [ -d ${BUILD_ROOT}/proc ] || return 1
  288. [ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
  289. umount ${BUILD_ROOT}/proc
  290. return 0
  291. ;;
  292. cache_dir)
  293. [ -d ${ARCHIVES_DIR} ] || return 1
  294. [ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
  295. umount ${ARCHIVES_DIR}
  296. return 0
  297. ;;
  298. *)
  299. echo mount-chroot-umount: unknown file system $fs
  300. exit 1
  301. ;;
  302. esac
  303. }
  304. ## mount-chroot-mount [file system|name]
  305. mount-chroot-mount(){
  306. local fs=$1
  307. local mnt_opts=""
  308. case $fs in
  309. /home)
  310. mnt_opts="-o rbind"
  311. ;;
  312. *)
  313. mnt_opts="--bind"
  314. ;;
  315. esac
  316. case $fs in
  317. /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
  318. [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
  319. [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
  320. mount ${mnt_opts} ${fs} ${BUILD_ROOT}${fs}
  321. return 0
  322. ;;
  323. vfs)
  324. # for dir in /dev /dev/pts /dev/shm /proc /sys; do
  325. # mount-chroot-mount ${dir} || return 1
  326. # done
  327. mount-chroot-mount /proc || return 1
  328. return 0
  329. ;;
  330. cache_dir)
  331. [ -d ${CACHE_DIR} ] || mkdir -p ${CACHE_DIR}
  332. [ -d ${ARCHIVES_DIR} ] || mkdir -p ${ARCHIVES_DIR}
  333. [ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
  334. mount ${mnt_opts} ${CACHE_DIR} ${ARCHIVES_DIR}
  335. [ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
  336. return 0
  337. ;;
  338. *)
  339. echo mount-chroot-mount: unknown file system $fs
  340. exit 1
  341. ;;
  342. esac
  343. }
  344. ##############################################################################
  345. Clean(){
  346. setup-vbootstrap
  347. # mount-chroot --umount /home
  348. # mount-chroot --umount /tmp
  349. mount-chroot --umount vfs
  350. mount-chroot --umount cache_dir
  351. apt-get-update --host
  352. if [ -d ${BUILD_ROOT} ]; then
  353. echo -n "Cleaning build root \"${BUILD_ROOT}\" ... "
  354. rm -rf ${BUILD_ROOT}
  355. echo "done."
  356. fi
  357. echo "Cleanup a build farm for ${VERSION} done."
  358. }
  359. Retry_vbootstrap-post(){
  360. local CHROOT_DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  361. local DIST_RELEASE=$(cat /etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
  362. if [ "${CHROOT_DIST_RELEASE}" != "${DIST_RELEASE}" ]; then
  363. . /usr/share/vbootstrap/scripts/${VERSION}
  364. $__chroot_sh "rm /var/lib/rpm/*"
  365. $__chroot_sh "rpmdb --initdb"
  366. $__chroot_sh "apt-get -qq update"
  367. $__chroot_sh "apt-get -qq -y install ${BASE_PKGS}"
  368. fi
  369. }
  370. Build(){
  371. setup-vbootstrap
  372. if [ $with_dist_upgrade -eq 1 ]; then
  373. ## make bootstrap of ${STABLE_VERSION}
  374. /usr/sbin/vbootstrap \
  375. $(echo ${VERSION} | sed -e "s/VineSeed/${STABLE_VERSION}/") \
  376. ${BUILD_ROOT}
  377. ## aim apt-line to VineSeed
  378. sed -i "s/apt ${STABLE_VERSION}/apt VineSeed/g" \
  379. ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
  380. else
  381. /usr/sbin/vbootstrap ${VERSION} ${BUILD_ROOT}
  382. fi
  383. ## retry vbootstrap post in Build()
  384. Retry_vbootstrap-post
  385. mount-chroot cache_dir
  386. mount-chroot vfs
  387. # mount-chroot /tmp
  388. # mount-chroot /home
  389. $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
  390. ##!! 4.2 has no apt-sourceslist-{plus,nonfree} packages
  391. if [ "$(echo ${VERSION} | sed s/_i386//)" != "4.2" ]; then
  392. $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus'
  393. $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree'
  394. fi
  395. if [ $with_dist_upgrade -eq 1 ]; then
  396. $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
  397. fi
  398. $__chroot_sh 'apt-get -qq -y install build-essential'
  399. $__chroot_sh 'apt-get -qq -y install self-build-setup'
  400. $__chroot_sh 'apt-get -qq -y install etcskel shadow-utils'
  401. $__chroot_sh 'cd /dev && /sbin/MAKEDEV console'
  402. $__chroot_sh 'cd /dev && /sbin/MAKEDEV null'
  403. $__chroot_sh 'cd /dev && /sbin/MAKEDEV zero'
  404. $__chroot_sh '/usr/sbin/pwconv'
  405. $__chroot_sh "/usr/sbin/useradd ${BUILD_USER}"
  406. ##!! for rpm-4.8.0 or higher
  407. ##!! (See http://trac.vinelinux.org/wiki/Vine6/AboutUpdateToolchain)
  408. if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" = "VineSeed" ]; then
  409. $__chroot_sh "sed -i -e 's/^%_topdir/#%_topdir/' /home/${BUILD_USER}/.rpmmacros"
  410. fi
  411. # mount-chroot --umount /home
  412. # mount-chroot --umount /tmp
  413. mount-chroot --umount vfs
  414. mount-chroot --umount cache_dir
  415. apt-get-update --host
  416. echo "Making a build farm for ${VERSION} done."
  417. }
  418. RPM_Remove(){
  419. setup-vbootstrap-rpm
  420. mount-chroot cache_dir
  421. mount-chroot vfs
  422. if [ -f $RPM_PKG ]; then
  423. Msg_NotPackageName_$LOCALE
  424. exit 1
  425. fi
  426. $__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
  427. mount-chroot --umount vfs
  428. mount-chroot --umount cache_dir
  429. apt-get-update --host
  430. }
  431. RPM_Install(){
  432. setup-vbootstrap-rpm
  433. mount-chroot cache_dir
  434. mount-chroot vfs
  435. apt-get-update --chroot
  436. $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $BASE_RPM_PKG"
  437. mount-chroot --umount vfs
  438. mount-chroot --umount cache_dir
  439. apt-get-update --host
  440. }
  441. RPM_Build(){
  442. setup-vbootstrap-rpm
  443. mount-chroot cache_dir
  444. mount-chroot vfs
  445. if [ ! -f $RPM_PKG ]; then
  446. Msg_NotSourceRPM_$LOCALE
  447. exit 1
  448. fi
  449. RPM_PKG_USER=$(stat -c %U $RPM_PKG)
  450. RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
  451. local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
  452. RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
  453. [ -z "${TARGET}" ] || \
  454. RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
  455. ## make src.rpm for $VERSION
  456. $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
  457. $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild -bs --nodeps --clean --rmsource --rmspec ${BUILD_DIR}/SPECS/*.spec'"
  458. ## change ${DIST_RELEASE}
  459. BASE_RPM_PKG=$(echo $BASE_RPM_PKG | sed -e "s/vl\([0-9]*\)\./vl${DIST_RELEASE}\./")
  460. ## rebuild $BASE_RPM_PKG on ${DIST_RELEASE}
  461. $__chroot_sh "cd ${BUILD_DIR}/SRPMS && apt-get -y build-dep $BASE_RPM_PKG"
  462. $__chroot_sh "cd ${BUILD_DIR}/SRPMS && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
  463. $__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')"
  464. ## copy built rpms to ${HOME}/rpm/ for each archtectures
  465. echo "Copying built rpms to ${HOME}/rpm/ for each archtectures ... "
  466. for i in $RPM_PKG_ARCH_LIST; do \
  467. if [ -d $BUILD_ROOT${BUILD_DIR}/${i} ]; then
  468. [ -d ${BUILT_RPMS_DIR}/${i} ] || \
  469. $__install -d ${BUILT_RPMS_DIR}/${i}/
  470. find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' \
  471. -exec $__install -m0644 {} ${BUILT_RPMS_DIR}/${i}/ \;
  472. fi
  473. done
  474. mount-chroot --umount vfs
  475. mount-chroot --umount cache_dir
  476. apt-get-update --host
  477. echo "done."
  478. }
  479. ##############################################################################
  480. setup-vbuilder
  481. check-parameter $* || exit 1
  482. while [ $# -gt 0 ]; do
  483. tmpARG=$1
  484. case $tmpARG in
  485. --version|--arch|--target|--build-rpm|--install-rpm|--remove-rpm)
  486. shift
  487. ;;
  488. --dist-upgrade|--with-compat32|--build|--clean)
  489. ;;
  490. *)
  491. echo unknown option $1
  492. exit 1
  493. ;;
  494. esac
  495. case $tmpARG in
  496. --version)
  497. VERSION=$1
  498. ;;
  499. --arch)
  500. VARCH=$1
  501. ;;
  502. --dist-upgrade)
  503. with_dist_upgrade=1
  504. ;;
  505. --target)
  506. TARGET=$1
  507. RPM_OPTS="${RPM_OPTS} --target $TARGET"
  508. ;;
  509. --with-compat32)
  510. RPM_OPTS="${RPM_OPTS} --with compat32"
  511. ;;
  512. --build-rpm)
  513. RPM_PKG=$1
  514. RPM_Build || exit 1
  515. ;;
  516. --install-rpm)
  517. RPM_PKG=$1
  518. RPM_Install || exit 1
  519. ;;
  520. --remove-rpm)
  521. RPM_PKG=$1
  522. RPM_Remove || exit 1
  523. ;;
  524. --build)
  525. Build
  526. ;;
  527. --clean)
  528. Clean
  529. ;;
  530. esac
  531. shift
  532. done
  533. exit