ucloud-setup/init.sh
2019-09-08 20:55:00 +05:00

61 lines
No EOL
1.5 KiB
Bash

get_distro() {
OS=$(cat /etc/*release | grep "^ID=" | head -1 | cut -c 4-)
echo $OS
}
if ! grep -q "export LC_ALL=C.UTF-8" ~/.bashrc; then
echo 'export LC_ALL=C.UTF-8' >> ~/.bashrc
echo 'export LANG=C.UTF-8' >> ~/.bashrc
source ~/.bashrc
fi
case $(get_distro) in
"alpine")
# Install QEMU
(git clone https://github.com/ahmedbilal/qemu-with-rbd-alpine.git \
&& cd qemu-with-rbd-alpine && apk add *.apk --allow-untrusted)
# Enable Alpine (3.10 + Edge) Repos
cat > /etc/apk/repositories << EOF
http://dl-cdn.alpinelinux.org/alpine/v3.10/main
http://dl-cdn.alpinelinux.org/alpine/v3.10/community
http://dl-cdn.alpinelinux.org/alpine/edge/main
http://dl-cdn.alpinelinux.org/alpine/edge/community
http://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
# Update Package List and Upgrade System
apk update
apk upgrade
# Install system packages
apk add python3 ceph py2-pip py3-pip etcd-ctl
# Some python package dependencies
apk add libffi-dev openssl-dev make alpine-sdk gcc g++ python3-dev
apk add py3-grpcio py3-protobuf py3-tempita
;;
"devuan"|"debian")
# Update Package List and Upgrade System
apt update
apt upgrade --yes
# Install QEMU
apt install qemu python3 ceph python-pip python3-pip etcd-client --yes
;;
*)
echo "Unsupported OS/Distribution"
exit 1
esac
pip3 install --upgrade pip
pip2 install --upgrade pip
# For CEPH
pip2 install prettytable
pip3 install pipenv
pipenv install