clean-chroot-manager:包装脚本,用于在Arch Linux下管理干净的chroot

  • z8_740772
  • 14.7KB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-06-14 03:33
清洁chroot经理 包装器脚本,用于在Arch Linux下构建软件包时管理buildroot。 为什么要使用它? 与标准的arch-build脚本相比,Ccm具有几个优点: 自动管理chroot中的本地存储库,以便从该本地存储库透明地提取您构建的依赖项。 自动设置并使用distcc加快编译速度(如果启用)。 如果构建的软件包具有必须也要构建的依赖关系(即Arch仓库中没有的依赖关系),则管理本地仓库是有帮助的。差异化的另一个关键点是ccm可以使用distcc来构建软件包。 例如,假设我们要从AUR构建“ bar”。 “ Bar”的构建依赖项“ foo”也位于AUR中。本地存储库将先保存foo.pkg.tar.xz的副本,而不是先构建“ foo”,然后安装“ foo”,然后构建“ bar”,最后删除“ foo”。 chroot中的Pacman知道了“ foo”软件包,这要归功于本地仓库。
  • clean-chroot-manager-master
  • common
  • zsh-completion
  • ccm.skel
  • MIT
  • doc
  • clean-chroot-manager.1
  • Makefile
# clean-chroot-manager Wrapper script to manage buildroots when building packages under Arch Linux. ## Why use it? Ccm provides several advantages over the standard arch-build scripts: * Automatically manages a local repo within the chroot so dependencies that you build are pulled transparently from that local repo. * Automatically setups and uses distcc to speed up compilation (if enabled). Managing a local repo is helpful if building a package that has a dependency that also has to be built (i.e. one that is not available from the Arch repos). Another key point of differentiation is that ccm can build packages using distcc. For example, let's say that we want to build "bar" from the AUR. "Bar" has a build dependency of "foo" which is also in the AUR. Rather than first building "foo", then installing "foo", then building "bar", and finally removing "foo", the local repo will save a copy of foo.pkg.tar.xz which is indexed automatically therein. Pacman within the chroot is aware of the "foo" package thanks to the local repo. So, when the user tries to build "bar", pacman will silently grabs foo.pkg.tar.xz from the local repo as any other dependency. ## Download AUR Package: ## Setup `$XDG_CONFIG_HOME/clean-chroot-manager.conf` will be created on the first invocation of ccm and contains all user managed settings. Edit this file prior to running ccm a second time. Make sure the user running ccm has sudo rights to execute `/usr/bin/clean-chroot-manager` or `/usr/bin/ccm`. ## Options | Command | Description | | :---: | --- | | a | Add packages in current dir to the local repo. | | c | Create a clean chroot. | | cd | Create a clean chroot with distcc enabled (if you do not want to set up in the config file). | | cp | Purge all files in the CCACHE_DIR (optional if building with ccache). | | d | Delete all packages in the local repo without nuking the entire chroot (i.e. the packages you built to date). | | l | List the contents of the local repo (i.e. the packages you built to date). | | n | Nuke the clean chroot (delete it and everything under it). | | p | Preview settings. Show some bits about the chroot itself. | | R | Repackage the current package if built. The equivalent of `makepkg -sR` in the chroot. | | s | Run makepkg in build mode under the chroot. The equivalent of `makepkg -s` in the chroot. | | S | Run makepkg in build mode under the chroot without first cleaning it. Useful for rebuilds without dirtying the pristine chroot or when building packages with many of the same deps. | | t | Toggle [testing] and [community-testing] on/off in the chroot and update packages accordingly (upgrade or downgrade). | | ti | Show run time of current build. | | u | Update the packages inside the chroot. The equivalent of `pacman -Syu` in the chroot. | ## Example Usage Create a clean 64-bit chroot under the path defined in the aforementioned config file: ``` $ sudo ccm64 c ``` Attempt to build the package in the clean 64-bit chroot. If successful, the package will be added to a local pacman repo inside the chroot so that it will be available for use as a dependency for building other packages: ``` $ cd /path/to/PKGBUILD $ sudo ccm64 s ``` List out the contents of the 64-bit chroot's local repo assuming something has been built. Useful to see what is present: ``` $ sudo ccm64 l ``` Deletes everything under the top level of the 64-bit chroot effectively removing it from the system: ``` $ sudo ccm64 n ``` ## Tips * Since ccm requires sudo rights, consider making an alias for invoking it as such in your ~/.bashrc or the like. For example: ``` alias ccm64='sudo ccm64' ``` * If you have multiple PCs on your LAN, consider having them help you compile via distcc which is supported within ccm. See `$XDG_CONFIG_HOME/clean-chroot-manager.conf` for setup instructions. * If your machine has lots of memory, consider locating the chroot to tmpfs to avoid disk usage/minimize access times. One way is to simply define a directory to mount as tmpfs like so in `/etc/fstab`: `tmpfs /scratch tmpfs nodev,size=20G 0 0` In order to have the expected `CHROOTPATH64` directory created, we can use a systemd tmpfile like so: ``` /etc/tmpfiles.d/ccm_dirs.conf d /scratch/.chroot64 0750 foo users - Note that this is only needed if the location of the chroots are on a volatile filesystem like tmpfs. ```