Skip to content

Commit

Permalink
Some scripts to recreate packages from an installed OpenWRT tree
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwartzenberg committed Oct 2, 2024
1 parent d03f3dc commit a27122f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/ipkg-build-all-from-installed
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

root_dir=$1
destination=$2

for package in ${root_dir}/usr/lib/opkg/info/*.list
do
echo ${package}
./ipkg-build-from-installed ${package::-5} ${destination}
done
43 changes: 43 additions & 0 deletions scripts/ipkg-build-from-installed
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

# Create directory from installed package and build it

set -e
usage="Usage: $0 [-v] [-h] [-m] <pkg_path> [<destination_directory>]"
case $# in
1)
dest_dir=$PWD
;;
2)
dest_dir=$2
if [ "$dest_dir" = "." ] || [ "$dest_dir" = "./" ] ; then
dest_dir=$PWD
fi
;;
*)
echo "$usage" >&2
exit 1
;;
esac

tmp_dir=${dest_dir}/$(basename ${0}).$$

# This will be usr/lib/opkg/info/package[,.list,.control]
input_file="$(realpath "${1}")"
root_dir=$(dirname ${input_file})/../../../..

mkdir -p ${tmp_dir}/CONTROL
cp ${input_file}.control ${tmp_dir}/CONTROL/control

prev_dir=${PWD}
cd ${root_dir}
while read line
do
echo ${line}
echo ${tmp_dir}
cp -a --parents .${line} ${tmp_dir}/
done < ${input_file}.list
cd ${prev_dir}

./ipkg-build ${tmp_dir} ${dest_dir}
rm -r ${tmp_dir}

0 comments on commit a27122f

Please sign in to comment.