| abuild | Loading last commit info... | |
| abump | ||
| LICENSE | ||
| README.md | ||
| abchr | ||
| abchr-buildall | ||
| abchr-newchroot | ||
| apkgvers |
APK Build Chroot tool
There are various build chains surrounding Alpine. Most solutions use
containerization, QEMU, or other technologies; meanwhile I just wanted a simple
way to build packages and install development utilities without shitting up my
production system. abchr is an attempt to create a simple solution to my
simple problem. It isn't very flexible, requires root access for chroot, and
won't allow you to (easily) build for multiarch, but it works.
Installation
- Create a directory and four subdirectories named
bin,alpine,aports, andpackages. Your tree should look like this:+ abchr + bin + alpine + aports + packages - Clone the repo to the
bindirectory. - Run
abchr-newchrootto populate thealpinedirectory with a new installation of Alpine Linux. - To ensure everything worked, run
abchr abuild -h. You should see the help text forabuild, which should be installed in the chroot.
Usage
abchr-newchroot
This command downloads the latest apk-tools-static into the chroot and
installs the basic packages necessary for a build environment. It also creates
a user in the chroot with its UID set to the current user UID. Having this be
your own UID is optimal as it lets you manupulate the chroot files easily.
If you run the script as root, the UID will not be populated automatically.
Pass the desired UID and primary GID as arguments to the script for the user to
be created correctly. In general, you should just run this as your normal user
that you will be using when you interact with the chroot.
abchr
abchr does not accept any switches or options. The command simply sets up the
chroot and starts whatever program is specified in its arguments―they are all
passed as-is to the underlying shell in the chroot.
The aports directory is mounted into the chroot under the
/home/abuild/aports directory, and if your shell is within that directory
structure, you will be moved to that same location within the chroot. For
example, if you want to build aports/testing/somepackage, all you need to do
is cd into that directory and run abchr abuild -r. You will be moved into
the chroot and placed into the directory
/home/abuild/aports/testing/somepackage automatically, before the abuild -r
command is run.
The upside of being a chroot is you can customize the installation however you like, including installing and configuring shells and other features. If on the same filesystem, you should also be able to hardlink (i.e. same inode) files from your normal user into the chroot, to have a generally unified userland.
Do recall that Alpine runs on Musl, so you may not be able to simply link binaries built for other C libs and have it work in the chroot.
Convenience links
abuild, abump, etc. are links to abchr provided for youe convenience. The
script recognizes if it has been called with a name other than abchr, and
will automatically prefix any passed arguments with the link name, so you don't
have to explicitly type out abchr abuild or similar every time.
As such, adding the bin directory to your path will thus allow you to run
abuild like you normally would and have it just work, as long as you're
within the aports directory tree of course.
Convenience scripts
abchr-buildall
A shortcut to abchr buildrepo -ps testing. Pass arguments to it to build
other trees than testing.
apkgvers
Prints the version numbers for all APKBUILD files in your repository. Useful
when bumping versions with abump.
Why a subdirectory?
Git doesn't like it when there's a bazillion files in its directory, even if
you .gitignore them. So, the repository's expected file structure must be set
up manually.
License
This project is licensed under the Apache License, Version 2.0 (the "License"); you may not use it except in compliance with the License. A copy of the License is made available in the LICENSE file. You may also obtain a copy of the license at the Apache website.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.