This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
install-scripts/base-setup/user.sh

33 lines
891 B
Bash
Raw Permalink Normal View History

2020-03-19 19:07:07 +00:00
#!/bin/sh
2020-03-20 19:59:14 +00:00
_cmd_su="su --login $_user -c"
2020-03-19 19:07:07 +00:00
useradd -m -s /bin/bash "$_user"
groupadd sudo
usermod -aG sudo "$_user"
mkdir /home/"$_user"/.ssh
cp /root/.ssh/authorized_keys /home/"$_user"/.ssh/
chown "$_user": /home/"$_user"/.ssh/authorized_keys
passwd -d "$_user"
chage -d 0 "$_user"
2020-03-19 19:11:41 +00:00
if command -v apt-get ; then
2020-03-20 19:59:14 +00:00
apt-get update && apt-get -y upgrade && apt-get -y install sudo git
2020-03-19 19:11:41 +00:00
else
2020-03-20 20:06:14 +00:00
echo 'Error - no package installer found.'
2020-03-19 20:20:06 +00:00
exit 1
2020-03-19 19:11:41 +00:00
fi
2020-03-20 19:59:14 +00:00
$_cmd_su "git config --global user.email '$_git_user_email'"
$_cmd_su "git config --global user.name '$_git_user_name'"
2020-03-22 16:55:06 +00:00
# TODO populate global .gitignore
# *.swp
# node_modules/
' Session.vim'
2020-03-20 19:59:14 +00:00
2020-03-19 19:07:07 +00:00
# TODO ensure group sudo is allowed sudo
2020-03-30 12:26:40 +00:00
# TODO - use a minimal .profile instead
$_cmd_su git clone https://git.rayelliott.dev/dots/profile.git /home/$_user/.config/profile
$_cmd_su cat /home/$_user/.config/profile/profile >> /home/$_user/.profile