From cfe26e4cb59d3a7265de3b7228895e5c8eaab6d0 Mon Sep 17 00:00:00 2001 From: Daniel Mahlow Date: Sat, 30 Mar 2013 14:23:43 +0100 Subject: [PATCH] Sanitize is_installed/set_installed arguments. --- helpers/default | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/helpers/default b/helpers/default index 12b6b84..53867f6 100644 --- a/helpers/default +++ b/helpers/default @@ -331,12 +331,8 @@ fail_if_not_root () { # Checks if a certain element has already been installed. # function is_installed () { - if [ $# -gt 1 ]; then - local args=$* - local name=${args// /-} - else - local name=$1 - fi + local args=$* + local name=${args//[ \/:@]/-} if [[ -f ~/.shoestrap/installed/$name ]]; then log "'$name' is already installed." @@ -351,14 +347,9 @@ function is_installed () { # Sets an element as installed. # function set_installed () { - if [ $# -gt 1 ]; then - local args=$* - local name=${args// /-} - else - local name=$1 - fi + local args=$* + local name=${args//[ \/:@]/-} mkdir -p ~/.shoestrap/installed touch ~/.shoestrap/installed/$name -} - +} \ No newline at end of file