This repository was archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos-pull.sh
More file actions
executable file
·177 lines (141 loc) · 5.43 KB
/
Copy pathos-pull.sh
File metadata and controls
executable file
·177 lines (141 loc) · 5.43 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
#############################################################################
# #
# Gio's minimal rice -> AWS User Data Script #
# >> l alias, screenfetch, .ssh rc, .vimrc, epel repo #
# >> bash.rc edit, vim, tmux, htop, pip, installed #
# >> scripts determines Linux OS then acts (AmznL2, RHEL, Ubuntu) #
# gio@ #
# 2022-03-01 #
#############################################################################
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
OS="$(cat /etc/os-release | head -n 1 | cut -d '"' -f 2)"
if [[ $OS = "Amazon Linux" ]]
then
echo "Amazon Linux!!"
echo "alias l='ls -la'" >> /home/ec2-user/.bashrc
echo "alias myip='curl http://169.254.169.254/latest/meta-data/public-ipv4'" >> /home/ec2-user/.bashrc
echo "alias mydiid='curl http://169.254.169.254/latest/meta-data/instance-id'" >> /home/ec2-user/.bashrc
echo 'export PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "' >> /home/ec2-user/.bashrc
wget -O /home/ec2-user/screenfetch-dev https://git.io/vaHfR
chown -R ec2-user:ec2-user /home/ec2-user/screenfetch-dev
chmod +x /home/ec2-user/screenfetch-dev
mkdir /home/ec2-user/.vim
touch /home/ec2-user/.vim/vimrc
echo "set number
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set showcmd
set cursorline
set wildmenu
set showmatch" >> /home/ec2-user/.vim/vimrc
chown -R ec2-user:ec2-user /home/ec2-user/.vim
touch /home/ec2-user/install.sh
echo "#!/bin/bash
yum update -y
yum install vim tmux htop python-pip figlet -y
echo '$(hostname)'" >> /home/ec2-user/install.sh
chown ec2-user:ec2-user /home/ec2-user/install.sh
chmod 775 /home/ec2-user/install.sh
touch /home/ec2-user/.ssh/rc
echo "#!/bin/bash
echo $(date)
bash /home/ec2-user/screenfetch-dev" >> /home/ec2-user/.ssh/rc
chown -R ec2-user:ec2-user /home/ec2-user/.ssh/rc
else
echo "Nah, not Amazon Linux ._."
fi
if [[ $OS = "Red Hat Enterprise Linux Server" ]]
then
echo "Red Hat Enterprise Linux Server!!"
# set -o xtrace
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo "alias l='ls -la'" >> /home/ec2-user/.bashrc
echo 'export PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "' >> /home/ec2-user/.bashrc
echo "alias myip='curl http://169.254.169.254/latest/meta-data/public-ipv4'" >> /home/ec2-user/.bashrc
echo "alias mydiid='curl http://169.254.169.254/latest/meta-data/instance-id'" >> /home/ec2-user/.bashrc
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
mkdir /home/ec2-user/.vim
touch /home/ec2-user/.vim/vimrc
echo "set number
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set showcmd
set cursorline
set wildmenu
set showmatch" >> /home/ec2-user/.vim/vimrc
chown -R ec2-user:ec2-user /home/ec2-user/.vim
touch /home/ec2-user/install.sh
echo "#!/bin/bash
yum update -y
yum install wget vim tmux htop python-pip figlet pciutils -y
wget -O /home/ec2-user/screenfetch-dev https://git.io/vaHfR
chown -R ec2-user:ec2-user /home/ec2-user/screenfetch-dev
chmod +x /home/ec2-user/screenfetch-dev
bash /home/ec2-user/screenfetch-dev
echo '$(hostname)'" >> /home/ec2-user/install.sh
chown ec2-user:ec2-user /home/ec2-user/install.sh
chmod 775 /home/ec2-user/install.sh
touch /home/ec2-user/.ssh/rc
echo "#!/bin/bash
echo $(date)
bash /home/ec2-user/screenfetch-dev" >> /home/ec2-user/.ssh/rc
chown -R ec2-user:ec2-user /home/ec2-user/.ssh/rc
else
echo "Nah, not Red Hat Enterprise Server ._."
fi
if [[ $OS = "Ubuntu" ]]
then
echo "Ubuntu!!"
echo "alias l='ls -la'" >> /home/ubuntu/.bashrc
echo 'export PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "' >> /home/ubuntu/.bashrc
echo "alias myip='curl http://169.254.169.254/latest/meta-data/public-ipv4'" >> /home/ubuntu/.bashrc
echo "alias mydiid='curl http://169.254.169.254/latest/meta-data/instance-id'" >> /home/ubuntu/.bashrc
wget -O /home/ubuntu/screenfetch-dev https://git.io/vaHfR
chown -R ubuntu:ubuntu /home/ubuntu/screenfetch-dev
chmod +x /home/ubuntu/screenfetch-dev
mkdir /home/ubuntu/.vim
touch /home/ubuntu/.vim/vimrc
echo "set number
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set showcmd
set cursorline
set wildmenu
set showmatch" >> /home/ubuntu/.vim/vimrc
chown -R ubuntu:ubuntu /home/ubuntu/.vim
touch /home/ubuntu/install.sh
echo "#!/bin/bash
apt update
apt upgrade -y
apt install vim tmux htop python-pip figlet -y
echo '$(hostname)'" >> /home/ubuntu/install.sh
chown ubuntu:ubuntu /home/ubuntu/install.sh
chmod 775 /home/ubuntu/install.sh
touch /home/ubuntu/.ssh/rc
echo "#!/bin/bash
echo $(date)
bash /home/ubuntu/screenfetch-dev" >> /home/ubuntu/.ssh/rc
chown -R ubuntu:ubuntu /home/ubuntu/.ssh/rc
#mkdir /efs
else
echo "Nah, not Ubuntu ._."
fi
#
# ("`-/")_.-'"``-._
# . . `; -._ )-;-,_`)
# (v_,)' _ )`-.\ ``-'
# _.- _..-_/ / ((.'
# ((,.-' ((,/
#
##########################