Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For making SD card images and compressed packages etc. Signed-off-by: Christopher Hall <hsw@openmoko.com>
- Loading branch information
Showing
4 changed files
with
961 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#!/bin/sh | ||
# create an SD card image | ||
|
||
USAGE() | ||
{ | ||
[ -z "$1" ] || echo error: $* | ||
echo usage: $(basename "$0") '<options> <languages>' | ||
echo ' --help -h this message' | ||
echo ' --verbose -v more messages' | ||
echo ' --image=<dir> -i <dir> image source directory [image]' | ||
echo ' --card=<dir> -c <dir> image destination directory (no-default)' | ||
exit 1 | ||
} | ||
|
||
|
||
verbose=no | ||
image=image | ||
card= | ||
suffix=pedia | ||
|
||
debug=no | ||
|
||
getopt=/usr/local/bin/getopt | ||
[ -x "${getopt}" ] || getopt=getopt | ||
args=$(${getopt} -o hvi:c: --long=help,verbose,image:,card:,debug -- "$@") ||exit 1 | ||
|
||
# replace the arguments with the parsed values | ||
eval set -- "${args}" | ||
|
||
while : | ||
do | ||
case "$1" in | ||
-v|--verbose) | ||
verbose=yes | ||
shift | ||
;; | ||
|
||
-i|--image) | ||
image="$2" | ||
shift 2 | ||
;; | ||
|
||
-c|--card) | ||
card="$2" | ||
shift 2 | ||
;; | ||
|
||
--debug) | ||
debug=yes | ||
shift | ||
;; | ||
|
||
--) | ||
shift | ||
break | ||
;; | ||
|
||
-h|--help) | ||
USAGE | ||
;; | ||
|
||
*) | ||
USAGE invalid option: $1 | ||
;; | ||
esac | ||
done | ||
|
||
# verify arguments | ||
[ -z "${card}" ] && USAGE card is not set | ||
[ -z "${image}" ] && USAGE image is not set | ||
[ $# -eq 0 ] && USAGE at least one language must be specified | ||
|
||
[ -d "${card}" ] || USAGE card: ${card} is not a directory | ||
[ -f "${card}/kernel.elf" ] && USAGE already copied | ||
|
||
for d in $@ | ||
do | ||
flag=NO | ||
for i in ${image} | ||
do | ||
dir="${i}/${d}${suffix}" | ||
if [ -d "${dir}" -o -d "${i}/${d}" ] | ||
then | ||
flag=YES | ||
break | ||
fi | ||
done | ||
[ X"YES" = X"${flag}" ] || USAGE language ${d} not found | ||
done | ||
|
||
for d in $@ | ||
do | ||
for i in ${image} | ||
do | ||
dir="${i}/${d}${suffix}" | ||
if [ -d "${dir}" ] | ||
then | ||
echo copying language: ${d} | ||
cp -pr "${dir}" "${card}" | ||
break | ||
fi | ||
dir="${i}/${d}" | ||
if [ -d "${dir}" ] | ||
then | ||
echo copying directory: ${d} | ||
cp -pr "${dir}" "${card}" | ||
break | ||
fi | ||
done | ||
done | ||
|
||
echo copying base files | ||
for f in "${image}/"* | ||
do | ||
[ ! -d "${f}" ] && cp -p "${f}" "${card}" | ||
done | ||
|
||
echo completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/sh | ||
# push files to remotes | ||
|
||
ERROR() | ||
{ | ||
echo error: $* | ||
exit 1 | ||
} | ||
|
||
USAGE() | ||
{ | ||
[ -z "$1" ] || echo error: $* | ||
echo usage: $(basename "$0") '<options>' | ||
echo ' --help -h this message' | ||
echo ' --list=<n-m> -l <n-m> restrict to certain machines [1-9]' | ||
echo ' --dir=<dir> -d <dir> set destination directory' | ||
echo ' --simul -2 switch to the other farm' | ||
exit 1 | ||
} | ||
|
||
# main program | ||
# ------------ | ||
|
||
verbose=no | ||
dir=. | ||
list='' | ||
render_host='' | ||
|
||
getopt=/usr/local/bin/getopt | ||
[ -x "${getopt}" ] || getopt=getopt | ||
args=$(${getopt} -o hvl:d:2 --long=help,verbose,list:,dir:,simul -- "$@") || exit 1 | ||
# replace the arguments with the parsed values | ||
eval set -- "${args}" | ||
|
||
while : | ||
do | ||
case "$1" in | ||
-v|--verbose) | ||
verbose=yes | ||
shift | ||
;; | ||
|
||
-l|--list) | ||
list="--list=$2" | ||
shift 2 | ||
;; | ||
|
||
-d|--dir) | ||
dir="$2" | ||
shift 2 | ||
;; | ||
|
||
-2|--simul) | ||
render_host='--host=simul3' | ||
shift | ||
;; | ||
|
||
--) | ||
shift | ||
break | ||
;; | ||
|
||
-h|--help) | ||
USAGE | ||
;; | ||
|
||
*) | ||
USAGE invalid option: $1 | ||
;; | ||
esac | ||
done | ||
|
||
for host in $(RenderDo ${render_host} ${list} --print-list) | ||
do | ||
for sf in "$@" | ||
do | ||
df="wr@${host}:${dir}/${sf}" | ||
case "${verbose}" in | ||
[yY]|[yY][eE][sS]) | ||
echo Copy: ${sf} To: ${df} | ||
;; | ||
*) | ||
;; | ||
esac | ||
scp -p "${sf}" "${df}" | ||
done | ||
done | ||
|
||
echo completed |
Oops, something went wrong.