diff --git a/apt-vim b/apt-vim index cec47fa..a4c0bdc 100755 --- a/apt-vim +++ b/apt-vim @@ -584,13 +584,26 @@ class aptvim(object): ' is in your PATH' report_fail(msg, confirm_continue=False, ASSUME_YES=self.ASSUME_YES) + def confirm_install_ok(self, install_requester, commands): + confirm_string = 'Package `' + install_requester + '` wants to run the following commands:\n' + command_string = '' + for command in commands: + command_string += command + '\n' + confirm_string += command_string + 'Is this ok?' + + if self.ASSUME_YES or user_confirm(confirm_string, ASSUME_YES=self.ASSUME_YES): + return True + return False + def init(self): self.verify_bin_in_path() missing_deps = [] deps = self.VIM_CONFIG[GBL][DPND] for dep in deps: dep = Dependency.dict_to_dep(dep, ASSUME_YES=self.ASSUME_YES) - if not self.check_requirements([dep.name]): + if not self.check_requirements([dep.name]) and \ + (len(dep.get_recipe(ASSUME_YES=self.ASSUME_YES)) > 0 and self.confirm_install_ok(dep.name, dep.get_recipe(ASSUME_YES=self.ASSUME_YES))): + print('Attempting to install `' + dep.name + '`') if not self.exe_shell_commands(dep.get_recipe(ASSUME_YES=self.ASSUME_YES)): missing_deps.append(dep.name) return missing_deps diff --git a/install.sh b/install.sh index bbb8f67..a0993a0 100644 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ bin_string="export PATH=${PATH}:${HOME}/.vimpkg/bin" # Download the apt-vim files curl -fSsLo ${HOME}/apt-vim/apt-vim --create-dirs \ - https://raw.githubusercontent.com/egalpin/apt-vim/39_bug_remove_sudo_dependence/apt-vim + https://raw.githubusercontent.com/egalpin/apt-vim/master/apt-vim curl -fSsLo ${HOME}/apt-vim/vim_config.json \ https://raw.githubusercontent.com/egalpin/apt-vim/master/vim_config.json @@ -29,7 +29,6 @@ already_present=false for rc in bashrc zshrc bash_profile; do if [ -s "$HOME/.$rc" ]; then if grep -q "$bin_string" "$HOME/.$rc"; then - printf "== apt-vim PATH already exported in '~/.$rc'\n" already_present=true else printf "\n$bin_string\n" >> "$HOME/.$rc" @@ -60,6 +59,7 @@ python_result=$? cd $start_dir +echo if [ "$python_result" -ne 0 ]; then echo "== Error:" echo " Installation failed."