Using osc build to make a jail on openSUSE
Before I start let me say that there may be easier or more direct ways to do this. This has the advantage of being pretty easy for me to do. I'm not going to discuss why you might want to do this, or what a jail is, etc..
You can get the most recent osc and build tools from the openSUSE:Tools repository. You will also need an account on the build service.
Create an empty directorymkdir jail/
Go into that directory and create a dummy RPM .spec filecd jail/
vim jail.spec
Name: jail
Version: 0
Release: 0
Summary: Jail
License: Jail
Group: Jail
BuildRequires: vim gdb glib2-devel zypper
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
%prep
%build
%install
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%changelog
The BuildRequires:
tag is where you specify which packages you want installed
in your jail, what I have listed there is just an example.
Also create an empty .osc directory (this prevents an ugly bug where the jail
tries to delete itself)mkdir .osc/
You'll need to be logged in to OBS if you aren't alreadyosc ls
Enter your credentials at the prompts.
If for some reason that didn't work you may need to put your password into your
.oscrc filevim ~/.oscrc
Toward the bottom...
[https://api.opensuse.org]
user=<YOUR USERNAME>
pass=<YOUR PASSWORD>
If your password changed you may need to delete any lines that say
passx=<GARBAGE>
, or manipulate your GNOME Keyring.
Now you should be ready to build a jail
osc build --local-package --root=</path/to/new/jail> --alternative-project=openSUSE:<VERSION> <ARCH>
<VERSION>
is, for example, 11.2
<ARCH>
is only needed if you want a different arch (i586
on an x86\_64
machine)</path/to/new/jail>
is where you want the tool to put your jail (not the
directory you're in!), I use /var/tmp/jail
You may be prompted for your root password
When the jail is built (assuming it worked) it will fail complaining about an
empty package, ignore that and get on with your life: you only wanted a jail,
not a package.
At this point you can chroot into your jailsudo chroot /path/to/new/jail
or if you are changing architectures...sudo linux32 chroot /path/to/new/jail
Yay, you're done!