From 617e898bda390ab5f51cb69067dbed084d5745b4 Mon Sep 17 00:00:00 2001 From: Joshua Hall Date: Wed, 17 Jun 2020 23:14:11 -0400 Subject: [PATCH] Stop modifying etc --- dotfiles.symlink/VERSION | 2 +- ibmi-dotfiles.spec | 4 ++- script/bootstrap | 53 +++++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/dotfiles.symlink/VERSION b/dotfiles.symlink/VERSION index 3eefcb9..9084fa2 100644 --- a/dotfiles.symlink/VERSION +++ b/dotfiles.symlink/VERSION @@ -1 +1 @@ -1.0.0 +1.1.0 diff --git a/ibmi-dotfiles.spec b/ibmi-dotfiles.spec index a992ca6..b3e06af 100644 --- a/ibmi-dotfiles.spec +++ b/ibmi-dotfiles.spec @@ -1,6 +1,6 @@ %define name ibmi-dotfiles %define release 0 -%define version 1.0 +%define version 1.1 %define git_completion https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash %define git_prompt https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh @@ -33,6 +33,8 @@ cp -r ./* %{buildroot}/QOpenSys/etc/ibmi-dotfiles /QOpenSys/etc/ibmi-dotfiles %changelog +* Wed Jun 17 2020 Joshua Hall - 1.1-ibmi-dotfiles +- Stopped modifying etc to solve permission issues * Sun Jun 14 2020 Joshua Hall - 1.0-ibmi-dotfiles - Support git bash completion and prompt diff --git a/script/bootstrap b/script/bootstrap index 65c30d9..1fd0643 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -54,26 +54,19 @@ fail () { exit } -setup_gitconfig () { - if ! [[ -f "${DOTFILES_ROOT}git/gitconfig.symlink" ]] - then - info 'setup gitconfig' - - user ' - What is your github author name?' - read -e git_authorname - user ' - What is your github author email?' - read -e git_authoremail +install_gitconfig () { + config_source="${DOTFILES_ROOT}/git/gitconfig.symlink.example" + info 'setup gitconfig' - sed -e "s/AUTHORNAME/$git_authorname/g" -e "s/AUTHOREMAIL/$git_authoremail/g" \ - "${DOTFILES_ROOT}/git/gitconfig.symlink.example" > "${DOTFILES_ROOT}/git/gitconfig.symlink" + user ' - What is your github author name?' + read -e git_authorname + user ' - What is your github author email?' + read -e git_authoremail - success 'gitconfig' - fi -} + sed -e "s/AUTHORNAME/$git_authorname/g" -e "s/AUTHOREMAIL/$git_authoremail/g" \ + $config_source > $1 -link_files () { - ln -s $1 $2 - success "linked $1 to $2" + success "copied $1 to $2" } copy_files () { @@ -90,17 +83,18 @@ install_dotfiles () { for source in `/QOpenSys/pkgs/bin/find ${DOTFILES_ROOT} -maxdepth 2 -name \*.symlink` do - dest="${install_path}/.`basename \"${source%.*}\"`" + dest_file=".`basename \"${source%.*}\"`" + dest="${install_path}/${dest_file}" if [[ -f ${dest} ]] || [[ -d ${dest} ]] - then + then overwrite=false backup=false skip=false if [[ "$overwrite_all" == "false" ]] && [[ "$backup_all" == "false" ]] && [[ "$skip_all" == "false" ]] - then + then user "File already exists: `basename ${source}`, what do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all?" read -n 1 action @@ -124,32 +118,41 @@ install_dotfiles () { fi if [[ "$overwrite" == "true" ]] || [[ "$overwrite_all" == "true" ]] - then + then rm -rf ${dest} success "removed ${dest}" fi if [[ "$backup" == "true" ]] || [[ "$backup_all" == "true" ]] - then + then mv ${dest} ${dest}\.backup success "moved ${dest} to ${dest}.backup" fi if [[ "$skip" == "false" ]] && [[ "$skip_all" == "false" ]] + then + if [[ "$dest_file" == ".gitconfig" ]] then - copy_files ${source} ${dest} + install_gitconfig ${dest} + else + copy_files ${source} ${dest} + fi else success "skipped ${source}" fi else - copy_files ${source} ${dest} + if [[ "$dest_file" == ".gitconfig" ]] + then + install_gitconfig ${dest} + else + copy_files ${source} ${dest} + fi fi done } -setup_gitconfig install_dotfiles echo ''