| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Load common constants. This should be the first executable line. | 7 # Load common constants. This should be the first executable line. |
| 8 # The path to common.sh should be relative to your script's location. | 8 # The path to common.sh should be relative to your script's location. |
| 9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
| 10 | 10 |
| 11 # Script must be run outside the chroot and as a regular user. | 11 # Script must be run outside the chroot and as a regular user. |
| 12 assert_outside_chroot | 12 assert_outside_chroot |
| 13 assert_not_root_user | 13 assert_not_root_user |
| 14 | 14 |
| 15 DEFAULT_DEST="$GCLIENT_ROOT/repo" | 15 DEFAULT_DEST="$GCLIENT_ROOT/repo" |
| 16 DEFAULT_DEV_PKGLIST="$SRC_ROOT/package_repo/repo_list_dev.txt" | 16 DEFAULT_DEV_PKGLIST="$SRC_ROOT/package_repo/repo_list_dev.txt" |
| 17 DEFAULT_IMG_PKGLIST="$SRC_ROOT/package_repo/repo_list_image.txt" | 17 DEFAULT_IMG_PKGLIST="$SRC_ROOT/package_repo/repo_list_image.txt" |
| 18 | 18 |
| 19 # Command line options | 19 # Command line options |
| 20 DEFINE_string suite "$DEFAULT_EXT_SUITE" "Ubuntu suite to pull packages from." | 20 DEFINE_string suite "$DEFAULT_EXT_SUITE" "Ubuntu suite to pull packages from." |
| 21 DEFINE_string mirror "$DEFAULT_EXT_MIRROR" "Ubuntu repository mirror to use." | 21 DEFINE_string mirror "$DEFAULT_EXT_MIRROR" "Ubuntu repository mirror to use." |
| 22 DEFINE_string mirror2 "" "Optional Chromium repository mirror to use." |
| 22 DEFINE_string dest "$DEFAULT_DEST" "Destination directory for repository." | 23 DEFINE_string dest "$DEFAULT_DEST" "Destination directory for repository." |
| 23 DEFINE_string devlist "$DEFAULT_DEV_PKGLIST" \ | 24 DEFINE_string devlist "$DEFAULT_DEV_PKGLIST" \ |
| 24 "File listing packages to use for development." | 25 "File listing packages to use for development." |
| 25 DEFINE_string imglist "$DEFAULT_IMG_PKGLIST" \ | 26 DEFINE_string imglist "$DEFAULT_IMG_PKGLIST" \ |
| 26 "File listing packages to use for image." | 27 "File listing packages to use for image." |
| 27 DEFINE_string devsuite "$DEFAULT_DEV_SUITE" "Dev suite to update." | 28 DEFINE_string devsuite "$DEFAULT_DEV_SUITE" "Dev suite to update." |
| 28 DEFINE_string imgsuite "$DEFAULT_IMG_SUITE" "Image suite to update." | 29 DEFINE_string imgsuite "$DEFAULT_IMG_SUITE" "Image suite to update." |
| 29 DEFINE_boolean updev $FLAGS_TRUE "Update development repository." | 30 DEFINE_boolean updev $FLAGS_TRUE "Update development repository." |
| 30 DEFINE_boolean upimg $FLAGS_TRUE "Update image repository." | 31 DEFINE_boolean upimg $FLAGS_TRUE "Update image repository." |
| 31 | 32 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 156 |
| 156 echo "Updating $SUITE from $PKGLIST..." | 157 echo "Updating $SUITE from $PKGLIST..." |
| 157 | 158 |
| 158 # Clear the suite first | 159 # Clear the suite first |
| 159 # Since packages are either source or not, this removes all of them. | 160 # Since packages are either source or not, this removes all of them. |
| 160 in_chroot reprepro -b "$REPO_SUBDIR" removefilter "$SUITE" "!Source" | 161 in_chroot reprepro -b "$REPO_SUBDIR" removefilter "$SUITE" "!Source" |
| 161 in_chroot reprepro -b "$REPO_SUBDIR" removefilter "$SUITE" "Source" | 162 in_chroot reprepro -b "$REPO_SUBDIR" removefilter "$SUITE" "Source" |
| 162 | 163 |
| 163 # Add packages to the suite | 164 # Add packages to the suite |
| 164 echo "Downloading packages..." | 165 echo "Downloading packages..." |
| 165 for DEB in `grep -v '^#' < $PKGLIST | awk '{print $1}'` | 166 grep -v '^#' < $PKGLIST | while read DEB DEB_VER DEB_PRIO DEB_SECTION DEB_PATH |
| 166 do | 167 do |
| 168 [ -z "$DEB" ] && continue |
| 167 echo "Adding $DEB..." | 169 echo "Adding $DEB..." |
| 168 | 170 |
| 169 DEB_PRIO=`cat $PKGLIST | grep '^'$DEB' ' | awk '{print $3}'` | 171 DEB_FILE=$DEB_CACHE_DIR/${DEB_PATH##*/} |
| 170 DEB_SECTION=`cat $PKGLIST | grep '^'$DEB' ' | awk '{print $4}'` | |
| 171 DEB_PATH=`cat $PKGLIST | grep '^'$DEB' ' | awk '{print $5}'` | |
| 172 DEB_FILE="$DEB_CACHE_DIR/"`basename $DEB_PATH` | |
| 173 | 172 |
| 174 # Download the package if necessary | 173 # Download the package if necessary |
| 175 if [ ! -e "$CHROOT/$DEB_FILE" ] | 174 if [ ! -s "$CHROOT/$DEB_FILE" ] |
| 176 then | 175 then |
| 177 in_chroot wget --no-verbose "$FLAGS_mirror/${DEB_PATH}" -O "$DEB_FILE" | 176 if [ -n "FLAGS_mirror2" ]; then |
| 177 in_chroot wget --no-verbose "$FLAGS_mirror/${DEB_PATH}" -O "$DEB_FILE" |
| \ |
| 178 in_chroot wget --no-verbose "$FLAGS_mirror2/${DEB_PATH}" -O "$DEB_FILE" |
| 179 else |
| 180 in_chroot wget --no-verbose "$FLAGS_mirror/${DEB_PATH}" -O "$DEB_FILE" |
| 181 fi |
| 178 fi | 182 fi |
| 179 | 183 |
| 180 # Copy the file into the target suite with the correct priority | 184 # Copy the file into the target suite with the correct priority |
| 181 in_chroot reprepro -b "$REPO_SUBDIR" -P "$DEB_PRIO" -S "$DEB_SECTION" \ | 185 in_chroot reprepro -b "$REPO_SUBDIR" -P "$DEB_PRIO" -S "$DEB_SECTION" \ |
| 182 includedeb "$SUITE" "$DEB_FILE" | 186 includedeb "$SUITE" "$DEB_FILE" |
| 183 done | 187 done |
| 184 } | 188 } |
| 185 | 189 |
| 186 #------------------------------------------------------------------------------ | 190 #------------------------------------------------------------------------------ |
| 187 | 191 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 217 | 221 |
| 218 if [ $FLAGS_upimg -eq $FLAGS_TRUE ] | 222 if [ $FLAGS_upimg -eq $FLAGS_TRUE ] |
| 219 then | 223 then |
| 220 update_suite $FLAGS_imgsuite $FLAGS_imglist | 224 update_suite $FLAGS_imgsuite $FLAGS_imglist |
| 221 fi | 225 fi |
| 222 | 226 |
| 223 # Clean up the chroot mounts | 227 # Clean up the chroot mounts |
| 224 cleanup_chroot_mounts | 228 cleanup_chroot_mounts |
| 225 | 229 |
| 226 echo "Done." | 230 echo "Done." |
| OLD | NEW |