Skip to content
This repository
Browse code

Merge pull request #79 from alexkonradi/enhancement/multiple-deb-pack…

…age-sources

Extend .deb package importing to support multiple sources
  • Loading branch information...
commit 32aa62fae2890352d79422b94651d31250668e67 2 parents 3c847fe + b33f484
tjmcs tjmcs authored
25 bin/deb2tcz.sh
@@ -20,6 +20,12 @@ INPUT=${DEB_FILE##*.}
20 20 [ -d "$PKGDIR" ] || mkdir -p "$PKGDIR"
21 21 [ -d "${TMPDIR}" ] || mkdir -p "${TMPDIR}"
22 22
  23 +setupStartupScript() {
  24 + [ -d "$PKG"/usr/local/tce.installed ] || mkdir -p "$PKG/usr/local/tce.installed/"
  25 + chmod 775 "$PKG/usr/local/tce.installed/"
  26 + chown root:root "$PKG/usr/local/tce.installed/"
  27 +}
  28 +
23 29 make_tcz() {
24 30 mkdir -p "$PKG"
25 31 mkdir -p "$CFG"
@@ -36,25 +42,26 @@ make_tcz() {
36 42 cd "$PKG"
37 43 find . -type d -empty | xargs rmdir > /dev/null 2>&1
38 44 if [ -f "$CFG"/postinst ]; then
  45 + TCZ_FILENAME=`basename ${TCZ_FILE%.tcz}`
39 46 mkdir -p "$PKG/usr/local/postinst"
40   - cp "$CFG/postinst" "$PKG/usr/local/postinst/${TCZ_FILE%.tcz}"
41   - SCRIPT='/usr/local/postinst/'${TCZ_FILE%.tce}' configure 2>/dev/null'
  47 + cp "$CFG/postinst" "$PKG/usr/local/postinst/$TCZ_FILENAME"
  48 + SCRIPT='/usr/local/postinst/'$TCZ_FILENAME' configure 2>/dev/null'
42 49 setupStartupScript
43   - echo "${SCRIPT}" > "$PKG/usr/local/tce.installed/${TCZ_FILE%.tcz}"
44   - chmod 755 "$PKG/usr/local/tce.installed/${TCZ_FILE%.tcz}"
  50 + echo "${SCRIPT}" > "$PKG/usr/local/tce.installed/$TCZ_FILENAME"
  51 + chmod 755 "$PKG/usr/local/tce.installed/$TCZ_FILENAME"
45 52 fi
46 53
47 54 cd "$PKGDIR"
48 55
49 56 IMPORTMIRROR="http://distro.ibiblio.org/tinycorelinux/4.x/importscripts"
50   - wget -O "${TMPDIR}${TCZ_FILE}.deb2tcz" -cq "$IMPORTMIRROR"/"${TCZ_FILE}.deb2tcz" 2>/dev/null
  57 + wget -O "${TMPDIR}${TCZ_FILENAME}.deb2tcz" -cq "$IMPORTMIRROR"/"${TCZ_FILENAME}.deb2tcz" 2>/dev/null
51 58 if [ -f "${TMPDIR}${TCZ_FILE}.deb2tcz" ]
52 59 then
53   - echo Merging Tiny Core custom start script for $TCZ_FILE: "${TCZ_FILE}.deb2tcz"
  60 + echo Merging Tiny Core custom start script for $TCZ_FILE: "${TCZ_FILENAME}.deb2tcz"
54 61 setupStartupScript
55   - cat "${TMPDIR}${TCZ_FILE}.deb2tcz" >> "$PKG/usr/local/tce.installed/${TCZ_FILE%.tcz}"
56   - chmod 755 "$PKG/usr/local/tce.installed/${TCZ_FILE%.tcz}"
57   - rm "${TMPDIR}${TCZ_FILE}.deb2tcz"
  62 + cat "${TMPDIR}${TCZ_FILENAME}.deb2tcz" >> "$PKG/usr/local/tce.installed/${TCZ_FILENAME%.tcz}"
  63 + chmod 755 "$PKG/usr/local/tce.installed/${TCZ_FILENAME%.tcz}"
  64 + rm "${TMPDIR}${TCZ_FILENAME}.deb2tcz"
58 65 fi
59 66
60 67 cd "$HERE"
2  bin/download-deb-pkg
@@ -42,7 +42,7 @@ elif [ -z $DEB_PKG_NAME ]; then
42 42 fi
43 43
44 44 DEB_OUTPUT_FILE="$OUTPUT_DIR"/"$DEB_PKG_NAME".deb
45   -DEB_DOWNLOAD_FILE=`grep "^$DEB_PKG_NAME " "$LIST_FILE"|sed "s/^$DEB_PKG_NAME\s//"`
  45 +DEB_DOWNLOAD_FILE=`grep -m 1 "^$DEB_PKG_NAME " "$LIST_FILE"|sed "s/^$DEB_PKG_NAME\s//"`
46 46
47 47 if [ -z $DEB_DOWNLOAD_FILE ]; then
48 48 printf "\nError; could not find the package '$DEB_PKG_NAME'"
26 bin/download-deb-pkg-list
@@ -2,14 +2,13 @@
2 2 #
3 3 # Used to download and convert a gzip-ed debian package list
4 4
  5 +PKG_URL=()
  6 +
5 7 while [ $# -gt 0 ]
6 8 do
7 9 case $1 in
8 10 -l|--list-url)
9   - PKG_URL=$2
10   - shift;;
11   - -d|--download-dir)
12   - OUTPUT_DIR=$2
  11 + PKG_URL+=(`echo $2 | tr -d "'"`)
13 12 shift;;
14 13 -f|--list-file)
15 14 PKG_FILE=$2
@@ -18,19 +17,22 @@ do
18 17 shift
19 18 done
20 19
21   -[ -z "$PKG_URL" ] && PKG_URL='http://distro.ibiblio.org/tinycorelinux/5.x/x86/debian_wheezy_main_i386_Packages.gz'
  20 +[ -z "${PKG_URL[*]}" ] && PKG_URL=('http://distro.ibiblio.org/tinycorelinux/5.x/x86/debian_wheezy_main_i386_Packages.gz')
22 21 [ -z "$OUTPUT_DIR" ] && OUTPUT_DIR='./'
23 22
24   -PKG_DOWNLOAD_FILE="$OUTPUT_DIR"/$(basename "$PKG_URL")
25   -
26 23 PKG_PROCESSED_FILE="$OUTPUT_DIR"/dpkg-pkg-list
  24 +
27 25 [ -z "$PKG_FILE" ] || PKG_PROCESSED_FILE="$PKG_FILE"
28 26
29   -wget -N -P "$OUTPUT_DIR" "$PKG_URL";
30   -if [ "$PKG_DOWNLOAD_FILE" -nt "$PKG_PROCESSED_FILE" ]; then
31   - echo "Processing new package list..."
  27 +rm "$PKG_PROCESSED_FILE"
  28 +
  29 +echo "Downloading and processing package list(s)..."
  30 +
  31 +for URL in "${PKG_URL[@]}"; do
  32 + echo Downloading and processing $URL
  33 + wget -O - --retr-symlinks -P "$OUTPUT_DIR" "$URL" |
32 34 gunzip -c $PKG_DOWNLOAD_FILE | grep -P "^(Package|Filename):" | sed -e '{
33 35 N
34 36 s/Package:\s*\(.*\)\nFilename:\s*\(.*\)/\1 \2/
35   - }' > "$PKG_PROCESSED_FILE"
36   -fi
  37 + }' >> "$PKG_PROCESSED_FILE"
  38 +done
20 build-bundle-file.sh
@@ -57,7 +57,7 @@ read_config_file()
57 57 }
58 58
59 59 # options may be followed by one colon to indicate they have a required argument
60   -if ! options=$(getopt -o hb:m:pdt:c:v -l help,builtin-list:,mirror-list:,build-prod-image,build-debug-image,tc-passwd:,config:,verbose -- "$@")
  60 +if ! options=$(getopt -o hb:m:pdt:c:v -l help,builtin-list:,mirror-list:,build-prod-image,build-debug-image,tc-passwd:,config:,verbose,dpkg-list: -- "$@")
61 61 then
62 62 usage
63 63 # something went wrong, getopt will put out an error message for us
@@ -69,6 +69,9 @@ set -- $options
69 69 WGET_V='-nv'
70 70 TAR_V=''
71 71
  72 +# Explicitly create DEB_PACKAGE_LIST_URL as an array
  73 +DEB_PACKAGE_LIST_URL=()
  74 +
72 75 # loop through the command line arguments, parsing them as we go along
73 76 # (and shifting them off of the list of command line arguments as they,
74 77 # and their arguments if they have any, are parsed). Note the use of
@@ -120,6 +123,9 @@ do
120 123 printf " and its value? If so, you might not get the password you expect...\n"
121 124 fi;
122 125 shift;;
  126 + --dpkg-list)
  127 + DEB_PACKAGE_LIST_URL+=(`echo $2 | tr -d "'"`)
  128 + shift;;
123 129 -c|--config) CONFIG_FILE=`printf '%s' "$2" | tr -d "'" | sed 's:^[=]\?\(.*\)$:\1:'`; shift;;
124 130 -h|--help) usage; exit 0;;
125 131 -v|--verbose)
@@ -171,10 +177,9 @@ fi
171 177 [ -z "$TCL_ISO_URL" ] && TCL_ISO_URL='http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/Core-current.iso'
172 178 [ -z "$RUBY_GEMS_URL" ] && RUBY_GEMS_URL='http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz'
173 179 [ -z "$OPEN_VM_TOOLS_URL" ] && OPEN_VM_TOOLS_URL='http://downloads.puppetlabs.com/razor/open-vm-tools/mk-open-vm-tools.tar.gz'
174   -[ -z "$DEB_PACKAGE_LIST_URL" ] && DEB_PACKAGE_LIST_URL='http://distro.ibiblio.org/tinycorelinux/5.x/x86/debian_wheezy_main_i386_Packages.gz'
  180 +[ -z "${DEB_PACKAGE_LIST_URL[*]}" ] && DEB_PACKAGE_LIST_URL[0]='http://distro.ibiblio.org/tinycorelinux/5.x/x86/debian_wheezy_main_i386_Packages.gz'
175 181 [ -z "$DEB_MIRROR_URL" ] && DEB_MIRROR_URL='ftp://ftp.us.debian.org/debian'
176 182
177   -
178 183 # Save our top level directory; watch out for spaces!
179 184 TOP_DIR="${PWD}"
180 185
@@ -253,8 +258,13 @@ mkdir -p tmp-build-dir/root
253 258 cp rz_mk_gemrc.yaml tmp-build-dir/root/.gemrc
254 259
255 260 # Download the .deb package list if necessary
256   -if [ `cat "$MIRROR_LIST" "$BUILTIN_LIST" | grep .deb$` 2>/dev/null ]; then
257   - ./bin/download-deb-pkg-list --list-url "$DEB_PACKAGE_LIST_URL" --download-dir "./tmp/" --list-file "./tmp/dpkg-package-list"
  261 +if [ ! -z "`cat "$MIRROR_LIST" "$BUILTIN_LIST" | grep .deb$`" ]; then
  262 + LIST_ARGS=""
  263 + for URL in "${DEB_PACKAGE_LIST_URL[@]}"; do
  264 + echo $URL
  265 + LIST_ARGS+=" --list-url $URL"
  266 + done
  267 + ./bin/download-deb-pkg-list $LIST_ARGS --download-dir "./tmp/" --list-file "./tmp/dpkg-package-list"
258 268 fi
259 269
260 270 # create a copy of the local TCL Extension mirror that we will be running within

0 comments on commit 32aa62f

Please sign in to comment.
Something went wrong with that request. Please try again.