Skip to content

Commit

Permalink
fix various shellcheck 0.4.6 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
austin987 committed Mar 28, 2017
1 parent 9916c95 commit c4161e3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/linkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ w_download() {

# Extract list of URLs from winetricks
extract_all() {
# https://github.com/koalaman/shellcheck/issues/861
# shellcheck disable=SC1003
grep '^ *w_download ' winetricks | grep -E 'ftp|http|WINETRICKS_SOURCEFORGE'| sed 's/^ *//' | tr -d '\\' > url-script-fragment.tmp
# shellcheck disable=SC1091
. ./url-script-fragment.tmp
Expand Down
16 changes: 8 additions & 8 deletions src/uniquefiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ rm -f /tmp/allfiles.txt
for dir
do
(
cd $dir/drive_c
# FIXME: don't assume there are no ='s in filenames, e.g. rewrite in perl
find . -type f | tr ' ' '=' | grep -E -iv 'tmp|temp|installer|NativeImages' | sort > ../files.txt
cat ../files.txt >> /tmp/allfiles.txt
cd "$dir/drive_c"
# FIXME: don't assume there are no ='s in filenames, e.g. rewrite in perl
find . -type f | tr ' ' '=' | grep -E -iv 'tmp|temp|installer|NativeImages' | sort > ../files.txt
cat ../files.txt >> /tmp/allfiles.txt
)
done

Expand All @@ -38,9 +38,9 @@ sort < /tmp/allfiles.txt | uniq -c | awk '$1 == 1 {print $2}' > /tmp/uniqfiles.t
for dir
do
(
cd $dir
# Undo the space-to-= transformation, too
fgrep -f /tmp/uniqfiles.txt < files.txt | tr '=' ' ' > uniqfiles.txt
cd "$dir"
# Undo the space-to-= transformation, too
grep -F -f /tmp/uniqfiles.txt < files.txt | tr '=' ' ' > uniqfiles.txt
)
echo $dir/uniqfiles.txt
echo "$dir/uniqfiles.txt"
done
16 changes: 8 additions & 8 deletions src/winetricks
Original file line number Diff line number Diff line change
Expand Up @@ -2311,8 +2311,8 @@ w_wine_version_in()
{
for _W_range
do
_W_val1=$(echo $_W_range | sed 's/,.*//')
_W_val2=$(echo $_W_range | sed 's/.*,//')
_W_val1=$(echo "$_W_range" | sed 's/,.*//')
_W_val2=$(echo "$_W_range" | sed 's/.*,//')

# If in this range, return true
case $_W_range in
Expand Down Expand Up @@ -2437,7 +2437,7 @@ w_metadata()
# FIXME: backslashes get interpreted here. This screws up
# installed_file1 fairly often. Fortunately, we can use forward
# slashes in that variable instead of backslashes.
echo ${arg%%=*}=\"${arg#*=}\"
echo "${arg%%=*}"=\""${arg#*=}"\"
done > "$file"
echo category='"'"$_W_category"'"' >> "$file"
# If the problem described above happens, you'd see errors like this:
Expand Down Expand Up @@ -2495,7 +2495,7 @@ w_do_call()
# Hack..
if test "$cmd" = vd
then
load_vd $arg
load_vd "$arg"
_W_status=$?
test "$W_OPT_NOCLEAN" = 1 || rm -rf "$W_TMP"
mkdir -p "$W_TMP"
Expand Down Expand Up @@ -3693,7 +3693,7 @@ winetricks_showmenu()
# Filter out any verb that's already installed
sh "$WINETRICKS_WORKDIR"/zenity.sh |
tr '|' '\012' |
fgrep -v -x -f "$WINETRICKS_WORKDIR"/installed.txt |
grep -F -v -x -f "$WINETRICKS_WORKDIR"/installed.txt |
tr '\012' ' '
;;

Expand Down Expand Up @@ -19553,11 +19553,11 @@ then
# Load the verb file
# shellcheck disable=SC1090
case $verb in
*/*) . $verb ;;
*) . ./$verb ;;
*/*) . "$verb" ;;
*) . ./"$verb" ;;
esac
# And forget that the verb comes from a file
verb="$(echo $verb | sed 's,.*/,,;s,.verb,,')"
verb="$(echo "$verb" | sed 's,.*/,,;s,.verb,,')"
;;
esac
execute_command "$verb"
Expand Down
2 changes: 1 addition & 1 deletion tests/winetricks-test
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ test_dlls()
exit 1
fi

sort -u < "${outputdir}/dlls.log" | fgrep -w -v -f "${outputdir}/manual.log" | grep -E -v "$BLACKLIST" > "${outputdir}/dlls.verbs"
sort -u < "${outputdir}/dlls.log" | grep -F -w -v -f "${outputdir}/manual.log" | grep -E -v "$BLACKLIST" > "${outputdir}/dlls.verbs"

if [ ! -f "${outputdir}/dlls.verbs" ] ; then
w_die "${outputdir}/dlls.verbs doesn't exist? No verbs to test!"
Expand Down

0 comments on commit c4161e3

Please sign in to comment.