tcreate cache repo outside of the chroot - libdevuansdk - common library for devuan's simple distro kits HTML git clone https://git.parazyd.org/libdevuansdk DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- DIR commit 5152c1fafa3616914b8e58923a97e9a337af7090 DIR parent 9989685971a3932f3a6f20a0ffe84412edef8ba2 HTML Author: parazyd <parazyd@dyne.org> Date: Mon, 22 May 2017 00:02:25 +0200 create cache repo outside of the chroot Diffstat: M libdevuansdk | 1 + A zlibs/cache | 76 +++++++++++++++++++++++++++++++ M zlibs/helpers | 51 ------------------------------- 3 files changed, 77 insertions(+), 51 deletions(-) --- DIR diff --git a/libdevuansdk b/libdevuansdk t@@ -22,6 +22,7 @@ LIBPATH=${LIBPATH:-$(dirname $0)} source $LIBPATH/config source $LIBPATH/zlibs/bootstrap +source $LIBPATH/zlibs/cache source $LIBPATH/zlibs/helpers source $LIBPATH/zlibs/imaging source $LIBPATH/zlibs/iso DIR diff --git a/zlibs/cache b/zlibs/cache t@@ -0,0 +1,76 @@ +#!/usr/bin/env zsh +# Copyright (c) 2017 Dyne.org Foundation +# libdevuansdk is maintained by Ivan J. <parazyd@dyne.org> +# +# This file is part of libdevuansdk +# +# This source code is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this source code. If not, see <http://www.gnu.org/licenses/>. + +aptcache() { + fn aptcache "$*" + req=(aptcachedir watdo werdo APT_CACHE) + local watdo="$1" + local werdo="$2" + ckreq || return 1 + + [[ $APT_CACHE = 1 ]] || return 0 + + case "$watdo" in + on) + act "mounting local apt cache" + sudo mount -o bind "$aptcachedir" "$werdo" || zerr + ;; + off) + act "umounting local apt cache" + sudo umount "$werdo" || zerr + ;; + esac +} + +fill_apt_cache() { + fn fill_apt_cache + req=(strapdir APT_CACHE aptcachedir) + ckreq || return 1 + + [[ $APT_CACHE = 1 ]] || return 0 + + notice "filling local apt cache" + + cp -fv "$strapdir/var/cache/archives/*.deb" "$aptcachedir" + + pushd "$aptcachedir" + dpkg-scanpackages . /dev/null > Packages + gzip -c Packages > Packages.gz + cat <<EOF > Release +Origin: ${os} +Suite: ${release} +Version: ${version} +Architectures: alpha amd64 arm64 armel armhf hppa i386 ia64 mips mipsel powerpc ppc64el s390x sparc +MD5sum: + $(md5sum Packages | cut -d' ' -f1) $(du -b Packages) + $(md5sum Packages.gz | cut -d' ' -f1) $(du -b Packages.gz) +SHA1: + $(sha1sum Packages | cut -d' ' -f1) $(du -b Packages) + $(sha1sum Packages.gz | cut -d' ' -f1) $(du -b Packages.gz) +SHA256: + $(sha256sum Packages | cut -d' ' -f1) $(du -b Packages) + $(sha256sum Packages.gz | cut -d' ' -f1) $(du -b Packages.gz) +EOF + rm -f Packages + ## TODO: XXX: gpg sign Release + popd + + + sudo sed -i -e '@deb file:/mnt@d' "$strapdir/etc/apt/sources.list" +} DIR diff --git a/zlibs/helpers b/zlibs/helpers t@@ -357,57 +357,6 @@ blend_postinst() { return 0 } -aptcache() { - fn aptcache "$*" - req=(aptcachedir watdo werdo APT_CACHE) - local watdo="$1" - local werdo="$2" - ckreq || return 1 - - [[ $APT_CACHE = 1 ]] || return 0 - - case "$watdo" in - on) - act "mounting local apt cache" - sudo mount -o bind "$aptcachedir" "$werdo" || zerr - ;; - off) - act "umounting local apt cache" - sudo umount "$werdo" || zerr - ;; - esac -} - -fill_apt_cache() { - fn fill_apt_cache - req=(strapdir APT_CACHE) - ckreq || return 1 - - [[ $APT_CACHE = 1 ]] || return 0 - - notice "filling local apt cache" - - cat <<EOF | sudo tee ${strapdir}/fill-apt-cache >/dev/null -#!/bin/sh - -# NOTE: do we need apt update or does it read the remote(s)? -apt-get update -apt-get --yes --force-yes --no-install-recommends install dpkg-dev - -cp -afv /var/cache/apt/archives/*.deb /mnt -cd /mnt -dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz -cd - - -apt-get --yes --force-yes purge dpkg-dev - -sed -i -e "@deb file:/mnt@d" /etc/apt/sources.list -apt-get update - -EOF - chroot-script fill-apt-cache || zerr -} - silly() { fn silly "$@" local arg1="$1"