preserve distro profile and bashrc

This commit is contained in:
Jeffrey Paul 2018-03-06 17:07:09 -05:00
parent 6776edd7a9
commit d63731ebac
1 changed files with 16 additions and 9 deletions

View File

@ -4,8 +4,8 @@
##cloud-config ##cloud-config
#runcmd: #runcmd:
# - curl -fsSL https://raw.githubusercontent.com/sneak/hacks/master/init.sh | bash # - curl -fsSL https://raw.githubusercontent.com/sneak/hacks/master/cloud-init.sh | bash
#exec 1 2>&1 | tee -a ${LOG_FILE} #exec 1 2>&1 | tee -a ${LOG_FILE}
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
@ -21,21 +21,28 @@ fi
# run the rest as sneak: # run the rest as sneak:
sudo -H -u sneak bash <<EOF sudo -H -u sneak bash <<EOF
if [[ ! -d /home/sneak/.ssh ]]; then export HOME=/home/sneak
mkdir -p /home/sneak/.ssh
if [[ ! -d ~/.ssh ]]; then
mkdir -p ~/.ssh
fi fi
if [[ ! -e /home/sneak/.ssh/sneak.keys ]]; then if [[ ! -e ~/.ssh/sneak.keys ]]; then
cd /home/sneak/.ssh && \ cd ~/.ssh && \
wget https://github.com/sneak.keys && \ wget https://github.com/sneak.keys && \
cat *.keys > authorized_keys cat *.keys > authorized_keys
fi fi
if [[ ! -d /home/sneak/hacks ]]; then if [[ ! -d ~/hacks ]]; then
cd /home/sneak cd ~
git clone https://github.com/sneak/hacks.git git clone https://github.com/sneak/hacks.git
fi fi
rsync -avP /home/sneak/hacks/homedir.skel/ /home/sneak/ mkdir -p ~/.local/bashrc.d
mkdir -p ~/.local/profile.d
mv ~/.profile ~/.local/profile.d/999.distro.profile.sh
mv ~/.bashrc ~/.local/bashrc.d/999.distro.bashrc.sh
rsync -avP /home/sneak/hacks/homedir.skel/ /home/sneak/
EOF EOF