Rpm: CentOS dfart. Rpm building isn't automated yet.

This commit is contained in:
Dmitry Maksyoma 2021-02-05 23:49:47 +13:00
parent a6512a7801
commit 90101a7e91
11 changed files with 214 additions and 12 deletions

16
builder/build-rpm Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
. builder/os_ver_cli.sh
docker build -t kasmvnc_rpmbuilder_${os}:${os_codename} -f \
builder/dockerfile.${os}_${os_codename}.rpm.build .
rpm_output_dir=$(cd .. && echo $PWD)
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
L_GID=$(id -g)
docker run --rm -v "$rpm_output_dir":/src --user $L_UID:$L_GID \
kasmvnc_rpmbuilder_${os}:${os_codename} /bin/bash -c \
'/src/*/builder/build-rpm-inside-docker'

View File

@ -66,11 +66,12 @@ touch man/man1/Xserver.1
touch man/man1/Xvnc.1
mkdir lib
cd lib
ln -s /usr/lib/x86_64-linux-gnu/dri dri
if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then
ln -s /usr/lib/x86_64-linux-gnu/dri dri
else
ln -s /usr/lib64/dri dri
fi
cd /src
sed $'s#pushd $TMPDIR/inst#CWD=$(pwd)\\\ncd $TMPDIR/inst#' release/maketarball > release/maketarball2
sed $'s#popd#cd $CWD#' release/maketarball2 > release/maketarball3
mv release/maketarball3 release/maketarball
detect_quilt
if [ -n "$QUILT_PRESENT" ]; then

View File

@ -0,0 +1,17 @@
FROM centos:centos7
RUN yum install -y epel-release && yum groupinstall xfce -y
RUN yum install -y xterm perl
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN yum localinstall -y /tmp/*.rpm
RUN useradd -m docker
USER docker
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT bash -c "vncserver :1 -interface 0.0.0.0 && vncserver -kill :1 && vncserver :1 -depth 24 -geometry 1280x1050 -websocketPort 8443 -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www && tail -f $HOME/.vnc/*.log "

View File

@ -1,8 +1,17 @@
FROM centos:centos7
ENV KASMVNC_BUILD_OS centos
ENV KASMVNC_BUILD_OS_CODENAME core
RUN yum install -y build-dep xorg-server libxfont-dev sudo
RUN yum install -y cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN yum install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
RUN yum install -y gcc cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
RUN yum install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev openssl-devel
RUN yum install -y make
RUN yum group install -y "Development Tools"
RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel
RUN yum install -y mesa-dri-drivers
# Additions for webp
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
@ -11,7 +20,7 @@ RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY . /src
RUN chown -R docker:docker /src

View File

@ -0,0 +1,10 @@
FROM centos:centos7
RUN yum install -y rpm* gpg* rng-tools
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY . /src
RUN chown -R docker:docker /src
USER docker

View File

@ -0,0 +1,61 @@
FROM centos:centos7
ENV DISPLAY=:1 \
VNC_PORT=8443 \
VNC_RESOLUTION=1280x720 \
MAX_FRAME_RATE=24 \
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
HOME=/home/user \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
KASM_RX_HOME=/dockerstartup/kasmrx \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_USER=user \
VNC_VIEW_ONLY_PW=vncviewonlypassword \
LD_LIBRARY_PATH=/usr/local/lib/ \
OMP_WAIT_POLICY=PASSIVE \
SHELL=/bin/bash \
SINGLE_APPLICATION=0 \
KASMVNC_BUILD_OS=centos \
KASMVNC_BUILD_OS_CODENAME=core
EXPOSE $VNC_PORT
WORKDIR $HOME
### REQUIRED STUFF ###
RUN yum install -y openssl xterm gettext wget
RUN yum install -y centos-release-scl-rh && yum install -y nss_wrapper
RUN yum install -y xorg-x11-server xorg-x11-xauth xorg-x11-xkb-utils \
xkeyboard-config xorg-x11-server-utils
RUN yum install -y epel-release && yum groupinstall xfce -y
RUN yum erase -y pm-utils xscreensaver*
RUN yum install -y redhat-lsb-core
RUN yum install -y vim less
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
RUN mkdir -p $STARTUPDIR
COPY startup/ $STARTUPDIR
### START CUSTOM STUFF ####
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN yum localinstall -y /tmp/*.rpm
### END CUSTOM STUFF ###
RUN chown -R 1000:0 $HOME
USER 1000
WORKDIR $HOME
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
chmod +x ~/.vnc/xstartup
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

14
builder/test-rpm Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
. ./os_ver_cli.sh
echo kasmvnctester_${os}:$os_codename
docker build --build-arg \
KASMVNC_PACKAGE_DIR="build" \
-t kasmvnctester_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.rpm.test .
echo docker run -it -p 443:8443 --rm -e "VNC_USER=foo" -e "VNC_PW=bar" \
kasmvnctester_${os}:$os_codename

14
builder/test-rpm-barebones Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
os="centos"
os_codename="core"
docker build --build-arg KASMVNC_PACKAGE_DIR="build" \
-t kasmvnctester_barebones_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.barebones.rpm.test .
echo
echo "You will be asked to set password. User name is docker."
docker run -it -p 443:8443 --rm kasmvnctester_barebones_${os}:$os_codename

53
centos/kasmvncserver.spec Normal file
View File

@ -0,0 +1,53 @@
Name: kasmvncserver
Version: 0.9.1~beta
Release: 1%{?dist}
Summary: Lorem ipsum
License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC
Source0: kasmvnc.centos_core.tar.gz
%description
Lorem ipsum
%prep
%install
rm -rf $RPM_BUILD_ROOT
DESTDIR=$RPM_BUILD_ROOT make -f /src/KasmVNC/debian/Makefile.to_fakebuild_tar_package install
%files
/usr/bin/*
/usr/share/man/man1
/usr/share/kasmvnc/www
%doc /usr/share/doc/kasmvncserver
%changelog
%post
bindir=/usr/bin
mandir=/usr/share/man
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
for kasm_command in $commands; do
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
update-alternatives --install "$bindir/$generic_command" \
"$generic_command" "$bindir/$kasm_command" 90 \
--slave "$mandir/man1/$generic_command.1.gz" "$generic_command.1.gz" \
"$mandir/man1/$kasm_command.1.gz"
done
;;
%postun
bindir=/usr/bin
mandir=/usr/share/man
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
for kasm_command in $commands; do
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
update-alternatives --remove "$generic_command" "$bindir/$kasm_command"
done

View File

@ -1,15 +1,15 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
*
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
@ -38,6 +38,7 @@
#include <sys/un.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <wordexp.h>
#include "websocket.h"

View File

@ -1,6 +1,12 @@
TARGET_OS := $(shell lsb_release -is | tr '[:upper:]' '[:lower:]')
TARGET_OS_CODENAME := $(shell lsb_release -cs)
TARBALL := builder/build/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME).tar.gz
TARGET_OS_CODENAME := $(shell lsb_release -cs | tr '[:upper:]' '[:lower:]')
TARBALL_DIR :=
ifeq ($(TARGET_OS), centos)
TARBALL_DIR := $$RPM_SOURCE_DIR
else
TARBALL_DIR := builder/build
endif
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME).tar.gz
TAR_DATA := $(shell mktemp -d)
SRC := $(TAR_DATA)/usr/local
SRC_BIN := $(SRC)/bin