mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
730 B
29 lines
730 B
5 years ago
|
#!/usr/bin/env bash
|
||
6 years ago
|
|
||
|
# Install Go
|
||
|
|
||
5 years ago
|
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)"
|
||
|
cd $script_dir
|
||
6 years ago
|
. set.sh
|
||
|
|
||
5 years ago
|
wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz
|
||
|
tar -C /usr/local -xzf go1.14.1.linux-amd64.tar.gz
|
||
|
rm go1.14.1.linux-amd64.tar.gz
|
||
5 years ago
|
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
|
||
6 years ago
|
|
||
|
# Set-up all users
|
||
5 years ago
|
for dir in $(ls -1d /root /home/* 2>/dev/null ||:)
|
||
6 years ago
|
do
|
||
|
# Add convenient aliases & behaviors
|
||
5 years ago
|
cat <<-'EOF'>> $dir/.bashrc
|
||
6 years ago
|
GOPATH=$HOME/go
|
||
|
PATH=$PATH:$GOPATH/bin
|
||
5 years ago
|
alias gobuild='CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w"'
|
||
6 years ago
|
EOF
|
||
5 years ago
|
echo 'GOPATH=$HOME/go' >> $dir/.profile
|
||
6 years ago
|
|
||
|
# Fix rights
|
||
5 years ago
|
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev)
|
||
|
chown -R $usr:$usr $dir ||:
|
||
6 years ago
|
done
|