source: trunk/target/imagebuilder/files/opkg-generate-config.sh @ 22997

Last change on this file since 22997 was 22997, checked in by jow, 6 years ago

[imagebuilder] fix a small typo in sed pattern

  • Property svn:executable set to *
File size: 993 bytes
Line 
1#!/bin/sh
2
3TOPDIR="$(pwd)"
4TARGETDIR="${1}"
5
6[ -f "$TOPDIR/scripts/${0##*/}" ] || {
7        echo "Please execute within the toplevel directory" >&2
8        exit 1
9}
10
11# Try to find package architecture from packages directory
12PKGARCH=
13for pkg in $TOPDIR/packages/*.ipk; do
14        if [ -f "$pkg" ]; then
15                PKGARCH="${pkg##*/}"
16                PKGARCH="${PKGARCH#*_*_}"
17                PKGARCH="${PKGARCH%.ipk}"
18                [ "$PKGARCH" = all ] || break
19        fi
20done
21
22# Try to find package architecture from the target directory
23[ -n "$PKGARCH" ] || {
24        PKGARCH="${TARGETDIR##*/root-}"
25        [ "$PKGARCH" != "$TARGETDIR" ] || {
26                echo "Cannot determine package architecture" >&2
27                exit 1
28        }
29}
30
31rm -f $TOPDIR/tmp/opkg.conf
32
33[ -f $TOPDIR/repositories.conf ] && \
34        $TOPDIR/staging_dir/host/bin/sed \
35                -n -e "s/\$A/$PKGARCH/g" -e "/^[[:space:]]*src/p" \
36                $TOPDIR/repositories.conf > $TOPDIR/tmp/opkg.conf
37
38cat <<EOT >> $TOPDIR/tmp/opkg.conf
39dest root /
40arch all 100
41arch $PKGARCH 200
42option offline_root $TARGETDIR
43src imagebuilder file:$TOPDIR/packages
44EOT
45
46exit 0
Note: See TracBrowser for help on using the repository browser.