# This package is maintained on trac svn repository. Please do not change on local.
# If you find a BUG, please report to Vine@vinelinux.org or mailing list or BTS.

%define version 0.0.58

Summary: bootstrap scripts to create a basic Vine Linux system
Summary(ja): Vine Linux の基本システムを作成するためのスクリプト
Name: vbootstrap
Version: %{version}
Release: 1%{?_dist_release}
License: public domain
Group: Development/Tools
Url: http://trac.vinelinux.org/wiki/VineBootstrap

Source0: %{name}-%{version}.tar.bz2

Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
BuildRequires: sed
Requires: bash, apt
%if %{?_dist_release} >= "vl7"
Requires: aufs-util
%else
Requires: unionfs-utils
%endif

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke, munepi

%description
vbootstrap is used to create a basic Vine Linux system on existing Vine Linux
system. It uses rpm and apt to install basic rpm package into a directory
which can be chrooted into.

vbuilder constracts a chroot environment with vbootstrap, and builds 
a rpm package inside the chroot. 
it is a useful system to check that a package has correct BuildRequires 
dependencies. 


%description -l ja
vbootstrap は Vine Linux の基本システムを既存の Vine Linux システム上で
作成するスクリプトです。rpm および apt を利用して、指定したディレクトリ
以下に基本の rpm パッケージをインストールし、chroot できるようにします。

vbuilder は vbootstrap を利用して chroot 環境の構築し、
その chroot の中でパッケージをビルドします。
パッケージが正しい BuildRequires 依存関係を持っているかを確認するために
有用なシステムです。


%prep
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%setup

%build
%__make \
    %if %{?_dist_release} == "vl6"
      VBUILDER_DEFAULT_VERSION=\${VBUILDER_STABLE_VERSION}
    %endif
    %if %{?_dist_release} == "vl5"
      VBUILDER_DEFAULT_VERSION=5.2
    %endif

%install
%__make DESTDIR=$RPM_BUILD_ROOT install

%find_lang %{name}

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files -f %{name}.lang
%defattr(-,root,root)
%{_bindir}/vbuilder
%{_sbindir}/vbootstrap
%{_sbindir}/vbuilder
%dir %{_datadir}/vbootstrap
%{_datadir}/vbootstrap/*
%{_sysconfdir}/bash_completion.d/vbuilder
%{_sysconfdir}/vbootstrap/profile.d/sample.conf.skip
%config(noreplace) %{_sysconfdir}/vbootstrap/vbuilder.conf
%config(noreplace) %{_sysconfdir}/pam.d/vbuilder
%config(noreplace) %{_sysconfdir}/security/console.apps/vbuilder


%changelog
* Sat Aug 11 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.58-1
- set VBUILDER_STABLE_VERSION=6 in Makefile
- updated po files

* Mon Jul 30 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.57-1
- change 6.0 to 6
- install MAKEDEV

* Tue Jun 19 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.56-1
- use /proc/filesystem to detect aufs capability

* Tue May  1 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.55-1
- added util-linux in $$BASE_PKGS (scripts/VineSeed_{i386,x86_64})

* Sun Feb  5 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.54-1
- rename _filedir() as _vbootstrap_filedir()

* Sat Jan 28 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.53-1
- fix unmounting aufs

* Fri Jan 27 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.52-1
- update vbuilder.sh.in
  - add "--no-build-essential" option
- R: aufs-util on vl7 or upper

* Fri Jan 27 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.51-1
- update vbuilder.sh.in, libvbuilder.sh.in
  - support aufs

* Thu Jan 26 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.50-1
- update 6.0_{i386,x86_64}.sh
  - install nss before glibc on vbootstrap

* Sun Jan 22 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.49-1
- updated vbuilder.sh.in
  - fixed Usage()
  - avoid to output 'W: Duplicate sources.list entry...' in Build()

* Sun Jan  8 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.48-1
- updated vbootstrap.sh.in
  - specify a location to fetch base packages
- updated vbuilder.sh.in
  - replaced "rpm --addsign" with "rpmsign --addsign"
  - added --fetch-url option
  - added --profile option
    - added sample.conf.skip

* Wed Oct 19 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.47-1
- added the category updates in 5.2_{i386,ppc,x86_64}, 6.0_{i386,x86_64}
  (Thanks to daisuke-san and miyabi-san)

* Sat Aug 20 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.46-1
- updated vbuilder.sh.in
  - optimized Build()
  - do not install self-build-setup package in Build()

* Tue Aug 09 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.45-1
- set STABLE_VERSION to 6.0

* Sat Jun 18 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.44-1
- updated vbuilder
  - allowed some illegal patterns of %%{release}
- added UGROUPS=wheel in vbuilder.console
- supported 6.0_i386 and 6.0_x86_64
- updated ja.po

* Sat Apr 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.43-1
- updated vbootstrap
  - supported versions format: <version>_<arch>
- updated vbuilder.sh.in
  - dropped the action "show-info"
  - sync the above change for vbootstrap
  - added the target "noarch" in $$RPM_TARGET_LIST

* Sat Apr 16 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.42-1
- fixed RPM_Sign(), Login_Chroot() in vbuilder.sh.in
  - the command "vbuilder clean" returns 0. 

* Sat Apr 09 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.41-1
- updated vbuilder.sh.in
  - dropped user_from_uid()
- updated ja.po

* Sun Mar 20 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.40-1
- updated vbuilder.sh.in
  - arranged some procedures to mount /proc and unionfs_dir 
    (Thanks to parrot-san and iwai-san)

* Sun Feb 27 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.39-1
- updated vbuilder.sh.in
  - fixed "unionfs_dir" in mount-chroot-mount() (Thanks to Takemikaduchi-san)
  - improved Clean()

* Fri Feb 18 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.38-1
- updated vbuilder.sh.in
  - added $$UNIONFS_DIR
  - added --debug, --login options
  - applied vbootstrap-0.0.37-armhack.patch (Thanks to parrot-san)

* Wed Feb 09 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.37-1
- fixed a little mistake of vbuilder.sh.in
- supported --unionfs for RPM_Sign()

* Wed Feb 09 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.36-1
- updated vbuilder.sh.in
  - improved RPM_Sign() to sign rpms under usermode

* Wed Jan 19 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.35-1
- updated po translations
- updated vbuilder.sh.in, vbuilder-bash-completion.sh
  - added --rpmbuild-define, --rpmbuild-without option
- supported usermode
  - dropped require-root() from vbuilder.sh.in

* Tue Jan 18 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.34-1
- updated vbuilder.sh.in
  - defined require-root() (Thanks to tomo-p-san)
- gettextlize
  - added vbootstrap.po, ja.po, Makefile, POTFILES.in in po/

* Tue Jan 11 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.33-1
- added /bin/sh option -l at chroot_sh (Thanks to Takemikaduchi-san)

* Fri Dec 10 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.32-1
- setarch ix86 if ix86 chroot on x86_64 host

* Fri Dec 03 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.31-1
- supported Vine Linux 5.2

* Sun Aug 08 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.30-1
- updated vbuilder.sh.in
  - added --rpmbuild-with option

* Sat Jul 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.29-1
- updated vbuilder.sh.in
  - added --sign option
  - added --no-install option

* Fri Jun 04 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.28-1
- updated vbuilder.sh.in
  - made /dev/urandom on chroot in Build()
  - added "-o APT::Install::Virtual=true" on apt-get build-dep 
    to solve BuildRequires dependenceies of virtual packages

* Tue May 04 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.27-1
- changed an order of BASE_PKGS in vbootstrap/scripts/*, respectively
  - apt package has Requires: rpm dependence
  - dropped "rpm" from $$BASE_PKGS

* Mon May 03 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.26-1
- updated vbuilder.sh.in
  - made /dev/random on chroot in Build()

* Sat Apr 24 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.25-1
- updated vbuilder.sh.in
  - supported "test" category
  - added some comments for mount-chroot()
- updated vbuilder-bash-completion.sh

* Sun Apr 11 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.24-1
- updated vbootstrap.sh.in (daisuke-san)
  - changed to cache /var/lib/apt/lists, /var/cache/apt/archives 
    in bootstrap (not in host)
  - set Dir::State and Dir::Cache in APT_OPTS

* Sun Apr 11 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.23-1
- updated vbuilder.sh.in
  - added --category option

* Fri Apr 02 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.22-1
- updated vbuilder.sh.in: 
  - added --bootstrap-dir, --built-rpms-dir, --cache-dir options
  - added show-info action
    - defined write-vbuilder-log()
- added CACHE_DIR in vbuilder.conf.in
- updated vbuilder-bash-completion.sh

* Fri Mar 26 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.21-1
- updated vbuilder.sh.in: 
  - added a compatible name for actions: 
    dropped two hyphens "--" from the head of an action "--hoge"
    (e.g. build-rpm = --build-rpm)
- added about vbuilder in %%description and %%description -l ja
- updated vbuilder-bash-completion.sh: s/5.0/5.1/

* Sun Mar 21 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.20-1
- fixed RPM_Build()

* Fri Mar 05 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.0.19-1
- remove Retry_vbootstrap-post() from the vbuilder script:
  the trick (implemented in 0.0.18-1) moved to vbootstrap/scripts/* instead

* Thu Mar 04 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.0.18-1
- vbuilder:Retry_vbootstrap-post(): pass --justdb option to rpm
  so that apt-get don't have to actually install packages again
  (this will help avoid creating annoying .rpmorig/.rpmnew files)

* Thu Mar 04 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.0.17-1
- add --help option to vbuilder
- ensure all files/subdirectories under BUILT_RPMS_DIR
  (i.e. $HOME/vbuilder/{5.1,VineSeed}/{RPMS/{i686,ppc,x86_64},SRPMS}/*)
  have ownerships of the user/group who executed "sudo vbuilder"

* Mon Feb 22 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.16-1
- added Requires: unionfs-utils
- updated vbuilder.sh.in
  - added --unionfs option
- supported 5.1 (by iwai-san)

* Sat Feb 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.15-1
- added vbuilder-bash-completion.sh

* Sat Feb 13 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.14-1
- updated vbuilder.sh.in
  - used __chroot_sh
  - improved some functions for mounting file systems
  - defined Retry_vbootstrap-post()

* Sat Feb 06 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.13-1
- updated vbuilder.sh.in
  - fixed /home/vbuilder/.rpmmacros for VineSeed_i386, VineSeed
  - improved some mounting processes
    - defined mount_cache_dir()

* Sun Jan 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.12-1
- added 4.2_i386
- updated vbuilder.sh.in
  - supported 4.2_i386 chroot on x86_64

* Tue Jan 05 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.11-1
- updated vbuilder.sh.in
  - added Japanese translations for error messages
  - improved some mounting processes
    - defined some mount functions
    - defined apt-get-update() function
  - defined check-parameter() function

* Tue Dec 29 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.10-1
- updated vbuilder.sh.in
  - added --dist-upgrade option which provides a flag to build 
    VineSeed bootstrap via stable relase version

* Sat Dec 26 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.9-1
- fixed vbuilder.sh.in around --target option

* Sat Dec 26 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.8-1
- updated vbuilder.sh.in
  - added --target option which gives a build target of source rpm

* Sun Nov 22 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.7-1
- updated vbuilder.sh.in

* Sat Oct 31 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.6-1
- updated vbuilder.sh.in, little

* Sat Oct 31 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.5-1
- updated vbuilder.sh.in and vbuilder.conf.in
  - extended to store built rpms on chroot env. in each arch. of home rpm dir.

* Sun Sep 13 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.4-1
- added vine-release in BASE_PKGS of scripts/*
- added vbuilder.conf
- updated vbuilder.sh.in

* Tue Sep 01 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.3-2
- rebuilt to add signature

* Mon Aug 31 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.3-1
- support 5.0 (by daisuke-san)
- update vbuilder.sh.in
  - check chroot archtecture

* Mon Jun 29 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.2-1
- add vbuilder

* Wed Mar 18 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.0.1-1
- initial build
