OMZ installation and sudo on Alpine #36
@@ -1,15 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FILE=/home/$USER/.oh-my-zsh/oh-my-zsh.sh
|
TARGET_USER=$1
|
||||||
|
|
||||||
|
FILE=/home/$TARGET_USER/.oh-my-zsh/oh-my-zsh.sh
|
||||||
if [ -f "$FILE" ]; then
|
if [ -f "$FILE" ]; then
|
||||||
echo "$FILE exists and we not installing ohmyzsh"
|
echo "$FILE exists and we not installing ohmyzsh"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "$FILE does not exist and we install ohmyzsh"
|
echo "$FILE does not exist and we install ohmyzsh"
|
||||||
cd /home/max
|
cd /home/$TARGET_USER
|
||||||
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
sudo -u $TARGET_USER wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
chmod +x /home/max/install.sh
|
chmod +x /home/$TARGET_USER/install.sh
|
||||||
timeout -s 15 -k 30s 20s /home/max/install.sh --unattendend --keep-zshrc || exit 0
|
sudo -u $TARGET_USER timeout -s 15 -k 30s 20s /home/$TARGET_USER/install.sh --unattendend --keep-zshrc || exit 0
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,9 @@
|
|||||||
|
|
||||||
# WARNING: UNPRIVILEGED USER (not ansible) COMMANDS
|
# WARNING: UNPRIVILEGED USER (not ansible) COMMANDS
|
||||||
- name: Install oh my zsh
|
- name: Install oh my zsh
|
||||||
remote_user: "{{ human_admin_user }}"
|
remote_user: ansible
|
||||||
ansible.builtin.command: "/home/{{ human_admin_user }}/install_omz.sh"
|
ansible.builtin.command: "/home/{{ human_admin_user }}/install_omz.sh {{ human_admin_user }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
vars:
|
|
||||||
|
|
||||||
- name: Configure oh my zsh, by pushing the config file
|
- name: Configure oh my zsh, by pushing the config file
|
||||||
remote_user: ansible
|
remote_user: ansible
|
||||||
|
|||||||
Reference in New Issue
Block a user