summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlb5
-rw-r--r--librebasebuilder66
-rwxr-xr-xtoru32
3 files changed, 85 insertions, 18 deletions
diff --git a/lb b/lb
index d4bd908..85fb4df 100755
--- a/lb
+++ b/lb
@@ -6,10 +6,11 @@ source /etc/libretools.conf
command=$1; shift
-[[ ! -f ~/l/libre${command} ]] && {
+[[ ! -x ~/l/libre"${command}" ]] && {
error "Command not found"
+ exit 1
}
-~/l/libre${command} $@
+~/l/libre${command} "$@"
exit $?
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/toru b/toru
index 766331b..28f0b8a 100755
--- a/toru
+++ b/toru
@@ -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