hotfix: Bugfixes to installer and loader

This commit is contained in:
Chris 2016-12-11 23:24:11 +01:00
parent 07101181c3
commit 6c5c558087
2 changed files with 20 additions and 4 deletions

View File

@ -59,7 +59,18 @@ function do_install {
if [ -f $1/hotfix ]; then if [ -f $1/hotfix ]; then
debug "Hotfix already installed, or at least something was found matching $1/hotfix" debug "Hotfix already installed, or at least something was found matching $1/hotfix"
debug "Nothing will be copied." question "Do you want to overwrite $1/hotfix?"
echo -n " Overwrite? [y/N]: "
read CONFIRMATION
case "$CONFIRMATION" in
"y"|"Y"|"yes")
debug "Installing into $1"
cp hotfix $1/hotfix
;;
*)
debug "Not overwriting $1/hotfix"
;;
esac
else else
debug "Installing into $1" debug "Installing into $1"
cp hotfix $1/hotfix cp hotfix $1/hotfix
@ -101,9 +112,9 @@ fi
if [ ! -d $INSTALL_PATH ]; then if [ ! -d $INSTALL_PATH ]; then
question "The directory $INSTALL_PATH does not exist. Do you want to create it?" question "The directory $INSTALL_PATH does not exist. Do you want to create it?"
echo -n " Create directory? [Y/n]: " echo -n " Create directory? [Y/n]: "
read $CONFIRMATION read CONFIRMATION
case "$CONFIRMATION" in case "$CONFIRMATION" in
"n|N|no") "n"|"N"|"no")
error "Directory not created. Aborting." error "Directory not created. Aborting."
exit exit
;; ;;

View File

@ -14,10 +14,15 @@ class HotfixLoader
public static function load($uri) public static function load($uri)
{ {
// First, check if this is a valid URL or filename // First, check if this is a valid URL or filename
if ((strpos($uri,"://")!==false) || (file_exists($uri))) { if (strpos($uri,"://")!==false) {
return self::loadFromUri($uri); return self::loadFromUri($uri);
} }
$real = realpath($uri);
if ($real && file_exists($real)) {
return self::loadFromUri($real);
}
if (strpos($uri,":")!==false) { if (strpos($uri,":")!==false) {
list($prefix,$id) = explode(":",$uri,2); list($prefix,$id) = explode(":",$uri,2);
} else { } else {