diff options
-rwxr-xr-x | fullpkg-find | 7 | ||||
-rw-r--r-- | librebasebuilder | 66 | ||||
-rwxr-xr-x | libremakepkg | 2 | ||||
-rw-r--r-- | libretools.conf | 4 | ||||
-rwxr-xr-x | toru | 32 |
5 files changed, 91 insertions, 20 deletions
diff --git a/fullpkg-find b/fullpkg-find index 9ddfa08..64c1790 100755 --- a/fullpkg-find +++ b/fullpkg-find @@ -34,6 +34,7 @@ get_fullver() { # Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. find_deps() { # Check this level + source /etc/makepkg.conf source PKGBUILD local repo="${repo:-$(guess_repo)}" @@ -47,7 +48,11 @@ find_deps() { fi fi - if is_built "${pkgbase}" "${fullver}"; then + # Checking any package built, since otherwise e.g. kdebase would + # be always considered outdated: there is no package built named kdebase. + # TODO: maybe check for the package requested in case of recursive calls, + # instead of the first one listed? + if is_built "${pkgname[0]}" "${fullver}"; then exit 0 # pkg is built and updated fi diff --git a/librebasebuilder b/librebasebuilder new file mode 100644 index 0000000..3eaadd8 --- /dev/null +++ b/librebasebuilder @@ -0,0 +1,66 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +# Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu> +# +# This program 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 program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +set -e + +# TODO: + +# - make it more configurable + +# - compare the result with previous base images + +for arg in "$@" ; do + case "$arg" in + -h|--h|--he|--hel|--help|-\?) + echo 'Usage: librebasebuilder + +Make a base tarball named parabola-mips64el-DATE.tar.bz2. + +This script must be run as root.' >&2 + exit 0 + ;; + esac +done + +[[ "$UID" != "0" ]] && { + echo "This script must be run as root." >&2 + exit 1 +} + +tempdir=/home/chroot/base +outdir=$(pwd) + +mkarchroot $tempdir mkinitcpio base sudo parted nano zile vi ed openssh + +cd $tempdir + +# Don't list mtjm's DNS servers. +cat > etc/resolv.conf <<EOF +# +# /etc/resolv.conf +# + +#search <yourdomain.tld> +#nameserver <ip> + +# End of file +EOF + +rm .arch-chroot + +tar cjf $outdir/parabola-mips64el-$(LC_ALL=C date -u +%Y%m%d).tar.bz2 . diff --git a/libremakepkg b/libremakepkg index 44c0d29..7db0e3c 100755 --- a/libremakepkg +++ b/libremakepkg @@ -118,7 +118,7 @@ fi unset CLEANFIRST UPDATEFIRST LIBRECHROOT_ARGS -makechrootpkg -d -r "$CHROOTDIR" -l "$CHROOT" $MAKEPKG_ARGS +makechrootpkg -d -r "$CHROOTDIR" -l "$CHROOT" -- $MAKEPKG_ARGS ev="$?" # exit value copy_log diff --git a/libretools.conf b/libretools.conf index 9e7f938..514c37d 100644 --- a/libretools.conf +++ b/libretools.conf @@ -49,9 +49,9 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git ## Uncomment one of those or make one of your choice # Normal fullpkg -FULLBUILDCMD="sudo libremakepkg -cuN -- -d" +FULLBUILDCMD="sudo libremakepkg -cuN" # Cross compiling fullkpg -# FULLBUILDCMD="sudo libremakepkg -cuN -d '/path/to/cross-compiling/chroot' -- -d" +# FULLBUILDCMD="sudo libremakepkg -cuN -d '/path/to/cross-compiling/chroot'" ## Toru # Section for toru's vars @@ -109,15 +109,15 @@ update() { local -a package_paths=() # Traverse all specified repos - for _repo in $@; do + for __repo in $@; do # Check if the repo is set as such, otherwise skip - is_repo ${_repo} || continue + is_repo ${__repo} || continue # Fullpath of the repo - _repopath=$(readlink -f ${_repo}) + _repopath=$(readlink -f ${__repo}) # This is the syncfile, stores the last date as content and mtime - local lastsyncfile=${TORUPATH}/${_repo}.lastsync + local lastsyncfile=${TORUPATH}/${__repo}.lastsync # Find all the PKGBUILDs newer than the last update # Update newer, otherwise everything @@ -131,13 +131,13 @@ update() { # Only find newer than lastsyncfile and read everything else from cache pkgbuilds=($(find ${_repopath} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) - packages_in_abs=($(read_cache ${_repo})) + packages_in_abs=($(read_cache ${__repo})) $quiet || msg2 "Getting ${#packages_in_abs[@]} packages from cache" fi - package_paths=($(read_cache ${_repo}.paths || true)) + package_paths=($(read_cache ${__repo}.paths || true)) # Inform how many PKGBUILDS were found and quit immediately if none $quiet || msg "Found $((${#pkgbuilds[*]}-1)) PKGBUILDs to update" @@ -177,16 +177,16 @@ update() { # Sync! (Only if there was an actual sync) ${update_sync_file} && lastsync ${lastsyncfile} - if [ "${lastsyncfile}" -nt "${TORUPATH}/${_repo}.paths.cache" ]; then + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.paths.cache" ]; then print_package_array "${package_paths[@]}" > $TMPDIR/paths - store_cache ${_repo}.paths $TMPDIR/paths + store_cache ${__repo}.paths $TMPDIR/paths fi # If there isn't an update cache or it's older than the last update, we check - if [ "${lastsyncfile}" -nt "${TORUPATH}/${_repo}.updates.cache" ]; then + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.updates.cache" ]; then # Get repo database contents - packages_in_sync=($(get_db_contents ${_repo})) + packages_in_sync=($(get_db_contents ${__repo})) # Drops arrays into files print_package_array "${packages_in_abs[@]}" > ${TMPDIR}/packages_in_abs print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync @@ -227,17 +227,17 @@ update() { unset _pkg _syncver _absver need_line # Save the cache - store_cache ${_repo} ${TMPDIR}/packages_in_abs + store_cache ${__repo} ${TMPDIR}/packages_in_abs # See above FIXME # print_package_array "${updates[@]}" > ${TMPDIR}/updates if [ -r ${TMPDIR}/updates ]; then - store_cache ${_repo}.updates ${TMPDIR}/updates + store_cache ${__repo}.updates ${TMPDIR}/updates fi else $quiet || msg "Reading updates from cache..." - read_cache ${_repo}.updates + read_cache ${__repo}.updates fi done # end repos @@ -252,10 +252,10 @@ missing() { ## usage: where_is <pkgname> # Look in all caches but pick the first one where_is() { - local _repo + local __repo local _path - for _repo in ${REPOS[@]}; do - _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null | + for __repo in ${REPOS[@]}; do + _path=$(grep "^${1}:" "${TORUPATH}/${__repo}.paths.cache" 2>/dev/null | cut -d: -f2) [ -n "${_path}" ] && break |