From 4d576f333d5654d0da588cf4a6be0dca18a03cd2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 7 Sep 2007 17:40:13 +0100 Subject: [PATCH] WinGit: install in-place Instead of unpacking to a temporary directory, we can just as well unpack to the correct location to begin with. This also hands off the task of choosing the directory to the sfx module. And it is faster. Signed-off-by: Johannes Schindelin --- share/WinGit/install.tcl | 84 +++++------------------------------------------- share/WinGit/release.sh | 13 ++++++-- 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/share/WinGit/install.tcl b/share/WinGit/install.tcl index bfa234a7..290e3fb8 100644 --- a/share/WinGit/install.tcl +++ b/share/WinGit/install.tcl @@ -7,27 +7,8 @@ exec wish "$0" -- "$@" # and distributed under the terms of the GNU General Public Licence, # either version 2, or (at your option) any later version. -proc browseForTarget {} { - global targetDirectory - set targetDirectory [tk_chooseDirectory \ - -initialdir $targetDirectory -mustexist false \ - -title "Target directory (will be created if necessary)"] -} - proc installGit {} { - global currentDirectory targetDirectory answer env - - if {[file exists $targetDirectory]} { - set answer [tk_dialog .question "Target directory exists!" \ - "The directory $targetDirectory exists already!\nShould I overwrite it?" \ - error 1 Yes No] - if {$answer == 1} { - return - } - file delete -force $targetDirectory - } - - file mkdir $targetDirectory + global currentDirectory answer env toplevel .listbox text .listbox.list -yscrollcommand ".listbox.scroll set" @@ -36,32 +17,13 @@ proc installGit {} { pack .listbox.list -expand yes -fill both raise .listbox - # copy files - set list [open "$currentDirectory/fileList.txt" r] - while {[gets $list line] >= 0} { - if {$line == "fileList.txt" || $line == "install.tcl" || - $line == "fileList-builtins.txt"} { - continue - } - .listbox.list insert end "copying file: $line\n" - .listbox.list yview moveto 1 - update - - set dir [file dirname "$targetDirectory/$line"] - if {![file isdirectory $dir]} { - file mkdir $dir - } - # NEEDSWORK: may fail gracelessly - file copy "$currentDirectory/$line" "$targetDirectory/$line" - } - close $list - set list [open "$currentDirectory/fileList-builtins.txt" r] while {[gets $list line] >= 0} { .listbox.list insert end "copying builtin: $line\n" .listbox.list yview moveto 1 update - file copy $currentDirectory/bin/git.exe $targetDirectory/$line + file copy -force $currentDirectory/bin/git.exe \ + $currentDirectory/$line } close $list @@ -136,11 +98,11 @@ proc installGit {} { # TODO: incorporate git-cheetah foreach location $destinations { - exec bin/create-shortcut.exe --work-dir $targetDirectory \ - --icon-file $targetDirectory/git.ico \ + exec bin/create-shortcut.exe --work-dir $currentDirectory \ + --icon-file $currentDirectory/git.ico \ --arguments "--login -i" \ --description "Git for MSys" \ - $targetDirectory/bin/sh.exe $location/Git.lnk + $currentDirectory/bin/sh.exe $location/Git.lnk } tk_dialog .info "WinGit installed" \ @@ -151,36 +113,6 @@ proc installGit {} { } set currentDirectory [lindex $argv 0] -set targetDirectory "$env(PROGRAMFILES)\\Git2" - -wm title . "WinGit installer - Git for Windows" - -labelframe .licenseframe -text "License:" -label .licenseframe.license -text "This software is licensed under the GPLv2.\nIf you do not know what that is, you do not have the permission to use this software.\nThis legal warning is necessary, because there are too many lawyers out there.\n" -anchor w -pack .licenseframe.license -side top - -labelframe .install -text "Installation:" - -label .install.label -text "Where do you want to install Git?" - -frame .install.targetFrame -entry .install.targetFrame.target -textvariable targetDirectory -focus .install.targetFrame.target -button .install.targetFrame.browse -text Browse -command browseForTarget -pack .install.targetFrame.target .install.targetFrame.browse -side left -fill x -pack configure .install.targetFrame.target -expand 1 - -frame .install.buttonFrame -button .install.buttonFrame.ok -text OK -borderwidth 4 -command installGit -button .install.buttonFrame.cancel -text Cancel -command exit -pack .install.buttonFrame.ok .install.buttonFrame.cancel -side left - -pack .install.label .install.targetFrame .install.buttonFrame \ - -side top -fill both - -pack .licenseframe .install -side top -fill both - -raise . -bind . exit -bind . installGit +wm withdraw . +installGit diff --git a/share/WinGit/release.sh b/share/WinGit/release.sh index 84091aff..35a517c2 100644 --- a/share/WinGit/release.sh +++ b/share/WinGit/release.sh @@ -42,8 +42,17 @@ exit (cat /share/7-Zip/7zSD.sfx && echo ';!@Install@!UTF-8!' && echo 'Progress="yes"' && - echo 'Directory="%%T\bin"' && - echo 'RunProgram="wish.exe %%T\install.tcl %%T"' && + echo 'Title="WinGit: MinGW Git + minimal MSys installation"' && + echo 'BeginPrompt="This program installes a complete Git for MSys setup"' && + echo 'CancelPrompt="Do you want to cancel WinGit installation?"' && + echo 'ExtractDialogText="Please, wait..."' && + echo 'ExtractPathText="Where do you want to install WinGit?"' && + echo 'ExtractTitle="Extracting..."' && + echo 'GUIFlags="8+32+64+256+4096"' && + echo 'GUIMode="1"' && + echo 'InstallPath="%PROGRAMFILES%\\Git"' && + echo 'OverwriteMode="2"' && + echo 'RunProgram="\"%%T\\bin\\wish.exe\" \"%%T\install.tcl\" \"%%T\""' && echo ';!@InstallEnd@!7z' && cat $TARGET7) > "$TARGET" exit -- 2.11.4.GIT