-
Notifications
You must be signed in to change notification settings - Fork 102
/
install
62 lines (42 loc) · 1.77 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#/
#--------------------------------------------------------------------------
# Install Larasail
#--------------------------------------------------------------------------
#
# This part of the script will move a few files to the necessary locations,
# add a new user 'larasail', and add aliases for the CLI
#
#/
# Move the files to /etc/.larasail and create a root larasail alias
mv larasail-master/.larasail /etc/.larasail
echo "alias larasail='sh /etc/.larasail/larasail'" >> /etc/bash.bashrc
# Create a new password and create our new larasail user
PASS=$(openssl rand -base64 32)
useradd -G sudo -d /home/larasail -p $PASS -m larasail -s /bin/bash
# Give the larasail user ability to not always require password
echo 'larasail ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Turn on SSH Passwords
# sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
# echo -n 'AllowUsers larasail' >> /etc/ssh/sshd_config
# service ssh reload
# Store the larasail user password
if [ ! -d /etc/.larasail/tmp ]; then
sudo mkdir /etc/.larasail/tmp
fi
sudo echo $PASS > /etc/.larasail/tmp/pass
sudo chown -R larasail:larasail /etc/.larasail/tmp
# Include our colors and format scripts
. /etc/.larasail/includes/colors
. /etc/.larasail/includes/format
# Add larasail alias to larasail bashrc and the bin path dir for composer
echo "alias larasail='sh /etc/.larasail/larasail'" >> /home/larasail/.bashrc
echo "export PATH=~/.config/composer/vendor/bin:~/.composer/vendor/bin:\$PATH" >> /home/larasail/.bashrc
# Show message after successfully installing
setsailNoColor
barNoColor
echo "| Prepare the Sails, we're ready for the Open Sea!";
barNoColor
# Remove larasail folder pulled from git repo and switch user to larasail
rm -rf larasail-master
su - larasail