Skip to content

Commit

Permalink
Stop modifying etc
Browse files Browse the repository at this point in the history
  • Loading branch information
jbh committed Jun 18, 2020
1 parent f2a1ee4 commit 617e898
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dotfiles.symlink/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0
4 changes: 3 additions & 1 deletion ibmi-dotfiles.spec
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -33,6 +33,8 @@ cp -r ./* %{buildroot}/QOpenSys/etc/ibmi-dotfiles
/QOpenSys/etc/ibmi-dotfiles

%changelog
* Wed Jun 17 2020 Joshua Hall <[email protected]> - 1.1-ibmi-dotfiles
- Stopped modifying etc to solve permission issues
* Sun Jun 14 2020 Joshua Hall <[email protected]> - 1.0-ibmi-dotfiles
- Support git bash completion and prompt

53 changes: 28 additions & 25 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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
Expand All @@ -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 ''
Expand Down

0 comments on commit 617e898

Please sign in to comment.