Compare commits
No commits in common. "7058a007205d2a3be60704674c402bd7a9b14bb9" and "8a253e10900f4044f53630b3d0bd39833cfc2f16" have entirely different histories.
7058a00720
...
8a253e1090
@ -7,4 +7,5 @@ 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).
|
||||||
|
38
install.sh
38
install.sh
@ -4,26 +4,32 @@ run_directory=$(dirname "$0")
|
|||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
user=$(whoami)
|
user=$(whoami)
|
||||||
else
|
if [[ $user != 'root' ]]; then
|
||||||
user=$1
|
echo "Copying rcs to home directory..."
|
||||||
fi
|
cp $run_directory/bashrc /home/$user/.bashrc
|
||||||
|
cp $run_directory/vimrc /home/$user/.vimrc
|
||||||
if [[ $user != 'root' ]]; then
|
cp $run_directory/tmux.conf /home/$user/.tmux.conf
|
||||||
echo "Copying rcs to home directory..."
|
if ! command -v sudo &> /dev/null; then
|
||||||
cp $run_directory/bashrc /home/$user/.bashrc
|
echo "Could not copy to root directory: sudo was not found."
|
||||||
cp $run_directory/vimrc /home/$user/.vimrc
|
else
|
||||||
cp $run_directory/tmux.conf /home/$user/.tmux.conf
|
echo "Copying rcs to root directory..."
|
||||||
|
sudo cp $run_directory/bashrc /root/.bashrc
|
||||||
if ! command -v sudo &> /dev/null; then
|
sudo cp $run_directory/vimrc /root/.vimrc
|
||||||
echo "Could not copy to root directory: sudo was not found."
|
sudo cp $run_directory/tmux.conf /root/.tmux.conf
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Copying rcs to root directory..."
|
echo "Copying rcs to root directory..."
|
||||||
sudo cp $run_directory/bashrc /root/.bashrc
|
cp $run_directory/bashrc /root/.bashrc
|
||||||
sudo cp $run_directory/vimrc /root/.vimrc
|
cp $run_directory/vimrc /root/.vimrc
|
||||||
sudo cp $run_directory/tmux.conf /root/.tmux.conf
|
cp $run_directory/tmux.conf /root/.tmux.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else # running from a setup script, assuming as root
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user