Merge pull request #8 from DomiStyle/lib-load

Load libraries correctly
This commit is contained in:
Dominik 2018-12-21 10:59:51 +01:00 committed by GitHub
commit e8e0b4ad09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 36 deletions

View File

@ -1,9 +1,14 @@
FROM jlesage/baseimage-gui:alpine-3.7 FROM jlesage/baseimage-gui:ubuntu-16.04
ENV APP_NAME="iDRAC 6" \ ENV APP_NAME="iDRAC 6" \
IDRAC_PORT=443 IDRAC_PORT=443
RUN apk add --no-cache openjdk7-jre RUN apt-get update && \
apt-get install -y software-properties-common wget && \
add-apt-repository ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y openjdk-7-jdk && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /app && \ RUN mkdir /app && \
chown ${USER_ID}:${GROUP_ID} /app chown ${USER_ID}:${GROUP_ID} /app

View File

@ -1,23 +0,0 @@
version: '2'
services:
idrac1:
image: domistyle/idrac6
restart: always
ports:
- 5800:5800
- 5900:5900
environment:
- IDRAC_HOST=idrac1.example.org
- IDRAC_USER=root
- IDRAC_PASSWORD=1234
idrac2:
image: domistyle/idrac6
restart: always
ports:
- 5801:5800
- 5901:5900
environment:
- IDRAC_HOST=idrac2.example.org
- IDRAC_USER=root
- IDRAC_PASSWORD=1234

View File

@ -1,71 +1,96 @@
#!/bin/sh #!/bin/sh
GREEN='\033[0;32m'
RED='\033[0;31m' RED='\033[0;31m'
NC='\033[0m' NC='\033[0m'
echo "Starting" echo "Starting"
if [ -z "${IDRAC_HOST}" ]; then if [ -z "${IDRAC_HOST}" ]; then
echo -e "${RED}Please set a proper idrac host with IDRAC_HOST${NC}" echo "${RED}Please set a proper idrac host with IDRAC_HOST${NC}"
sleep 2 sleep 2
exit 1 exit 1
fi fi
if [ -z "${IDRAC_PORT}" ]; then if [ -z "${IDRAC_PORT}" ]; then
echo -e "${RED}Please set a proper idrac port with IDRAC_PORT${NC}" echo "${RED}Please set a proper idrac port with IDRAC_PORT${NC}"
sleep 2 sleep 2
exit 1 exit 1
fi fi
if [ -z "${IDRAC_USER}" ]; then if [ -z "${IDRAC_USER}" ]; then
echo -e "${RED}Please set a proper idrac user with IDRAC_USER${NC}" echo "${RED}Please set a proper idrac user with IDRAC_USER${NC}"
sleep 2 sleep 2
exit 1 exit 1
fi fi
if [ -z "${IDRAC_PASSWORD}" ]; then if [ -z "${IDRAC_PASSWORD}" ]; then
echo -e "${RED}Please set a proper idrac password with IDRAC_PASSWORD${NC}" echo "${RED}Please set a proper idrac password with IDRAC_PASSWORD${NC}"
sleep 2 sleep 2
exit 1 exit 1
fi fi
echo "Environment ok" echo "Environment ok"
echo "Creating library folder"
cd /app cd /app
mkdir lib
echo "Downloading required files" if [ ! -d "lib" ]; then
echo "Creating library folder"
mkdir lib
fi
if [ ! -f avctKVM.jar ]; then if [ ! -f avctKVM.jar ]; then
echo "Downloading avctKVM"
wget https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVM.jar --no-check-certificate wget https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVM.jar --no-check-certificate
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctKVM.jar, please check your settings${NC}" echo "${RED}Failed to download avctKVM.jar, please check your settings${NC}"
sleep 2 sleep 2
exit 2 exit 2
fi fi
fi fi
if [ ! -f lib/avctKVMIOLinux64.jar ]; then if [ ! -f lib/avctKVMIOLinux64.jar ]; then
echo "Downloading avctKVMIOLinux64"
wget -O lib/avctKVMIOLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVMIOLinux64.jar --no-check-certificate wget -O lib/avctKVMIOLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVMIOLinux64.jar --no-check-certificate
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctKVMIOLinux64.jar, please check your settings${NC}" echo "${RED}Failed to download avctKVMIOLinux64.jar, please check your settings${NC}"
sleep 2 sleep 2
exit 2 exit 2
fi fi
fi fi
if [ ! -f lib/avctVMLinux64.jar ]; then if [ ! -f lib/avctVMLinux64.jar ]; then
echo "Downloading avctVMLinux64"
wget -O lib/avctVMLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctVMLinux64.jar --no-check-certificate wget -O lib/avctVMLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctVMLinux64.jar --no-check-certificate
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctVMLinux64.jar, please check your settings${NC}" echo "${RED}Failed to download avctVMLinux64.jar, please check your settings${NC}"
sleep 2 sleep 2
exit 2 exit 2
fi fi
fi fi
cd lib
if [ ! -f lib/avctKVMIOLinux64.so ]; then
echo "Extracting avctKVMIOLinux64"
jar -xf avctKVMIOLinux64.jar
fi
if [ ! -f lib/avctVMLinux64.so ]; then
echo "Extracting avctVMLinux64"
jar -xf avctVMLinux64.jar
fi
cd /app
echo "${GREEN}Initialization complete, starting virtual console${NC}"
exec java -cp avctKVM.jar -Djava.library.path="./lib" com.avocent.idrac.kvm.Main ip=${IDRAC_HOST} kmport=5900 vport=5900 user=${IDRAC_USER} passwd=${IDRAC_PASSWORD} apcp=1 version=2 vmprivilege=true "helpurl=https://${IDRAC_HOST}:443/help/contents.html" exec java -cp avctKVM.jar -Djava.library.path="./lib" com.avocent.idrac.kvm.Main ip=${IDRAC_HOST} kmport=5900 vport=5900 user=${IDRAC_USER} passwd=${IDRAC_PASSWORD} apcp=1 version=2 vmprivilege=true "helpurl=https://${IDRAC_HOST}:443/help/contents.html"