also use .profile when linking
This commit is contained in:
parent
af3cb0b171
commit
30660d51d9
2 changed files with 14 additions and 34 deletions
|
|
@ -18,7 +18,7 @@ function user_config {
|
|||
mv $HOME/.bashrc $HOME/.bashrc.old
|
||||
echo "Old .bashrc moved to .bashrc.old"
|
||||
fi
|
||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf} $HOME/;
|
||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} $HOME/;
|
||||
ln -s $SCRIPTPATH/vim/colors $HOME/.vim/
|
||||
echo 'Linking configuration files done'
|
||||
elif [[ "$USER" == "root" ]]; then
|
||||
|
|
@ -28,7 +28,7 @@ function user_config {
|
|||
mv /root/.bashrc /root/.bashrc.old
|
||||
echo "Old .bashrc moved to .bashrc.old"
|
||||
fi
|
||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf} /root/
|
||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} /root/
|
||||
ln -s $SCRIPTPATH/vim/colors /root/.vim/
|
||||
echo 'Linking configuration files done'
|
||||
else
|
||||
|
|
|
|||
|
|
@ -14,29 +14,9 @@ run() {
|
|||
systemd-nspawn -D $CONTAINER_PATH $@
|
||||
}
|
||||
|
||||
add_ssh() {
|
||||
config_ssh() {
|
||||
sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config
|
||||
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config
|
||||
|
||||
touch $CONTAINER_PATH/root/.profile
|
||||
cat <<- 'EOF' > $CONTAINER_PATH/root/.bash_profile
|
||||
# Start ssh-agent and add keys in ~/.ssh directory
|
||||
# Should only be used without a desktop manager
|
||||
ENV=/tmp/.agent_env
|
||||
KEYS=$(basename --suffix=.pub -a $HOME/.ssh/*.pub)
|
||||
if [ -z "$SSH_AGENT_PID" ] && [ ! -e "$ENV" ] ; then
|
||||
ssh-agent > $ENV
|
||||
source $ENV
|
||||
for key in $KEYS;
|
||||
do
|
||||
ssh-add ~/.ssh/$key
|
||||
done
|
||||
echo 'Agent started'
|
||||
else
|
||||
source $ENV
|
||||
echo 'Agent started already, good to go'
|
||||
fi
|
||||
EOF
|
||||
}
|
||||
|
||||
dotfiles() {
|
||||
|
|
@ -73,7 +53,7 @@ if [ -n "$HOSTNAME" ] ;then
|
|||
fi
|
||||
|
||||
if [ "$SSH_SERVER" == "y" ] ;then
|
||||
add_ssh
|
||||
config_ssh
|
||||
fi
|
||||
|
||||
if [ "$DOTFILES" == "y" ] ;then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue