Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: scripts/image_signing/set_lsb_release.sh

Issue 3164010: Fix set_lsb_release.sh issues with handling spaces in arguments. (Closed) Base URL: http://src.chromium.org/git/vboot_reference.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/image_signing/set_lsb_release.sh
diff --git a/scripts/image_signing/set_lsb_release.sh b/scripts/image_signing/set_lsb_release.sh
index 645e9870b74354a534b85c567a129ac4b1f0980c..3696bd25394e5075cec3c38e5261c607afacb879 100755
--- a/scripts/image_signing/set_lsb_release.sh
+++ b/scripts/image_signing/set_lsb_release.sh
@@ -6,14 +6,6 @@
# Customizes a Chrome OS release image by setting /etc/lsb-release values.
-# Usage: ./set_lsb_release.sh <image.bin> [<key> <value>]
-#
-# If executed with key/value parameters, sets <key>=<value> in
-# /etc/lsb-release and then dumps /etc/lsb-release to stdout. If
-# executed with no key/value, dumps /etc/lsb-release to stdout. Note
-# that the order of the keyvals in /etc/lsb-release may not be
-# preserved.
-
# Load common constants and variables.
. "$(dirname "$0")/common.sh"
@@ -21,12 +13,12 @@ set_lsb_release_keyval() {
local rootfs=$1
local key=$2
local value=$3
- echo "Setting '$key' to '$value'..."
local temp_lsb_release="$rootfs/etc/temp-lsb-release"
echo "$key=$value" | sudo tee "$temp_lsb_release" > /dev/null
grep -Ev "^$key=" "$rootfs/etc/lsb-release" \
| sudo tee -a "$temp_lsb_release" > /dev/null
- sudo mv -f "$temp_lsb_release" "$rootfs/etc/lsb-release"
+ sudo sort -o "$rootfs/etc/lsb-release" "$temp_lsb_release"
+ sudo rm -f "$temp_lsb_release"
}
main() {
@@ -36,7 +28,22 @@ main() {
local key=$2
local value=$3
if [ $# -ne 1 ] && [ $# -ne 3 ]; then
- echo "Usage: $PROG <image.bin> [<key> <value>]"
+ cat <<EOF
+Usage: $PROG <image.bin> [<key> <value>]
+
+Examples:
+
+$ $PROG chromiumos_image.bin
+
+Dumps /etc/lsb-release from chromiumos_image.bin to stdout.
+
+$ $PROG chromiumos_image.bin CHROMEOS_RELEASE_DESCRIPTION "New description"
+
+Sets the CHROMEOS_RELEASE_DESCRIPTION key's value to "New description"
+in /etc/lsb-release in chromiumos_image.bin, sorts the keys and dumps
+the updated file to stdout.
+
+EOF
exit 1
fi
@@ -47,10 +54,7 @@ main() {
set_lsb_release_keyval "$rootfs" "$key" "$value"
touch "$image" # Updates the image modification time.
fi
- echo ===
cat "$rootfs/etc/lsb-release"
- echo ===
- echo Done.
}
-main $@
+main "$@"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698