Compare commits

...

2 Commits

Author SHA1 Message Date
7058a00720 Revert "Update README"
This reverts commit 3a0b288a95.
2022-03-12 12:37:37 +01:00
d8c16a134a Revert "install.sh: adapt behviour when calling with argument"
This reverts commit 8a253e1090.
2022-03-12 12:37:24 +01:00
2 changed files with 17 additions and 24 deletions

View File

@ -7,5 +7,4 @@ This repository contains setup or config files for generic CLI applications, suc
* `vimrc` is ViM config script and should be installed at `~/.vimrc`. * `vimrc` is ViM config script and should be installed at `~/.vimrc`.
* `tmux.conf` is tmux config file and should be installed at `~/.tmux.conf`. * `tmux.conf` is tmux config file and should be installed at `~/.tmux.conf`.
#### Installation #### Installation
* `install.sh` script copies above files to their respective destinations; * `install.sh` script copies above files to their respective destinations.
* can be called with an argument, which will be used as user name (to be used with setup scripts).

View File

@ -4,11 +4,16 @@ run_directory=$(dirname "$0")
if [ -z "$1" ]; then if [ -z "$1" ]; then
user=$(whoami) user=$(whoami)
else
user=$1
fi
if [[ $user != 'root' ]]; then if [[ $user != 'root' ]]; then
echo "Copying rcs to home directory..." echo "Copying rcs to home directory..."
cp $run_directory/bashrc /home/$user/.bashrc cp $run_directory/bashrc /home/$user/.bashrc
cp $run_directory/vimrc /home/$user/.vimrc cp $run_directory/vimrc /home/$user/.vimrc
cp $run_directory/tmux.conf /home/$user/.tmux.conf cp $run_directory/tmux.conf /home/$user/.tmux.conf
if ! command -v sudo &> /dev/null; then if ! command -v sudo &> /dev/null; then
echo "Could not copy to root directory: sudo was not found." echo "Could not copy to root directory: sudo was not found."
else else
@ -17,19 +22,8 @@ if [ -z "$1" ]; then
sudo cp $run_directory/vimrc /root/.vimrc sudo cp $run_directory/vimrc /root/.vimrc
sudo cp $run_directory/tmux.conf /root/.tmux.conf sudo cp $run_directory/tmux.conf /root/.tmux.conf
fi fi
else
echo "Copying rcs to root directory..."
cp $run_directory/bashrc /root/.bashrc
cp $run_directory/vimrc /root/.vimrc
cp $run_directory/tmux.conf /root/.tmux.conf
fi
else # running from a setup script, assuming as root else
user=$1
echo "Copying rcs to home directory..."
sudo -H -u $user cp $run_directory/bashrc /home/$user/.bashrc
sudo -H -u $user cp $run_directory/vimrc /home/$user/.vimrc
sudo -H -u $user cp $run_directory/tmux.conf /home/$user/.tmux.conf
echo "Copying rcs to root directory..." echo "Copying rcs to root directory..."
cp $run_directory/bashrc /root/.bashrc cp $run_directory/bashrc /root/.bashrc
cp $run_directory/vimrc /root/.vimrc cp $run_directory/vimrc /root/.vimrc