-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·35 lines (28 loc) · 1.1 KB
/
install.sh
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
#!/usr/bin/env bash
# Color constants
readonly NC='\033[0m'
readonly GREEN='\033[0;32m'
readonly RED='\033[0;31m'
readonly CYAN='\033[0;36m'
# Path constants
readonly RCDK_DIR="$HOME/rcdkConfigs"
echo -e "${CYAN}Runcloud Shell API Wrapper installation:${NC}"
read -ep "Enter your API KEY: " ak
read -ep "Enter your API SECRET KEY: " ask
# Install shell api wrapper
sudo cp rcdk.sh /usr/local/bin/rcdk
mkdir "$RCDK_DIR"
printf 'api_key="'$ak'"\napi_secret_key="'$ask'"\nserver_id=' > "$RCDK_DIR/api.conf"
# Copy function files and change permissions
cp -R functions "$RCDK_DIR/"
echo -e "${GREEN}Runcloud Shell API Wrapper was installed successfully!${NC}"
# Check OS for Ubuntu/Debian and install bash completion
ubuntu_check=`cat /etc/os-release | grep "ID=ubuntu"`
debian_check=`cat /etc/os-release | grep "ID=debian"`
if [[ ubuntu_check == '' && debian_check == '' ]]
then
echo -e "${RED}This script supporting only Ubuntu/Debian bash completion. See manual about your OS bash completion!${NC}"
else
sudo cp rcdk /etc/bash_completion.d/
echo -e "${GREEN}Bash completion was installed successfully!${NC}"
fi