From c7da269a994afeba46862b50a5ce16a085ffd651 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 19 Jan 2012 23:15:29 -0500 Subject: Add comments and IFS reset to oh-installfiles. --- (limited to 'src') diff --git a/src/oh-installfiles b/src/oh-installfiles index 0d81eea..b200d5f 100644 --- a/src/oh-installfiles +++ b/src/oh-installfiles @@ -29,14 +29,26 @@ if [ ${#} -eq 0 ]; then exit 1 fi -while [ ${#} -gt 0 ]; do - OLDIFS=${IFS} - IFS=' +# Set the IFS to just the linebreak character to make the 'read' utility output +# entire lines. +OLDIFS="${IFS}" +IFS=' ' + +# Iterate over packages. +while [ ${#} -gt 0 ]; do + # Loop over lines in the 'install' file. while read -r pattern; do + # Ensure that the full directory path of the pattern exists in the + # package staging area. pattern_dir=$(dirname ${pattern}) mkdir -p ${1}/${pattern_dir} + # Move any matching files from the installation destination to the + # package staging area. mv dest/${pattern} ${1}/${pattern_dir} done < ../${1}.pkg/install shift done + +# Reset the IFS. +IFS="${OLDIFS}" -- cgit v0.9.1