Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add safeguards to install path target removal. Use sm_path/bin/sm-zsh…

… instead of zsh-bin.
  • Loading branch information...
commit 5c87a0cbba8e0eb6a4c4dd7c76d08aaf3ef1c7f1 1 parent e4d75c3
Wayne E. Seguin wayneeseguin authored
14 bin/sm-installer
View
@@ -47,7 +47,7 @@ then
fi
if test -z "${sm_path:-}"
-then
+then # NOTE: We are using the bad practice of '`' here only for full POSIX compat
if test `ps -p $$ -o uid=` -eq 0
then sm_path=/opt/sm
else sm_path="${HOME:-}/.sm"
@@ -56,15 +56,19 @@ fi
true sm_owner:${sm_owner:=sm}:
rm -rf "${sm_path}/src/${sm_owner}-sm"
-mkdir -p "${sm_path}/archives" "${sm_path}/zsh-bin" "${sm_path}/src/${sm_owner}-sm"
+mkdir -p "${sm_path}/archives" "${sm_path}/bin/sm-zsh" "${sm_path}/src/${sm_owner}-sm"
+
+${sm_curl_command} https://smf.sh/zsh/$platform/zsh -o "${sm_path}/bin/sm-zsh"
+chmod +x "${sm_path}/bin/sm-zsh"
-${sm_curl_command} https://smf.sh/zsh/$platform/zsh -o "${sm_path}/zsh-bin/zsh"
-chmod +x "${sm_path}/zsh-bin/zsh"
${sm_curl_command} -L https://github.com/${sm_owner}/sm/tarball/master -o "${sm_path}/archives/${sm_owner}-sm.tar.gz"
cd "${sm_path}/src/${sm_owner}-sm"
${sm_tar_command} xzf "${sm_path}/archives/${sm_owner}-sm.tar.gz"
+
${sm_curl_command} https://smf.sh/mustache/$platform/sm-mustache -o ${sm_path}/bin/sm-mustache
chmod +x "${sm_path}/bin/sm-mustache"
mv ${sm_owner}-sm-*/* .
rm -rf ${sm_owner}-sm-*
-"${sm_path}/zsh-bin/zsh" ./install --zsh "${sm_path}/zsh-bin/zsh" "$@"
+
+"${sm_path}/bin/sm-zsh" ./install --zsh "${sm_path}/bin/sm-zsh" "$@"
+
0  core/install/map
View
No changes.
7 core/install/shell/functions
View
@@ -31,6 +31,7 @@ prepare_for_installation()
_path="${install_path}/${directory}"
if paths exists "${_path}"
then
+ [[ "${_path%/}" != "${install_path}" ]] || continue
__sm.log.step "Removing old sm component path (${_path})"\
rm -rf "${_path}"
fi
@@ -42,12 +43,14 @@ prepare_for_installation()
cleanse_targets()
{
- typeset _path _entity
+ typeset _path _entity _target
_path="$1"
(( $# )) && shift || __sm.log.fail "Usage:\n\n cleanse_targets {target} {paths/files under target}"
for _entity in "$@"
do
- rm -rf "${_path}/${_entity}"
+ _target="${_path}/${_entity}"
+ [[ "${_target%/}" != "${install_path}" ]] || continue
+ rm -rf "${_target}"
done
}
Please sign in to comment.
Something went wrong with that request. Please try again.