initial commit of file from CVS for smeserver-phpvirtualbox

This commit is contained in:
Trevor Batley 2023-03-22 16:55:15 +11:00
parent e1a4b7e511
commit 8714055c6a
37 changed files with 2732 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.tar.gz

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program 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 program 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-phpvirtualbox
# $Id: Makefile,v 1.1 2022/08/16 03:22:26 jpp Exp $
NAME := smeserver-phpvirtualbox
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

1
archivefilename Normal file
View File

@ -0,0 +1 @@
smeserver-phpvirtualbox-5.2.1.tar.gz

73
common/LICENSE Normal file
View File

@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

6
common/Makefile Normal file
View File

@ -0,0 +1,6 @@
# lame duck Makefile that exists for the sole purpose of "make clean"
all:
clean:
@rm -fv *~

746
common/Makefile.common Normal file
View File

@ -0,0 +1,746 @@
# -*- Makefile -*-
#
# Common Makefile for building RPMs
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
# Copyright (C) 2004-2005 Red Hat, Inc.
# Copyright (C) 2005 Fedora Foundation
#
# $Id: Makefile.common,v 1.14 2022/06/08 18:44:49 jpp Exp $
# Define the common dir.
# This needs to happen first.
define find-common-dir
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
endef
COMMON_DIR := $(shell $(find-common-dir))
# Branch and disttag definitions
# These need to happen second.
ifndef HEAD_BRANCH
HEAD_BRANCH := devel
endif
BASEDIR := $(shell basename `pwd`)
# BRANCH := $(BASEDIR)
# Get tag for module - e.g. contribs10 or sme10 from file left by cvs2git conversion script
BRANCH := $(shell cat contriborbase)
BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
TARGET := $(word 1, $(BRANCHINFO))
DIST = $(word 2, $(BRANCHINFO))
DISTVAR = $(word 3, $(BRANCHINFO))
DISTVAL = $(word 4, $(BRANCHINFO))
DISTDEF = $(shell echo $(DIST) | sed -e s/^\\\.//| sed -e s/\\\./_/ )
SMEVAL = $(word 5, $(BRANCHINFO))
DIST_DEFINES = --define "dist $(DIST)" --define "$(DISTVAR) $(DISTVAL)" --define "$(DISTDEF) 1" --define "sme $(SMEVAL)"
BUILD_FLAGS ?= $(KOJI_FLAGS)
LOCALARCH := $(if $(shell grep -i '^BuildArch:.*noarch' $(SPECFILE)), noarch, $(shell uname -m))
## a base directory where we'll put as much temporary working stuff as we can
ifndef WORKDIR
WORKDIR := $(shell pwd)
endif
## of course all this can also be overridden in your RPM macros file,
## but this way you can separate your normal RPM setup from your CVS
## setup. Override RPM_WITH_DIRS in ~/.cvspkgsrc to avoid the usage of
## these variables.
SRCRPMDIR ?= $(WORKDIR)
BUILDDIR ?= $(WORKDIR)
RPMDIR ?= $(WORKDIR)
MOCKDIR ?= $(WORKDIR)
MOCKCFG ?= smeserver-$(SMEVAL)-$(BUILDARCH)-base
## SOURCEDIR is special; it has to match the CVS checkout directory,
## because the CVS checkout directory contains the patch files. So it basically
## can't be overridden without breaking things. But we leave it a variable
## for consistency, and in hopes of convincing it to work sometime.
ifndef SOURCEDIR
SOURCEDIR := $(shell pwd)
endif
ifndef SPECDIR
SPECDIR := $(shell pwd)
endif
ifndef RPM_DEFINES
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
--define "_specdir $(SPECDIR)" \
--define "_builddir $(BUILDDIR)" \
--define "_srcrpmdir $(SRCRPMDIR)" \
--define "_rpmdir $(RPMDIR)" \
$(DIST_DEFINES)
endif
# Initialize the variables that we need, but are not defined
# the version of the package
VER_REL := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
ifndef NAME
$(error "You can not run this Makefile without having NAME defined")
endif
ifndef VERSION
VERSION := $(word 1, $(VER_REL))
endif
# the release of the package
ifndef RELEASE
RELEASE := $(word 2, $(VER_REL))
endif
# this is used in make patch, maybe make clean eventually.
# would be nicer to autodetermine from the spec file...
RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION)
#needed for archivefile rule
TREEPATH := $(NAME)-$(VERSION)
TREEPATH := $(NAME)-$(VERSION)
EXT := $(shell cat $(NAME).spec | grep Source | head -n 1 | sed 's/Source: //' | sed -E 's/^([^.]*\.)(.*)$/\2//')
ARCHIVEFILE := $(shell cat $(NAME).spec | grep Source | head -n 1 | sed -r 's/^Source[0..9]*:\s*//' | xargs basename)
ARCHIVEFILE := $(shell rpm --queryformat '$(ARCHIVEFILE)\n' --specfile $(NAME).spec | head -n 1)
TEMPDIR := $(shell mktemp -d)
# default target: just make sure we've got the sources
all: sources
# user specific configuration
CVS_EXTRAS_RC := $(shell if test -f $(HOME)/.cvspkgsrc ; then echo $(HOME)/.cvspkgsrc ; fi)
ifdef CVS_EXTRAS_RC
include $(CVS_EXTRAS_RC)
endif
# The repository and the clients we use for the files
REPOSITORY ?= http://buildsys.contribs.org/source
UPLOAD_REPOSITORY ?= /build/builds/source
# We define CURL and WGET in a way that makes if possible to have them
# overwritten from the module's Makefiles. Then CLIENT picks CURL, otherwise WGET
CURL ?= $(shell if test -f /usr/bin/curl ; then echo "curl -H Pragma: -O -R -S --fail --show-error" ; fi)
WGET ?= $(shell if test -f /usr/bin/wget ; then echo "wget -nd -m" ; fi)
CLIENT ?= $(if $(CURL),$(CURL),$(if $(WGET),$(WGET)))
PLAGUE_CLIENT ?= $(shell which plague-client 2>/dev/null)
BUILD_CLIENT ?= $(shell which koji 2>/dev/null)
BODHI_CLIENT ?= $(shell which bodhi 2>/dev/null)
# RPM with all the overrides in place; you can override this in your
# .cvspkgsrc also, to use a default rpm setup
# the rpm build command line
ifndef RPM
RPM := rpmbuild
endif
ifndef RPM_WITH_DIRS
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
endif
# CVS-safe version/release -- a package name like 4Suite screws things
# up, so we have to remove the leaving digits from the name
TAG_NAME := $(shell echo $(NAME) | sed -e s/\\\./_/g -e s/^[0-9]\\\+//g)
TAG_VERSION := $(shell echo $(VERSION) | sed s/\\\./_/g)
TAG_RELEASE := $(shell echo $(RELEASE) | sed s/\\\./_/g)
# tag to export, defaulting to current tag in the spec file
TAG?=$(TAG_NAME)-$(TAG_VERSION)-$(TAG_RELEASE)
# where to cvs export temporarily
TMPCVS := $(WORKDIR)/cvs-$(TAG)
# source file basenames
SOURCEFILES := $(shell cat sources 2>/dev/null | awk '{ print $$2 }')
# full path to source files
FULLSOURCEFILES := $(addprefix $(SOURCEDIR)/,$(SOURCEFILES))
# retrieve the stored md5 sum for a source download
define get_sources_md5
$(shell cat sources 2>/dev/null | while read m f ; do if test "$$f" = "$@" ; then echo $$m ; break ; fi ; done)
endef
# list the possible targets for valid arches
ARCHES = noarch i386 i586 i686 x86_64 # ia64 s390 s390x ppc ppc64 pseries ppc64pseries iseries ppc64iseries athlon alpha alphaev6 sparc sparc64 sparcv9 sparcv9v sparc64v i164 mac sh mips geode
# for the modules that do different "make prep" depending on what arch we build for
PREP_ARCHES = $(addprefix prep-,$(ARCHES))
## list all our bogus targets
.PHONY :: $(ARCHES) commit sources uploadsource upload export check build-check plague koji build cvsurl chain-build test-srpm srpm tag force-tag verrel new clean patch prep compile install install-short compile-short FORCE local scratch-build scratch-build-%
# The TARGETS define is meant for local module targets that should be
# made in addition to the SOURCEFILES whenever needed
# TARGETS ?= archivefile
TARGETS ?=
# default target - retrieve the sources and make the module specific targets
sources: $(SOURCEFILES) $(TARGETS)
# Retrieve the sources we do not have in CVS
$(SOURCEFILES): #FORCE
@mkdir -p $(SOURCEDIR)
@echo "Downloading $@..."
@for i in `find ../ -maxdepth 2 -name "$@"`; do \
if test "$$(md5sum $$i | awk '{print $$1}')" = "$(get_sources_md5)" ; then \
echo "Copying from $$i" ; \
ln $$i $@ ; \
break ; \
fi ; \
done
@if [ -z "$(CLIENT)" ]; then echo "Can't download, need curl or wget installed." ; exit 1; fi
@if [ ! -e "$@" ] ; then $(CLIENT) $(REPOSITORY)/$(get_sources_md5)/$@ ; fi
@if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi
@if test "$$(md5sum $@ | awk '{print $$1}')" != "$(get_sources_md5)" ; then \
echo "md5sum of the downloaded $@ does not match the one from 'sources' file" ; \
echo "Local copy: $$(md5sum $@)" ; \
echo "In sources: $$(grep $@ sources)" ; \
exit 1 ; \
else \
ls -l $@ ; \
fi
# Support for uploading stuff into the repository.
ifdef FILES
upload-file = echo -F "name=$(NAME)" -F "md5sum=$${m%%[[:space:]]*}" -F "file=@$$f" $(UPLOAD_REPOSITORY)
define upload-request
echo "Checking : $$b on $(UPLOAD_REPOSITORY)..." ; \
if test -f "$(UPLOAD_REPOSITORY)/$${m%%[[:space:]]*}/$$f"; then \
echo "This file ($$m) is already uploaded" ; \
else \
echo "Uploading: $$b to $(UPLOAD_REPOSITORY)..." ; \
mkdir -p "$(UPLOAD_REPOSITORY)/$${m%%[[:space:]]*}" || exit 1 ; \
ln -f "$$f" "$(UPLOAD_REPOSITORY)/$${m%%[[:space:]]*}/$$f" 2> /dev/null || cp -f "$$f" "$(UPLOAD_REPOSITORY)/$${m%%[[:space:]]*}/$$f" || exit 1 ; \
fi
endef
# Upload the FILES, adding to the ./sources manifest
upload: $(FILES)
@if ! test -f ./sources ; then touch ./sources ; fi
@if ! test -f ./.cvsignore ; then touch ./.cvsignore ; fi
@for f in $(FILES); do \
if ! test -s $$f ; then echo "SKIPPING EMPTY FILE: $$f" ; continue ; fi ; \
b="$$(basename $$f)" ; \
m="$$(cd $$(dirname $$f) && md5sum $$b)" ; \
if test "$$m" = "$$(grep $$b sources)" ; then \
echo "ERROR: file $$f is already listed in the sources file..." ; \
exit 1 ; \
fi ; \
chmod +r $$f ; \
echo ; $(upload-request) ; echo ; \
if test -z "$$(egrep ""[[:space:]]$$b$$"" sources)" ; then \
echo "$$m" >> sources ; \
else \
egrep -v "[[:space:]]$$b$$" sources > sources.new ; \
echo "$$m" >> sources.new ; \
mv sources.new sources ; \
fi ; \
if test -z "$$(egrep ""^$$b$$"" .cvsignore)" ; then \
echo $$b >> .cvsignore ; \
fi \
done
@if grep "^/sources/" CVS/Entries >/dev/null; then true ; else cvs -Q add sources; fi
@echo "Source upload succeeded. Don't forget to commit the new ./sources file"
@cvs update sources .cvsignore
# Upload FILES and recreate the ./sources file to include only these FILES
new-source new-sources: $(FILES)
@rm -f sources && touch sources
@rm -f .cvsignore && touch .cvsignore
@for f in $(FILES); do \
if ! test -s $$f ; then echo "SKIPPING EMPTY FILE: $$f" ; continue ; fi ; \
b="$$(basename $$f)" ; \
m="$$(cd $$(dirname $$f) && md5sum $$b)" ; \
chmod +r $$f ; \
echo ; $(upload-request) ; echo ; \
echo "$$m" >> sources ; \
echo "$$b" >> .cvsignore ; \
done
@if grep "^/sources/" CVS/Entries >/dev/null; then true ; else cvs -Q add sources; fi
@echo "Source upload succeeded. Don't forget to commit the new ./sources file"
@cvs update sources .cvsignore
endif
# allow overriding buildarch so you can do, say, an i386 build on x86_64
ifndef BUILDARCH
BUILDARCH := $(shell rpm --eval "%{_arch}")
endif
# test build in mock
mockbuild : srpm
mock $(MOCKARGS) -r $(MOCKCFG) --resultdir=$(MOCKDIR)/$(TAG) rebuild $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
# check the build with rpmlint
lint:
@test -e $(NAME)-$(VERSION)-$(RELEASE).src.rpm || (echo "run 'make local' first" ; exit 1 )
rpmlint $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(LOCALARCH)/*-$(VERSION)-$(RELEASE).$(LOCALARCH).rpm
# build for a particular arch
$(ARCHES) : sources $(TARGETS)
$(RPM_WITH_DIRS) --target $@ -ba $(SPECFILE) 2>&1 | tee .build-$(VERSION)-$(RELEASE).log ; exit $${PIPESTATUS[0]}
# empty target to force checking of md5sums in FULLSOURCEFILES
FORCE:
# build whatever's appropriate for the local architecture
local: $(LOCALARCH)
# attempt to apply all the patches, optionally only for a particular arch
ifdef PREPARCH
prep: sources $(TARGETS)
$(RPM_WITH_DIRS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
else
prep: sources $(TARGETS)
$(RPM_WITH_DIRS) --nodeps -bp $(SPECFILE)
endif
# this allows for make prep-i686, make prep-ppc64, etc
prep-% : Makefile
$(MAKE) prep PREPARCH=$*
compile: sources $(TARGETS)
$(RPM_WITH_DIRS) -bc $(SPECFILE)
install: sources $(TARGETS)
$(RPM_WITH_DIRS) -bi $(SPECFILE)
compile-short: sources $(TARGETS)
$(RPM_WITH_DIRS) --nodeps --short-circuit -bc $(SPECFILE)
install-short: sources $(TARGETS)
$(RPM_WITH_DIRS) --nodeps --short-circuit -bi $(SPECFILE)
CVS_ROOT := $(shell if [ -f CVS/Root ] ; then cat CVS/Root ; fi)
CVS_REPOSITORY := $(shell if [ -f CVS/Repository ] ; then cat CVS/Repository ; fi)
CVS_URL := cvs://shell.koozali.org/cvs/smecontribs?$(CVS_REPOSITORY)\#$(TAG)
## create a clean exported copy in $(TMPCVS)
export:: sources
@mkdir -p $(WORKDIR)
/bin/rm -rf $(TMPCVS)
@if test -z "$(TAG)" ; then echo "Must specify a tag to check out" ; exit 1; fi
@mkdir -p $(TMPCVS)
@cd $(TMPCVS) && \
cvs -Q -d $(CVS_ROOT) export -r$(TAG) -d $(NAME) $(CVS_REPOSITORY) && \
cvs -Q -d $(CVS_ROOT) export -rHEAD common
@if [ -n "$(FULLSOURCEFILES)" ]; then ln -f $(FULLSOURCEFILES) $(TMPCVS)/$(NAME) 2> /dev/null || cp -f $(FULLSOURCEFILES) $(TMPCVS)/$(NAME) ; fi
@echo "Exported $(TMPCVS)/$(NAME)"
## build a test-srpm and see if it will -bp on all arches
# XXX: I am not sure exactly what this is supposed to really do, since the
# query format returns (none) most of the time, and that is not
# handled --gafton
check: test-srpm
@archs=`rpm -qp $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm --qf "[%{EXCLUSIVEARCH}\n]" | egrep -v "(i586)|(i686)|(athlon)"` ;\
if test -z "$$archs"; then archs=noarch; fi ; \
echo "Checking arches: $$archs" ; \
for arch in $$archs; do \
echo "Checking $$arch..."; \
if ! $(RPM_WITH_DIRS) -bp --target $$arch $(SPECFILE); then \
echo "*** make prep failed for $$arch"; \
exit 1; \
fi; \
done;
## use this to build an srpm locally
ifneq (, $(filter contribs7 contribs8 contribs9, $(BRANCH)))
srpm: sources $(TARGETS)
$(RPM_WITH_DIRS) $(DIST_DEFINES) --define _source_filedigest_algorithm=md5 --nodeps -bs $(SPECFILE)
else
srpm: sources $(TARGETS)
$(RPM_WITH_DIRS) $(DIST_DEFINES) --nodeps -bs $(SPECFILE)
endif
test-srpm: srpm
# Create the tar file used to transport the source tree
archivefile:
@echo "Making archive $(TREEPATH).$(EXT)"
@echo "TEMPDIR:$(TEMPDIR)"
mkdir -p $(TEMPDIR)/$(TREEPATH)
cp -r root $(TEMPDIR)/$(TREEPATH)
if test -f createlinks ; then cp createlinks $(TEMPDIR)/$(TREEPATH) ; fi ;
if test -f COPYING ; then cp COPYING $(TEMPDIR)/$(TREEPATH) ; fi ;
if test -f LICENSE ; then cp LICENSE $(TEMPDIR)/$(TREEPATH) ; fi ;
if test -f Copying ; then cp Copying $(TEMPDIR)/$(TREEPATH) ; fi ;
if test -f Artistic ; then cp Artistic $(TEMPDIR)/$(TREEPATH) ; fi ;
if test -f *.c ; then cp *.c $(TEMPDIR)/$(TREEPATH) ; fi ;
rm -f $TREEPATH.$EXT*
tar -czvf $(TREEPATH).$(EXT) -C $(TEMPDIR) $(TREEPATH)
find $(TEMPDIR) -delete
verrel:
@echo $(NAME)-$(VERSION)-$(RELEASE)
# If you build a new version into the tree, first do "make tag",
# then "make srpm", then build the package.
tag:: $(SPECFILE) $(COMMON_DIR)/branches
cvs tag $(TAG_OPTS) -c $(TAG)
@echo "Tagged with: $(TAG)"
@echo
force-tag: $(SPECFILE) $(COMMON_DIR)/branches
@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
define find-user
if [ `cat CVS/Root |grep -c [^:]@` -ne 0 ]; then cat CVS/Root |cut -d @ -f 1 | sed 's/:.*://' ; else echo $(USER); fi
endef
USER := $(shell $(find-user))
oldbuild: $(COMMON_DIR)/branches
@if [ -z "$(TARGET)" -a ! -d CVS ]; then echo "Must be in a branch subdirectory"; exit 1; fi
@cvs status -v $(SPECFILE) 2>/dev/null | grep -q $(TAG); ret=$$? ;\
if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi
@(pushd $(COMMON_DIR) >/dev/null ;\
rm -f tobuild ;\
cvs -Q update -C tobuild ;\
echo -e "$(USER)\t$(CVS_REPOSITORY)\t$(TAG)\t$(TARGET)" >> tobuild ;\
cvs commit -m "request build of $(CVS_REPOSITORY) $(TAG) for $(TARGET)" tobuild ;\
popd >/dev/null)
build-check: $(SPECFILE)
@if [ -z "$(TARGET)" -o ! -d CVS ]; then echo "Must be in a branch subdirectory"; exit 1; fi
@cvs -f status -v $(SPECFILE) 2>/dev/null | grep -q $(TAG); ret=$$? ;\
if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi
plague: build-check $(COMMON_DIR)/branches
@if [ ! -x "$(PLAGUE_CLIENT)" ]; then echo "Must have plague-client installed - see http://fedoraproject.org/wiki/Extras/BuildSystemClientSetup"; exit 1; fi
$(PLAGUE_CLIENT) build $(NAME) $(TAG) $(TARGET)
koji: build-check $(COMMON_DIR)/branches
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)'
ifneq (, $(filter devel, $(BRANCH)))
build: koji
else
build: plague
endif
scratch-build: build-check
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build --scratch $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)'
scratch-build-%: build-check
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build --scratch --arch-override=$* $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)'
bodhi: build-check $(COMMON_DIR)/branches clog
@if [ ! -x "$(BODHI_CLIENT)" ]; then echo "Must have bodhi-client installed"; exit 1; fi
@echo -e "\
# [ $(NAME)-$(VERSION)-$(RELEASE) ]\n\
# type=[S|B|E] (S=security, B=bugfix, E=enhancement) (required)\n\
# request=[T|S] (T=testing, S=stable) (default: testing)\n\
# bug=123,456\n\
# all other text will be considered to be part of the update notes\n\
type=" > bodhi.template
@grep -iZ '\[SME' clog | xargs -0n1 | sed -n -e 's,[^]]*\[SME[: ]*\([0-9]*\)\],\1 ,igp' | xargs | tr ' ' ',' > $(NAME).bugs
@if [ `cat $(NAME).bugs` ]; then echo "bug=`cat $(NAME).bugs`" >> bodhi.template; fi
@sed -e '/^#/d' < bodhi.template > bodhi.template.orig
@if [ -z "$$EDITOR" ]; then vi bodhi.template; else $$EDITOR bodhi.template; fi
@if [ -n "`sed -e '/^#/d' < bodhi.template | diff bodhi.template.orig -`" ]; then \
$(BODHI_CLIENT) -v --new --release $(subst -,,$(BRANCH)) \
--file bodhi.template $(NAME)-$(VERSION)-$(RELEASE) -u $(BODHI_USER); \
else \
echo "Bodhi update aborted!"; \
fi
@rm -f bodhi.template{,.orig} $(NAME).bugs clog
ifndef $(BODHI_USER)
BODHI_USER=$(USER)
endif
ifneq (, $(filter contribs7 contribs8 contribs9, $(BRANCH)))
update: bodhi
endif
cvsurl:
@echo '$(CVS_URL)'
chain-build: build-check
@if [ -z "$(CHAIN)" ]; then \
echo "Missing CHAIN variable, please specify the order of packages to" ; \
echo "chain build. For example: make chain-build CHAIN='foo bar'" ; \
exit 1 ; \
fi ; \
set -e ; \
subdir=`basename $$(pwd)` ; \
urls="" ; \
for component in $(CHAIN) ; do \
if [ "$$component" = "$(NAME)" ]; then \
echo "$(NAME) must not appear in CHAIN" ; \
exit 1 ; \
fi ; \
if [ "$$component" = ":" ]; then \
urls="$$urls :" ; \
continue ; \
elif [ -n "$$urls" -a -z "$(findstring :,$(CHAIN))" ]; then \
urls="$$urls :" ; \
fi ; \
rm -rf .tmp-$$$$ ; \
mkdir -p .tmp-$$$$ ; \
pushd .tmp-$$$$ > /dev/null ; \
cvs -f -Q -z 3 -d $(CVS_ROOT) co $$component ; \
urls="$$urls `make -s -C $$component/$$subdir cvsurl`" ; \
popd > /dev/null ; \
rm -rf .tmp-$$$$ ; \
done ; \
if [ -z "$(findstring :,$(CHAIN))" ]; then \
urls="$$urls :" ; \
fi ; \
urls="$$urls `make -s cvsurl`" ; \
$(BUILD_CLIENT) chain-build $(BUILD_FLAGS) $(TARGET) $$urls
# "make new | less" to see what has changed since the last tag was assigned
new:
-@cvs diff -u -r$$(cvs log Makefile 2>/dev/null | awk '/^symbolic names:$$/ {getline; sub(/^[ \t]*/, "") ; sub (/:.*$$/, ""); print; exit 0}')
# mop up, printing out exactly what was mopped.
clean ::
@echo "Running the %clean script of the rpmbuild..."
-@$(RPM_WITH_DIRS) --clean --nodeps $(SPECFILE)
@for F in $(FULLSOURCEFILES); do \
if test -e $$F ; then \
echo "Deleting $$F" ; /bin/rm -f $$F ; \
fi; \
done
@if test -d $(TMPCVS); then \
echo "Deleting CVS dir $(TMPCVS)" ; \
/bin/rm -rf $(TMPCVS); \
fi
@if test -e $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm ; then \
echo "Deleting $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm" ; \
/bin/rm -f $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm ; \
fi
@rm -fv *~ clog
@echo "Fully clean!"
# To prevent CVS noise due to changing file timestamps, upgrade
# to patchutils-0.2.23-3 or later, and add to ~/.cvspkgsrc:
# FILTERDIFF := filterdiff --remove-timestamps
ifndef FILTERDIFF
FILTERDIFF := cat
endif
ifdef CVE
PATCHFILE := $(NAME)-$(VERSION)-CVE-$(CVE).patch
SUFFIX := cve$(shell echo $(CVE) | sed s/.*-//)
else
PATCHFILE := $(NAME)-$(VERSION)-$(SUFFIX).patch
endif
patch:
@if test -z "$(SUFFIX)"; then echo "Must specify SUFFIX=whatever" ; exit 1; fi
(cd $(RPM_BUILD_DIR)/.. && gendiff $(NAME)-$(VERSION) .$(SUFFIX) | $(FILTERDIFF)) > $(PATCHFILE) || true
@if ! test -s $(PATCHFILE); then echo "Patch is empty!"; exit 1; fi
@echo "Created $(PATCHFILE)"
@grep "$(PATCHFILE)" CVS/Entries >&/dev/null || cvs add -ko $(PATCHFILE) || true
# Recreates the patch file of specified suffix from the current working sources
# but keeping any comments at the top of file intact, and backing up the old copy
# with a '~' suffix.
rediff:
@if test -z "$(SUFFIX)"; then echo "Must specify SUFFIX=whatever" ; exit 1; fi
@if ! test -f "$(PATCHFILE)"; then echo "$(PATCHFILE) not found"; exit 1; fi
@mv -f $(PATCHFILE) $(PATCHFILE)\~
@sed '/^--- /,$$d' < $(PATCHFILE)\~ > $(PATCHFILE)
@(cd $(RPM_BUILD_DIR)/.. && gendiff $(NAME)-$(VERSION) .$(SUFFIX) | $(FILTERDIFF)) >> $(PATCHFILE) || true
clog: $(SPECFILE)
@sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $(SPECFILE) | tee $@
commit: clog
@cvs commit -F $?
@rm -f clog
help:
@echo "Usage: make <target>"
@echo "Available targets are:"
@echo " help Show this text"
@echo " sources Download source files [default]"
@echo " upload FILES=<files> Add <files> to CVS"
@echo " new-sources FILES=<files> Replace sources in CVS with <files>"
@echo " <arch> Local test rpmbuild binary"
@echo " local Local test rpmbuild binary"
@echo " prep Local test rpmbuild prep"
@echo " compile Local test rpmbuild compile"
@echo " install Local test rpmbuild install"
@echo " compile-short Local test rpmbuild short-circuit compile"
@echo " install-short Local test rpmbuild short-circuit install"
@echo " lint Run rpmlint against local build output"
@echo " export Create clean export in \"cvs-$(TAG)\""
@echo " check Check test srpm preps on all archs"
@echo " srpm Create a srpm"
@echo " tag Tag sources as \"$(TAG)\""
@echo " build Request build of \"$(TAG)\" for $(TARGET)"
@echo " chain-build Build current package in order with other packages"
@echo " example: make chain-build CHAIN='libwidget libgizmo'"
@echo " The current package is added to the end of the CHAIN list."
@echo " Colons (:) can be used in the CHAIN parameter to define dependency groups."
@echo " Packages in a single group will be built in parallel, and all packages"
@echo " in a group must build successfully and populate the repository before"
@echo " the next group will begin building."
@echo " If no groups are defined, packages will be built sequentially."
@echo " scratch-build Request scratch build of \"$(TAG)\" for $(TARGET)"
@echo " scratch-build-<archs> Request scratch build of \"$(TAG)\" for $(TARGET) and archs <archs>"
@echo " examples: make scratch-build-i386,ppc64"
@echo " make scratch-build-x86_64"
@echo " mockbuild Local test build using mock"
@echo " verrel Echo \"$(NAME)-$(VERSION)-$(RELEASE)\""
@echo " new Diff against last tag"
@echo " clog Make a clog file containing top changelog entry"
@echo " commit Commit to CVS using the clog file as the log message"
@echo " clean Remove srcs ($(SOURCEFILES)), export dir (cvs-$(TAG)) and srpm ($(NAME)-$(VERSION)-$(RELEASE).src.rpm)"
@echo " patch SUFFIX=<suff> Create and add a gendiff patch file"
@echo " rediff SUFFIX=<suff> Recreates a gendiff patch file, retaining comments"
@echo " unused-patches Print list of patches not referenced by name in specfile"
@echo " unused-fedora-patches Print Fedora patches not used by Patch and/or ApplyPatch directives"
@echo " gimmespec Print the name of the specfile"
@echo " update Submit $(NAME)-$(VERSION)-$(RELEASE) as an update for $(BRANCH)"
gimmespec:
@echo "$(SPECFILE)"
unused-patches:
@for f in *.patch; do if [ -e $$f ]; then grep -q $$f $(SPECFILE) || echo $$f; fi; done
unused-fedora-patches:
@for f in *.patch; do if [ -e $$f ]; then (egrep -q "^Patch[[:digit:]]+:[[:space:]]+$$f" $(SPECFILE) || echo "Unused: $$f") && egrep -q "^ApplyPatch[[:space:]]+$$f" $(SPECFILE) || echo "Unapplied: $$f"; fi; done
##################### EXPERIMENTAL ##########################
# this stuff is very experimental in nature and should not be
# relied upon until these targets are moved above this line
# This section contains some hacks that instrument
# download-from-upstream support. You'll have to talk to gafton, he
# knows how this shit works.
# Add to the list of hardcoded upstream files the contents of the
# ./upstream file
UPSTREAM_FILES += $(shell if test -f ./upstream ; then cat ./upstream ; fi)
# extensions for signature files we need to retrieve for verification
# Warning: if you update the set of defaults, please make sure to
# update/add to the checking rules further down
UPSTREAM_CHECKS ?= sign asc sig md5
# check the signatures for the downloaded upstream stuff
UPSTREAM_CHECK_FILES = $(foreach e, $(UPSTREAM_CHECKS), $(addsuffix .$(e), $(UPSTREAM_FILES)))
# Download a file from a particular host.
# First argument contains the url base, the second the filename,
# third extra curl options
define download-host-file
if test ! -e "$(2)" ; then \
echo -n "URL: $(1)/$(2) ..." ; \
$(CURL) --silent --head $(1)/$(2) && \
{ \
echo "OK, downloading..." ; \
$(CURL) $(3) $(1)/$(2) ; \
} || \
echo "not found" ; \
fi
endef
# Download a file, trying each mirror in sequence. Also check for
# signatures, if available
# First argument contains the file name. We read the list of mirrors
# from the ./mirrors file
define download-file
$(foreach h, $(shell cat mirrors),
$(call download-host-file,$(h),$(1))
if test -e $(1) ; then \
$(foreach e,$(UPSTREAM_CHECKS),$(call download-host-file,$(h),$(1).$(e),--silent) ; ) \
fi
)
if test ! -e $(1) ; then \
echo "ERROR: Could not download file: $(1)" ; \
exit -1 ; \
else \
echo "File $(1) available for local use" ; \
fi
endef
# Download all the UPSTREAM files
define download-files
$(foreach f, $(UPSTREAM_FILES),
$(call download-file,$(f))
echo
)
endef
# Make sure the signature files we download are properly added
define cvs-add-upstream-sigs
for s in $(UPSTREAM_CHECK_FILES) ; do \
if test -f "$$s" ; then \
if ! grep "^/$$s/" CVS/Entries >/dev/null 2>/dev/null ; then \
cvs -Q add "$$s" ; \
fi ; \
fi ; \
done
endef
download : upstream mirrors
@$(download-files)
$(MAKE) download-checks
download-checks :: import-upstream-gpg
download-checks :: $(UPSTREAM_CHECK_FILES)
# how to check for a gpg signature, given a separate signature file
define check-upstream-gpg-sig
echo -n "Checking GPG signature on $* from $@ : "
if ! test -f $@ ; then \
echo "ERROR" ; echo "GPG signature file $@ not found" ; \
exit 1 ; \
fi
if ! gpg --no-secmem-warning --no-permission-warning -q --verify $@ $* 2>/dev/null ; then \
echo "FAILED" ; \
exit 1 ; \
else \
echo "OK" ; \
fi
endef
# how to check for a md5sum, given a separate .md5 file
define check-upstream-md5sum
echo -n "Checking md5sum on $* from $@ : "
if ! test -f $@ ; then \
echo "ERROR" ; echo "md5sum file $@ not found" ; \
exit 1 ; \
fi
if ! md5sum $* | diff >/dev/null --brief "$@" - ; then \
echo "FAILED" ; \
exit 1 ; \
else \
echo "OK" ; \
fi
endef
# and now the rules, specific to each extension
$(addsuffix .sign,$(UPSTREAM_FILES)): %.sign: % FORCE
@$(check-upstream-gpg-sig)
$(addsuffix .asc,$(UPSTREAM_FILES)): %.asc: % FORCE
@$(check-upstream-gpg-sig)
$(addsuffix .sig,$(UPSTREAM_FILES)): %.sig: % FORCE
@$(check-upstream-gpg-sig)
$(addsuffix .md5,$(UPSTREAM_FILES)): %.md5: % FORCE
@$(check-upstream-md5sum)
# We keep all the relevant GPG keys in the upstream-key.gpg so we can
# check the signatures...
import-upstream-gpg : upstream-key.gpg FORCE
mkdir -p $(HOME)/.gnupg
gpg --quiet --import --no-secmem-warning --no-permission-warning $< || :
# A handy target to download the latest and greatest from upstream and
# check it into the lookaside cache.
# new-base assumes that all the sources are downloaded from upstream, so it uses "make new-source"
# rebase uses the standard "make upload"
new-base : clean download
$(MAKE) new-source FILES="$(UPSTREAM_FILES)"
@$(cvs-add-upstream-sigs)
@echo "Don't forget to do a 'cvs commit' for your new sources file."
rebase : clean download
$(MAKE) upload FILES="$(UPSTREAM_FILES)"
@$(cvs-add-upstream-sigs)
@echo "Don't forget to do a 'cvs commit' for your new sources file."
# there is more stuff to clean, now that we have upstream files
clean ::
@rm -fv $(UPSTREAM_FILES)

3
common/README.md Normal file
View File

@ -0,0 +1,3 @@
# common
Common files for rpm building on SMEServer

10
common/branches Normal file
View File

@ -0,0 +1,10 @@
sme7:sme7:.el4.sme:rhel:4:7
sme8:sme8:.el5.sme:rhel:5:8
sme9:sme9:.el6.sme:rhel:6:9
sme10:sme10:.el7.sme:rhel:7:10
devel:sme10:.el7.sme:rhel:7:10
contribs7:contribs7:.el4.sme:rhel:4:7
contribs8:contribs8:.el5.sme:rhel:5:8
contribs9:contribs9:.el6.sme:rhel:6:9
contribs10:contribs10:.el7.sme:rhel:7:10
devel:contribs7:.el4.sme:rhel:4:7

326
common/cvs-import.sh Executable file
View File

@ -0,0 +1,326 @@
#!/bin/bash
#
# Import a given src.rpm on a given branch
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
# Copyright (C) 2004-2005 Red Hat, Inc.
# Copyright (C) 2005 Fedora Foundation
#
# $Id: cvs-import.sh,v 1.10 2013/02/26 18:51:26 slords Exp $
shopt -s nocasematch
# Initial setup
CVSTREE=${CVSTREE:=extras}
TOPLEVEL=${TOPLEVEL:=rpms}
# Check that we're being run from a good location
MYDIR=$(dirname $0)
if [ ! -f ${MYDIR}/CVS/Root ] ; then
echo "ERROR: You need to run this script from the 'common' checkout" >&2
exit 1
fi
# use the CVSROOT from the checkout
CVSROOT=$(cat ${MYDIR}/CVS/Root)
# use the TAG from the checkout
TAG=$(sed -n 's@^T@@p' $(pwd)/CVS/Tag 2> /dev/null)
# We need a writable directory for temporary checkouts and CVS work
WORKDIR="/tmp"
if test -w $(pwd) ; then
WORKDIR="$(pwd)"
fi
[ -f branch ] && BRANCH=$(cat branch)
# short usage help
Usage() {
cat <<EOF
Usage:
$0 [-b <branch>] [-t <cvs tag/branch>] [-m <message>] <package>
Imports a package into the cvs repository. Will use the following defaults:
CVSROOT = $CVSROOT
BRANCH = ${BRANCH:-devel}
TAG = ${TAG}
The package can also be imported on a PRE-EXISTING branch using the
"-b BRANCH" flag. This script can not create new branches for you.
EOF
exit 1
}
# Parse arguments
MESSAGE=
while [ -n "$1" ] ; do
case "$1" in
# import the package on the given branch. If the branch does
# not exist, we will branch the HEAD and then we will perform
# the import
-t | --tag )
shift
TAG="$1"
if [ -z "$TAG" ] ; then
echo "ERROR: --tag requires an argument"
Usage
exit -1
fi
;;
-b | --branch )
shift
BRANCH="$1"
if [ -z "$BRANCH" ] ; then
echo "ERROR: --branch requires an argument"
Usage
exit -1
fi
# protect against moronisms
if [ "$BRANCH" = "HEAD" -o "$BRANCH" = "devel" ] ; then
BRANCH=
fi
;;
-m | --message )
shift
MESSAGE="$1"
;;
# the always helpful help message
-h | --help )
Usage
exit 0
;;
* )
if [ -n "$PACKAGE" ] ; then
echo "ERROR: Only one package at a time, please" >&2
echo "Already got request for $PACKAGE" >&2
exit -1
fi
PACKAGE="$1"
if [ ! -e "$PACKAGE" ] ; then
echo "ERROR: Package $PACKAGE does not exist"
Usage
exit -2
fi
NVR=$(rpm -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}" $PACKAGE 2>/dev/null)
SRCRPM=$(rpm -qp --qf "%{SOURCERPM}" $PACKAGE 2>/dev/null)
if [ -z "$NVR" -o "$SRCRPM" != "(none)" ] ; then
echo "ERROR: Package $PACKAGE does not look like a source RPM package"
Usage
exit -3
fi
# extract NAME VERSION RELEASE, like a 31337 h@x0r
RELEASE=${NVR##*-}
NAME=${NVR%%-$RELEASE}
VERSION=${NAME##*-}
NAME=${NAME%%-$VERSION}
;;
esac
shift
done
if [ -z "$PACKAGE" ] ; then
echo "RPM source package required for import"
Usage
exit 0
fi
# make sure the PACKAGE is an absolute path, as we'll be changing
# directories fairly often in this script
PACKAGE="$(cd $(dirname $PACKAGE) && pwd)/$(basename $PACKAGE)"
# all well
export CVSROOT
CVS="cvs -d $CVSROOT"
# Grab a temp dir
TMPDIR=$(mktemp -d $WORKDIR/tmpcvsXXXXXX)
trap "rm -rf $TMPDIR" 0 9 15
# A cleanup function that can be called from random places
CleanUp() {
if [ -n "$LOGFILE" ] ; then
rm -f $LOGFILE
fi
cd ${WORKDIR}
rm -rf $TMPDIR
echo
}
CreateBranchMakefile() {
cat >Makefile <<EOF
# Makefile for source rpm: $NAME
# \$Id\$
NAME := $NAME
SPECFILE = \$(firstword \$(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f \$\$d/Makefile.common ] ; then if [ -f \$\$d/CVS/Root -a -w \$\$/Makefile.common ] ; then cd \$\$d ; cvs -Q update ; fi ; echo "\$\$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := \$(shell \$(find-makefile-common))
ifeq (\$(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common))
endif
include \$(MAKEFILE_COMMON)
EOF
}
# Check out the existing module
cd $TMPDIR
echo "Checking out module: '$NAME'"
$CVS -Q checkout ${TAG:+-r $TAG} $TOPLEVEL/$NAME || { echo "ERROR: \"$NAME\" module does not exist in cvs."; exit 1; }
# this is our working directory
cd $TOPLEVEL/$NAME
[ -d ${BRANCH} ] || { echo "ERROR: \"$NAME/$BRANCH\" does not exist!"; exit 1; }
# check if we have imported this entry
TAG=$(echo "${NAME##[0-9]}-$VERSION-$RELEASE" | sed -e 's/[$,.:;@]/_/g')
LOG_ENTRY="$TAG:${BRANCH:-HEAD}:$(basename $PACKAGE)"
if [ -n "$(grep ""^$LOG_ENTRY"" ./${BRANCH}/import.log 2>/dev/null)" ] ; then
echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}"
CleanUp
exit -2
fi
# Check here as well because back in the old days we used to write it here
if [ -n "$(grep ""^$LOG_ENTRY"" ./import.log 2>/dev/null)" ] ; then
echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}"
CleanUp
exit -2
fi
# Now the real import job is starting up
BRANCH="${BRANCH:-devel}"
# Unpack the src.rpm
TMP2=$(mktemp -d tmpXXXXXX)
pushd $TMP2 >/dev/null
echo "Unpacking source package: $(basename $PACKAGE)..."
rpm2cpio $PACKAGE | cpio -id --quiet || {
echo "This package appears to be corrupt."
echo "Skipping import for: $PACKAGE"
CleanUp
exit -1
} >&2
popd >/dev/null
# grab a list of files from the src.rpm
FILES=$(rpm -qpl $PACKAGE 2>/dev/null)
# Remove the files that are no longer present
OLDFILES=$(find ${BRANCH} -maxdepth 1 -type f \
-not -name branch \
-not -name import.log \
-not -name sources \
-not -name Makefile \
-not -name .cvsignore \
-print )
for f in $OLDFILES ; do
if [ ! -f "$TMP2/$(basename $f)" ] ; then
cvs -Q delete -f $f
echo "R $(basename $f)"
fi
done
# Add the new files
>${BRANCH}/sources.new
>${BRANCH}/.cvsignore.new
# Now build a list of what needs to be uploaded
UPLOADFILES=
for _f in $FILES ; do
# just to be sure. Who knows when rpm will start returning
# pathnames in src.rpm queries
f=$(basename ${_f})
add_file="yes"
file_md5=$(cd $TMP2 && md5sum $f)
file_size=$(stat --format="%s" $TMP2/$f)
# if the file exists or it is listed in the sources we don't add it
if [ -f ${BRANCH}/$f ] ; then
add_file="no"
cmp -s $TMP2/$f ${BRANCH}/$f || echo "U $f"
elif [ -n "$(grep ""$file_md5"" ${BRANCH}/sources 2>/dev/null)" ] ; then
add_file="no"
# keep it around...
echo "$file_md5" >> ${BRANCH}/sources.new
echo "$f" >> ${BRANCH}/.cvsignore.new
fi
# we catch changed patches this way...
mv -f $TMP2/$f ${BRANCH}/$f
# we need to add this file
pushd ${BRANCH} >/dev/null
if [ "$add_file" = "yes" ] ; then
case $f in
*.tar | *gz | *.bz2 | *.lzma | *.Z | *.zip | *.xz | \
*.ttf | *.bin | *.tbz | *.tbz2 | *.pdf | *.rpm | \
*.jar | *.war | *.db | *.cpio | *.jisp | *.egg | *.gem )
UPLOADFILES="$UPLOADFILES $f"
if [ -n "$(grep $f sources 2>/dev/null)" ] ; then
# this file existed before with a different md5sum
echo "N $f"
else
echo "L $f"
fi
;;
*)
cvs -Q add -ko $f
echo "A $f"
;;
esac
fi
popd >/dev/null
done
# upload the tarballs
pushd ${BRANCH} >/dev/null
# Re-add the branch Makefile (during resurrection of dead packages).
if [ ! -f Makefile ] ; then
CreateBranchMakefile
cvs -Q add Makefile
fi
rm -f sources && mv sources.new sources
rm -f .cvsignore && mv .cvsignore.new .cvsignore
if [ -n "$UPLOADFILES" ] ; then
make upload FILES="$UPLOADFILES" || {
echo "ERROR: Uploading the source tarballs failed!"
exit 9
}
fi
popd >/dev/null
# We no longer need this
rm -rf $TMP2
# setup finished
[ -f ./${BRANCH}/import.log ] || $(touch ./${BRANCH}/import.log; cvs add ./${BRANCH}/import.log)
echo "$LOG_ENTRY:$(date +%s)" >> ./${BRANCH}/import.log
echo "======================================================================="
cvs -Q diff -u
echo "======================================================================="
echo "Please check the above cvs diff."
echo "If you want to make any changes before committing, please press Ctrl-C."
echo "Otherwise press Enter to proceed to commit."
read
cvs -Q update && \
echo "cvs commit..." && \
cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" && \
cd ${BRANCH} && cvs tag ${TAG} && echo "Tagging '${TAG}' complete."
# Clean up
CleanUp

0
common/tobuild Normal file
View File

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

31
createlinks Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
#use esmith::Build::Backup qw(:all);
# our event specific for updating with yum without reboot
$event = 'smeserver-phpvirtualbox-update';
#add here the path to your templates needed to expand
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
foreach my $file (qw(
/etc/httpd/conf/httpd.conf
/etc/opt/remi/php74/php-fpm.d/www.conf
/etc/samba/smb.conf
/opt/phpvirtualbox/config.php
))
{
templates2events( $file, $event );
};
#we need to expand /opt/phpvirtualbox/config.php when changing the vboxweb runtime user passwd
templates2events( '/opt/phpvirtualbox/config.php', 'smeserver-virtualbox-update');
#action needed in case we have a systemd unit
#event_link('systemd-default', $event, '10');
#event_link('systemd-reload', $event, '50');
#services we need to restart
event_services($event, 'httpd-e-smith' => 'restart', 'php74-php-fpm' => 'restart', 'smbd' => 'restart');
#backup_includes("smeserver-virtualbox", qw(
#/home/e-smith/files/users/vbox
#));

View File

@ -0,0 +1 @@
reserved

View File

@ -0,0 +1 @@
phpvirtualbox

View File

@ -0,0 +1 @@
admin

View File

@ -0,0 +1 @@
WebAuth

View File

@ -0,0 +1 @@
all

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
configuration

View File

@ -0,0 +1 @@
vboxusers

View File

@ -0,0 +1,29 @@
{
my $rec = $DB->get('phpvirtualbox')
|| $DB->new_record('phpvirtualbox', {type => 'configuration'});
# webauth replaced by authType, which can have multiple values
if ($rec->prop('webauth')) {
$rec->set_prop('authType', 'WebAuth');
$rec->del_prop('webauth');
}
if ( -e '/etc/e-smith/db/configuration/defaults/phpvirtualbox/Group' ) {
unlink '/etc/e-smith/db/configuration/defaults/phpvirtualbox/Group';
}
# Group has been replaced with userGroups, which already allowed for multiple groups
if ($rec->prop('Group')) {
$rec->set_prop('userGroups', $rec->prop('Group'));
$rec->del_prop('Group');
}
# User replaced by Users, because it already allows for multiple users
if ($rec->prop('User')) {
$rec->set_prop('Users', $rec->prop('User'));
$rec->del_prop('User');
}
if ( -e '/etc/e-smith/db/configuration/defaults/phpvirtualbox/User' ) {
unlink '/etc/e-smith/db/configuration/defaults/phpvirtualbox/User';
}
}

View File

@ -0,0 +1 @@
DefineExternalGroup ugroup environment /usr/bin/unixgroup

View File

@ -0,0 +1,51 @@
{
my $status = $phpvirtualbox{'status'} || "disabled";
return " # phpvirtualbox is disabled in this VirtualHost"
unless $status eq 'enabled';
$OUT = "";
my $satisfy = 'all';
my $name = $phpvirtualbox{'Name'} || 'phpvirtualbox';
my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
my $alias = ($phpvirtualbox{'URL'} || 'phpvirtualbox');
$OUT .= "#------------------------------------------------------------\n";
$OUT .= "# phpvirtualbox - $name\n";
$OUT .= "#------------------------------------------------------------\n";
$OUT .= "Alias /$alias /opt/phpvirtualbox\n";
$OUT .= "\n";
if ($phpvirtualbox{'authtype'} ne 'disabled') {
$OUT .= "<Location /$alias>\n";
if ($phpvirtualbox{'authtype'} eq 'WebAuth') {
$OUT .= " AuthName \"$name\"\n";
$OUT .= " AuthType Basic\n";
$OUT .= " AuthBasicProvider external\n";
$OUT .= " AuthExternal pwauth\n";
$OUT .= " GroupExternal ugroup\n";
$OUT .= " Require user admin @phpvboxusers\n";
$OUT .= " Require external-group @phpvboxgroups\n";
} elsif ($phpvirtualbox{'authtype'} eq 'httpd_LDAP') {
$OUT .= " AuthName \"$name\"\n";
$OUT .= " AuthType Basic\n";
$OUT .= " AuthBasicProvider ldap\n";
$OUT .= " AuthLDAPURL = ldap://localhost/0=$smb{'Workgroup'},%uid\n";
$OUT .= " Require ldap-user admin @phpvboxusers\n";
foreach my $group (@phpvboxgroups) {
$OUT .= " Require ldap-group cn=@group, o=*\n";
}
}
$OUT .= "</Location>\n";
$OUT .= "\n";
}
$OUT .= "<Directory /opt/phpvirtualbox>\n";
$OUT .= " SSLRequireSSL\n";
$OUT .= " Require ip $localAccess\n";
$OUT .= " <FilesMatch .php\$>\n";
$OUT .= " SetHandler \"proxy:unix:/var/run/php-fpm/php74-phpvirtualbox.sock|fcgi://localhost\"\n";
$OUT .= " </FilesMatch>\n";
$OUT .= " AddType application/x-httpd-php .php\n";
$OUT .= "</Directory>\n";
}

View File

@ -0,0 +1,11 @@
{
if ($port ne "443")
{
$OUT .= " ## Redirect phpvirtualbox Address to Secure Address\n";
$OUT .= "RewriteEngine on\n";
$OUT .= "RewriteRule ^/phpvirtualbox https://%{HTTP_HOST}/phpvirtualbox\n";
if ((exists $phpvirtualbox{'URL'}) && ($phpvirtualbox{'URL'} ne ''))
{ $OUT .= "RewriteRule ^/$phpvirtualbox{'URL'} https://%{HTTP_HOST}/$phpvirtualbox{'URL'}\n"; }
$OUT .= "##End of redirection\n";
}
}

View File

@ -0,0 +1,65 @@
{
my $phpversion = ($phpvirtulabox{Version} || '74');
if ($PHP_VERSION eq $phpversion) {
if (($phpvirtualbox{'status'} || 'disabled') eq 'enabled') {
my $max_upload_size = ($phpvirtualbox{MaxUploadSize} || '4096');
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
my $memory_limit = ($phpvirtualbox{MemoryLimit} || '500M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $phpvirtualbox{PHPBaseDir} || '';
my $id = 'phpvirtualbox';
$open_basedir = "/opt/phpvirtualbox/:/var/log/php/$id/:/var/lib/php/$id/:$open_basedir";
my $max_children = $phpvirtualbox{'PHPmaxChildren'} || 20;
my $min_spare_servers = $phpvirtualbox{'PHPminServers'} || 4;
my $start_servers = $phpvirtualbox{'PHPstartServers'} || 6;
my $max_spare_servers = $phpvirtualbox{'PHPmaxServers'} || 8;
my $max_requests = $phpvirtualbox{'PHPmaxRequests'} || 1000;
$min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
$start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
$OUT .=<<_EOF;
[php$PHP_VERSION-$id]
user = www
group = www
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
pm = dynamic
pm.max_children = $max_children
pm.start_servers = $start_servers
pm.min_spare_servers = $min_spare_servers
pm.max_spare_servers = $max_spare_servers
pm.max_requests = $max_requests
php_admin_value[session.save_path] = /var/lib/php/$id/session
php_admin_value[session.gc_maxlifetime] = 86400
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[error_log] = /var/log/php/$id/error.log
slowlog = /var/log/php/$id/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = $memory_limit
php_admin_value[max_execution_time] = 3600
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd
php_admin_value[open_basedir] = $open_basedir
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_uploads] = on
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_flag[output_buffering] = off
php_admin_flag[eaccelerator.enable] = on
_EOF
} else {
$OUT .= '; phpvirtualbox is disabled';
}
}
}

View File

@ -0,0 +1,55 @@
{
if ($phpvirtualbox{'status'} ne 'enabled') {
return;
}
my $samba = ($phpvirtualbox{'samba'} || 'all');
if ($samba ne 'all' && $samba ne 'adminUser') {
return;
}
my $validusers = '';
my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
if ($samba eq 'all' || $samba eq 'adminUser') {
if ($phpvirtualbox{'adminUser'}) {
$validusers = "$phpvirtualbox{'adminUser'}";
}
}
if ($samba eq 'all') {
if ($phpvirtualbox{'Users'}) {
foreach my $user (@phpvboxusers) {
if ($validusers) {
$validusers .= ",$user";
} else {
$validusers = "$user";
}
}
}
if ($phpvirtualbox{'userGroups'}) {
foreach my $group (@phpvboxgroups) {
if ($validusers) {
$validusers .= ",\@$group";
} else {
$validusers = "\@$group";
}
}
}
}
$OUT .=<<_VBOX;
[virtualbox]
comment = virtualbox ISO directory
path = /opt/vbox/ISOs
read only = no
writable = yes
printable = no
inherit permissions = yes
create mode = 0777
_VBOX
if ($validusers) {
$OUT .= "valid users = $validusers\n";
}
}

View File

@ -0,0 +1,90 @@
{
# domain stuff
my $baseDN = esmith::util::ldapBase($DomainName);
my $workgroup = $smb{'Workgroup'};
# vboxweb parameters
my $username = (${'vboxweb-service'}{'user'} || 'vbox');
my $password = ${'vboxweb-service'}{'password'};
my $location = ("http://${'vboxweb-service'}{'access'}:${'vboxweb-service'}{'TCPPort'}/" || "http://127.0.0.1:18083/");
# phpvirtualbox parameters for users
my $adminUser = ($phpvirtualbox{'adminUser'} || 'admin');
my $adminGroup = ($phpvirtualbox{'adminGroup'} || 'admin');
my $userGroups = $phpvirtualbox{'userGroups'};
# phpvirtualbox config parameters
my $language = ($phpvirtualbox{'language'} || 'en');
my $vrdeports = ($phpvirtualbox{'vrdeports'} || '19000-19100');
my $maxProgressList = ($phpvirtualbox{'maxProgressList'} || 5);
my $deleteOnRemove = ($phpvirtualbox{'deleteOnRemove'} || true);
my $browserRestrictFiles = ($phpvirtualbox{'browserRestrictFiles'} || "'.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'");
my $browserRestrictFolders = ($phpvirtualbox{'browserRestrictFolders'} || "'/opt/vbox/ISOs','/opt/vbox/VMs'");
my $hostMemInfoRefreshInterval = ($phpvirtualbox{'hostMemInfoRefreshInterval'} || 5);
my $consoleResolutions = ($phpvirtualbox{'consoleResolutions'} || "'640x480','800x600','1024x768','1280x720','1440x900'");
my $consoleKeyboardLayout = ($phpvirtualbox{'consoleKeyboardLayout'} || 'EN');
my $nicMax = ($phpvirtualbox{'nicMax'} || 4);
# working
my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
$OUT .=<<_PARMS;
class phpVBoxConfig {
# default paramaters
var \$username = '$username';
var \$password = '$password';
var \$location = '$location';
var \$language = '$language';
var \$vrdeports = '$vrdeports';
var \$maxProgressList = $maxProgressList;
var \$deleteOnRemove = $deleteOnRemove;
var \$browserRestrictFiles = array($browserRestrictFiles);
var \$browserRestrictFolders = array($browserRestrictFolders);
var \$hostMemInfoRefreshInterval = $hostMemInfoRefreshInterval;
var \$consoleResolutions = array($consoleResolutions);
var \$consoleKeyboardLayout = '$consoleKeyboardLayout';
var \$nicMax = $nicMax;
# authentication parameters
_PARMS
# authentication stuff
my $authtype = ($phpvirtualbox{'authType'} || 'WebAuth');
if ($authtype eq 'Builtin') {
$OUT .= "var \$authLib = 'Builtin';\n";
} elsif ($authtype eq 'WebAuth') {
$OUT .= "var \$authLib = 'WebAuth';\n";
$OUT .= "var \$authConfig = array('adminUser' => '$adminUser');\n";
} elsif ($authtype eq 'LDAP') {
$OUT .= "var \$authLib = 'LDAP';\n";
$OUT .= "var \$authConfig = array(\n";
$OUT .= " 'host' => '127.0.0.1',\n";
$OUT .= " 'bind_dn' => 'uid=%s, ou=Users, $baseDN',\n";
$OUT .= " 'adminUser' => $adminUser);\n";
} elsif ($authtype eq 'AD' && $workgroup ) {
$OUT .= "var \$authLib = 'ActiveDirectory';\n";
$OUT .= "var \$authConfig = array(\n";
$OUT .= " 'host' => '127.0.0.1',\n";
$OUT .= " 'domain' => '$workgroup',\n";
$OUT .= " 'admin_group' => '$adminGroup'";
if ($userGroups) {
foreach my $group (@phpvboxgroups) {
$OUT .= ",\n";
$OUT .= " 'user_group' => '$group'";
}
};
$OUT .= ");\n";
} else {
$OUT .= "var \$noAuth=true;\n";
}
# allow inclusion of any generic parameter stored in config db for phpvirtualbox
$OUT .= "# additional parameters defined in configuration DB\n";
my @stdparms = qw(type status Name samba Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax);
while (my ($param, $value) = each (%phpvirtualbox)) {
next if ( $param ~~ @stdparms );
$OUT .= "var \$$param = $value;\n";
}
$OUT .= "}\n";
}

View File

@ -0,0 +1 @@
/etc/e-smith/templates-default/template-begin-php

View File

@ -0,0 +1,18 @@
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type 2015-08-08 21:37:59.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type 2022-10-19 10:27:08.000000000 +1100
@@ -1 +1 @@
-reserved
+url
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2022-10-18 14:45:32.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2022-10-19 10:42:01.000000000 +1100
@@ -1,7 +1,7 @@
{
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open_ro or die "Couldn't open Accounst DB\n";
- my $passwd = do{local(@ARGV,$/)="/home/e-smith/files/users/vbox/.virtualbox/vbox.passwd";<>} or die "vbox credentials NOT found\n";
+ my $passwd = do{local(@ARGV,$/)="/home/vbox/.virtualbox/vbox.passwd";<>} or die "vbox credentials NOT found\n";
$OUT .=<<_PARMS;

View File

@ -0,0 +1,432 @@
diff -urN smeserver-phpvirtualbox-5.2.1.old/createlinks smeserver-phpvirtualbox-5.2.1/createlinks
--- smeserver-phpvirtualbox-5.2.1.old/createlinks 2022-10-18 09:49:44.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/createlinks 2023-03-01 16:58:09.000000000 +1100
@@ -9,17 +9,22 @@
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
foreach my $file (qw(
- /etc/php-fpm.d/phpvirtualbox.conf
- /opt/phpvirtualbox/config.php
+ /etc/httpd/conf/httpd.conf
+ /etc/opt/remi/php74/php-fpm.d/www.conf
+ /etc/samba/smb.conf
+ /opt/phpvirtualbox/config.php
))
{
templates2events( $file, $event );
};
+#we need to expand /opt/phpvirtualbox/config.php when changing the vboxweb runtime user passwd
+templates2events( '/opt/phpvirtualbox/config.php', 'smeserver-virtualbox-update');
+
#action needed in case we have a systemd unit
#event_link('systemd-default', $event, '10');
#event_link('systemd-reload', $event, '50');
#services we need to restart
-#event_services($event, 'vboxdrv' => 'restart', 'vboxweb-service' => 'restart');
+event_services($event, 'httpd-e-smith' => 'restart', 'php74-php-fpm' => 'restart', 'smbd' => 'restart');
#backup_includes("smeserver-virtualbox", qw(
#/home/e-smith/files/users/vbox
diff -urN smeserver-phpvirtualbox-5.2.1.old/README.md smeserver-phpvirtualbox-5.2.1/README.md
--- smeserver-phpvirtualbox-5.2.1.old/README.md 2015-08-08 21:37:59.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/README.md 1970-01-01 10:00:00.000000000 +1000
@@ -1,2 +0,0 @@
-smeserver-phpvirtualbox
-=======================
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 2023-02-25 16:29:54.000000000 +1100
@@ -0,0 +1 @@
+admin
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2022-10-17 09:14:35.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2023-02-25 16:29:54.000000000 +1100
@@ -1 +1 @@
-disabled
+WebAuth
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2015-08-08 21:37:59.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2023-02-25 16:29:54.000000000 +1100
@@ -1 +1 @@
-service
+configuration
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 2023-02-28 17:37:52.000000000 +1100
@@ -0,0 +1 @@
+vboxusers
\ No newline at end of file
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled 2015-08-08 21:37:59.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled 1970-01-01 10:00:00.000000000 +1000
@@ -1,8 +0,0 @@
-{
- my $PVBwebauth = $DB->get_prop('phpvirtualbox', 'webauth') or return;
- if ($PVBwebauth eq 'disabled')
- {
- $DB->set_prop('phpvirtualbox',"webauth", "enabled" );
- }
-}
-
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 2023-02-25 16:29:54.000000000 +1100
@@ -0,0 +1,29 @@
+{
+ my $rec = $DB->get('phpvirtualbox')
+ || $DB->new_record('phpvirtualbox', {type => 'configuration'});
+
+ # webauth replaced by authType, which can have multiple values
+ if ($rec->prop('webauth')) {
+ $rec->set_prop('authType', 'WebAuth');
+ $rec->del_prop('webauth');
+ }
+ if ( -e '/etc/e-smith/db/configuration/defaults/phpvirtualbox/Group' ) {
+ unlink '/etc/e-smith/db/configuration/defaults/phpvirtualbox/Group';
+ }
+
+ # Group has been replaced with userGroups, which already allowed for multiple groups
+ if ($rec->prop('Group')) {
+ $rec->set_prop('userGroups', $rec->prop('Group'));
+ $rec->del_prop('Group');
+ }
+
+ # User replaced by Users, because it already allows for multiple users
+ if ($rec->prop('User')) {
+ $rec->set_prop('Users', $rec->prop('User'));
+ $rec->del_prop('User');
+ }
+ if ( -e '/etc/e-smith/db/configuration/defaults/phpvirtualbox/User' ) {
+ unlink '/etc/e-smith/db/configuration/defaults/phpvirtualbox/User';
+ }
+
+}
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup 2023-03-07 12:10:50.000000000 +1100
@@ -0,0 +1 @@
+DefineExternalGroup ugroup environment /usr/bin/unixgroup
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth 2015-08-08 21:37:59.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth 1970-01-01 10:00:00.000000000 +1000
@@ -1,5 +0,0 @@
-{
- $OUT .= " AddExternalGroup ugroup /usr/bin/unixgroup\n";
- $OUT .= " SetExternalGroupMethod ugroup environment\n";
-}
-
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost 2022-10-18 08:09:34.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost 2023-03-07 12:09:59.000000000 +1100
@@ -6,8 +6,8 @@
$OUT = "";
my $satisfy = 'all';
my $name = $phpvirtualbox{'Name'} || 'phpvirtualbox';
- my @phpvuser = split(",", ($phpvirtualbox{'User'} || "") );
- my @phpvgroup = split(",", ($phpvirtualbox{'Group'} || "") );
+ my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
+ my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
my $alias = ($phpvirtualbox{'URL'} || 'phpvirtualbox');
$OUT .= "#------------------------------------------------------------\n";
@@ -18,20 +18,23 @@
$OUT .= "\n";
if ($phpvirtualbox{'authtype'} ne 'disabled') {
$OUT .= "<Location /$alias>\n";
- if ($phpvirtualbox{'authtype'} eq 'httpd_webauth') {
+ if ($phpvirtualbox{'authtype'} eq 'WebAuth') {
$OUT .= " AuthName \"$name\"\n";
- $OUT .= " AuthType Basic\n";
- $OUT .= " AuthBasicProvider \n";
- $OUT .= " AuthExternal webauth\n";
- $OUT .= " GroupExternal ugroup\n";
- $OUT .= " Require user admin @phpvuser\n";
- $OUT .= " Require group @phpvgroup\n";
+ $OUT .= " AuthType Basic\n";
+ $OUT .= " AuthBasicProvider external\n";
+ $OUT .= " AuthExternal pwauth\n";
+ $OUT .= " GroupExternal ugroup\n";
+ $OUT .= " Require user admin @phpvboxusers\n";
+ $OUT .= " Require external-group @phpvboxgroups\n";
} elsif ($phpvirtualbox{'authtype'} eq 'httpd_LDAP') {
- $OUT .= " AuthName \"$name\"\n";
- $OUT .= " AuthType Basic\n";
- $OUT .= " AuthBasicProvider ldap\n";
- $OUT .= " Require ldap-user admin @phpvuser\n";
- $OUT .= " Require ldap-group cn=@phpvgroup, o=*\n";
+ $OUT .= " AuthName \"$name\"\n";
+ $OUT .= " AuthType Basic\n";
+ $OUT .= " AuthBasicProvider ldap\n";
+ $OUT .= " AuthLDAPURL = ldap://localhost/0=$smb{'Workgroup'},%uid\n";
+ $OUT .= " Require ldap-user admin @phpvboxusers\n";
+ foreach my $group (@phpvboxgroups) {
+ $OUT .= " Require ldap-group cn=@group, o=*\n";
+ }
}
$OUT .= "</Location>\n";
$OUT .= "\n";
@@ -46,4 +49,3 @@
$OUT .= " AddType application/x-httpd-php .php\n";
$OUT .= "</Directory>\n";
}
-
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox 2022-10-12 14:58:16.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
@@ -1,32 +0,0 @@
-[php74-phpvirtualbox]
-user = www
-group = www
-listen.owner = root
-listen.group = www
-listen.mode = 0660
-listen = /var/run/php-fpm/php74-phpvirtualbox.sock
-pm = dynamic
-pm.max_children = 15
-pm.start_servers = 3
-pm.min_spare_servers = 3
-pm.max_spare_servers = 4
-pm.max_requests = 1000
-slowlog = /var/log/php/phpvirtualbox/slow.log
-php_admin_value[session.save_path] = /var/lib/php/php74/phpvirtualbox/session
-php_admin_value[opcache.file_cache] = /var/lib/php/php74/phpvirtualbox/opcache
-php_admin_value[upload_tmp_dir] = /var/lib/php/php74/phpvirtualbox/tmp
-php_admin_value[sys_temp_dir] = /var/lib/php/php74/phpvirtualbox/tmp
-php_admin_flag[display_errors] = on
-php_admin_flag[log_errors] = on
-php_admin_value[error_log] = /var/log/php/phpvirtualbox/error.log
-php_admin_value[memory_limit] = 128M
-php_admin_value[max_execution_time] = 30
-php_admin_value[upload_max_filesize] = 10M
-php_admin_value[max_input_time] = 60
-php_admin_flag[allow_url_fopen] = 1
-php_admin_flag[file_upload] = on
-php_admin_flag[session.cookie_httponly] = on
-php_admin_flag[allow_url_include] = off
-php_admin_value[session.save_handler] = files
-php_admin_value[open_basedir] = /opt/phpvirtualbox/:/var/lib/php/php74/phpvirtualbox/:/var/log/php/phpvirtualbox/:/var/run/php-fpm/
-php_admin_value[eaccelerator.enable] = 1
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox 2023-02-25 16:29:54.000000000 +1100
@@ -0,0 +1,65 @@
+{
+
+ my $phpversion = ($phpvirtulabox{Version} || '74');
+ if ($PHP_VERSION eq $phpversion) {
+ if (($phpvirtualbox{'status'} || 'disabled') eq 'enabled') {
+ my $max_upload_size = ($phpvirtualbox{MaxUploadSize} || '4096');
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
+ my $memory_limit = ($phpvirtualbox{MemoryLimit} || '500M');
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
+ my $open_basedir= $phpvirtualbox{PHPBaseDir} || '';
+ my $id = 'phpvirtualbox';
+ $open_basedir = "/opt/phpvirtualbox/:/var/log/php/$id/:/var/lib/php/$id/:$open_basedir";
+ my $max_children = $phpvirtualbox{'PHPmaxChildren'} || 20;
+ my $min_spare_servers = $phpvirtualbox{'PHPminServers'} || 4;
+ my $start_servers = $phpvirtualbox{'PHPstartServers'} || 6;
+ my $max_spare_servers = $phpvirtualbox{'PHPmaxServers'} || 8;
+ my $max_requests = $phpvirtualbox{'PHPmaxRequests'} || 1000;
+ $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
+ $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
+
+ $OUT .=<<_EOF;
+
+[php$PHP_VERSION-$id]
+user = www
+group = www
+listen.owner = root
+listen.group = www
+listen.mode = 0660
+listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
+pm = dynamic
+pm.max_children = $max_children
+pm.start_servers = $start_servers
+pm.min_spare_servers = $min_spare_servers
+pm.max_spare_servers = $max_spare_servers
+pm.max_requests = $max_requests
+php_admin_value[session.save_path] = /var/lib/php/$id/session
+php_admin_value[session.gc_maxlifetime] = 86400
+php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
+php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
+php_admin_value[error_log] = /var/log/php/$id/error.log
+slowlog = /var/log/php/$id/slow.log
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
+php_admin_flag[display_errors] = off
+php_admin_flag[log_errors] = on
+php_admin_value[memory_limit] = $memory_limit
+php_admin_value[max_execution_time] = 3600
+php_admin_value[post_max_size] = $max_upload_size
+php_admin_value[upload_max_filesize] = $max_upload_size
+php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd
+php_admin_value[open_basedir] = $open_basedir
+php_admin_flag[allow_url_fopen] = on
+php_admin_flag[file_uploads] = on
+php_admin_flag[session.cookie_httponly] = on
+php_admin_flag[allow_url_include] = off
+php_admin_value[session.save_handler] = files
+php_admin_flag[output_buffering] = off
+php_admin_flag[eaccelerator.enable] = on
+
+_EOF
+
+ } else {
+ $OUT .= '; phpvirtualbox is disabled';
+ }
+ }
+}
\ No newline at end of file
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 2023-03-07 13:11:47.000000000 +1100
@@ -0,0 +1,33 @@
+{
+ my $validusers = '';
+ if ($phpvirtualbox{'adminUser'} || $phpvirtualbox{'userGroups'}) {
+ if ($phpvirtualbox{'adminUser'}) {
+ $validusers = "$phpvirtualbox{'adminUser'}";
+ if ($phpvirtualbox{'userGroups'}) {
+ $validusers .= ",+$phpvirtualbox{'userGroups'}";
+ }
+ } else {
+ if ($phpvirtualbox{'userGroups'}) {
+ $validusers = "+$phpvirtualbox{'userGroups'}";
+ }
+ }
+ }
+
+ $OUT .=<<_VBOX;
+
+[virtualbox]
+comment = virtualbox ISO directory
+path = /opt/vbox/ISOs
+read only = no
+writable = yes
+printable = no
+inherit permissions = yes
+create mode = 0640
+
+_VBOX
+
+ if ($validusers) {
+ $OUT .= "valid users = $validusers\n";
+ }
+
+}
\ No newline at end of file
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-07 16:07:55.309653000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-07 12:07:39.000000000 +1100
@@ -1,38 +1,90 @@
{
+# domain stuff
+ my $baseDN = esmith::util::ldapBase($DomainName);
+ my $workgroup = $smb{'Workgroup'};
+# vboxweb parameters
+ my $username = (${'vboxweb-service'}{'user'} || 'vbox');
+ my $password = ${'vboxweb-service'}{'password'};
+ my $location = ("http://${'vboxweb-service'}{'access'}:${'vboxweb-service'}{'TCPPort'}/" || "http://127.0.0.1:18083/");
+# phpvirtualbox parameters for users
+ my $adminUser = ($phpvirtualbox{'adminUser'} || 'admin');
+ my $adminGroup = ($phpvirtualbox{'adminGroup'} || 'admin');
+ my $userGroups = $phpvirtualbox{'userGroups'};
+# phpvirtualbox config parameters
+ my $language = ($phpvirtualbox{'language'} || 'en');
+ my $vrdeports = ($phpvirtualbox{'vrdeports'} || '19000-19100');
+ my $maxProgressList = ($phpvirtualbox{'maxProgressList'} || 5);
+ my $deleteOnRemove = ($phpvirtualbox{'deleteOnRemove'} || true);
+ my $browserRestrictFiles = ($phpvirtualbox{'browserRestrictFiles'} || "'.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'");
+ my $browserRestrictFolders = ($phpvirtualbox{'browserRestrictFolders'} || "'/opt/vbox/ISOs','/opt/vbox/VMs'");
+ my $hostMemInfoRefreshInterval = ($phpvirtualbox{'hostMemInfoRefreshInterval'} || 5);
+ my $consoleResolutions = ($phpvirtualbox{'consoleResolutions'} || "'640x480','800x600','1024x768','1280x720','1440x900'");
+ my $consoleKeyboardLayout = ($phpvirtualbox{'consoleKeyboardLayout'} || 'EN');
+ my $nicMax = ($phpvirtualbox{'nicMax'} || 4);
+# working
+ my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
+ my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
$OUT .=<<_PARMS;
-
+
class phpVBoxConfig {
-var \$username = 'vbox';
-var \$location = 'http://127.0.0.1:18083/';
-var \$language = 'en';
-var \$vrdeports = '9000-9100';
-var \$maxProgressList = 5;
-var \$deleteOnRemove = true;
-var \$browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
-var \$hostMemInfoRefreshInterval = 5;
-var \$consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900');
-var \$consoleKeyboardLayout = 'EN';
-var \$nicMax = 4;
+# default paramaters
+var \$username = '$username';
+var \$password = '$password';
+var \$location = '$location';
+var \$language = '$language';
+var \$vrdeports = '$vrdeports';
+var \$maxProgressList = $maxProgressList;
+var \$deleteOnRemove = $deleteOnRemove;
+var \$browserRestrictFiles = array($browserRestrictFiles);
+var \$browserRestrictFolders = array($browserRestrictFolders);
+var \$hostMemInfoRefreshInterval = $hostMemInfoRefreshInterval;
+var \$consoleResolutions = array($consoleResolutions);
+var \$consoleKeyboardLayout = '$consoleKeyboardLayout';
+var \$nicMax = $nicMax;
+
+# authentication parameters
_PARMS
- my $authtype = $phpvirtualbox{'authtype'} || 'disabled';
- if ($authtype eq 'webauth') {
- $OUT .= "var \$authLib = 'WebAuth';\n";
- $OUT .= "var \$authConfig = array('adminUser' => 'admin');\n";
- } elsif ($authtype eq 'Builtin') {
+# authentication stuff
+ my $authtype = ($phpvirtualbox{'authType'} || 'WebAuth');
+ if ($authtype eq 'Builtin') {
$OUT .= "var \$authLib = 'Builtin';\n";
+ } elsif ($authtype eq 'WebAuth') {
+ $OUT .= "var \$authLib = 'WebAuth';\n";
+ $OUT .= "var \$authConfig = array('adminUser' => '$adminUser');\n";
} elsif ($authtype eq 'LDAP') {
$OUT .= "var \$authLib = 'LDAP';\n";
$OUT .= "var \$authConfig = array(\n";
- $OUT .= " 'host' => '127.0.0.1',\n";
- $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, dc=mycompany, dc=local',\n";
- $OUT .= " 'adminUser' => 'admin');\n";
+ $OUT .= " 'host' => '127.0.0.1',\n";
+ $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, $baseDN',\n";
+ $OUT .= " 'adminUser' => $adminUser);\n";
+ } elsif ($authtype eq 'AD' && $workgroup ) {
+ $OUT .= "var \$authLib = 'ActiveDirectory';\n";
+ $OUT .= "var \$authConfig = array(\n";
+ $OUT .= " 'host' => '127.0.0.1',\n";
+ $OUT .= " 'domain' => '$workgroup',\n";
+ $OUT .= " 'admin_group' => '$adminGroup'";
+ if ($userGroups) {
+ foreach my $group (@phpvboxgroups) {
+ $OUT .= ",\n";
+ $OUT .= " 'user_group' => '$group'";
+ }
+ };
+ $OUT .= ");\n";
} else {
$OUT .= "var \$noAuth=true;\n";
}
-
+
+# allow inclusion of any generic parameter stored in config db for phpvirtualbox
+ $OUT .= "# additional parameters defined in configuration DB\n";
+ my @stdparms = qw(type status Name Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax);
+ while (my ($param, $value) = each (%phpvirtualbox)) {
+ next if ( $param ~~ @stdparms );
+ $OUT .= "var \$$param = $value;\n";
+ }
+
$OUT .= "}\n";
-
+
}

View File

@ -0,0 +1,49 @@
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type 2022-10-20 12:29:51.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/accounts/defaults/phpvirtualbox/type 2015-08-08 21:37:59.000000000 +1000
@@ -1 +1 @@
-url
+reserved
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2022-10-20 12:29:51.000000000 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2022-10-20 15:29:49.978343497 +1100
@@ -1,13 +1,9 @@
{
- use esmith::AccountsDB;
- my $adb = esmith::AccountsDB->open_ro or die "Couldn't open Accounst DB\n";
- my $passwd = do{local(@ARGV,$/)="/home/vbox/.virtualbox/vbox.passwd";<>} or die "vbox credentials NOT found\n";
$OUT .=<<_PARMS;
class phpVBoxConfig {
var \$username = 'vbox';
-var \$password = '$passwd';
var \$location = 'http://127.0.0.1:18083/';
var \$language = 'en';
var \$vrdeports = '9000-9100';
@@ -20,10 +16,12 @@
var \$nicMax = 4;
_PARMS
- my $authtype = $phpvirtualbox{'authtype'};
+ my $authtype = $phpvirtualbox{'authtype'} || 'disabled';
if ($authtype eq 'webauth') {
$OUT .= "var \$authLib = 'WebAuth';\n";
$OUT .= "var \$authConfig = array('adminUser' => 'admin');\n";
+ } elsif ($authtype eq 'Builtin') {
+ $OUT .= "var \$authLib = 'Builtin';\n";
} elsif ($authtype eq 'LDAP') {
$OUT .= "var \$authLib = 'LDAP';\n";
$OUT .= "var \$authConfig = array(\n";
@@ -34,10 +32,7 @@
$OUT .= "var \$noAuth=true;\n";
}
- $OUT .=<<_EOF;
-}
-
-_EOF
+ $OUT .= "}\n";
}

View File

@ -0,0 +1,80 @@
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/samba smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/samba
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/samba 1970-01-01 10:00:00.000000000 +1000
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/samba 2023-03-19 14:38:18.000000000 +1100
@@ -0,0 +1 @@
+all
\ No newline at end of file
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 2023-03-19 14:43:29.380771500 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 2023-03-19 14:37:11.000000000 +1100
@@ -1,14 +1,36 @@
{
+ if ($phpvirtualbox{'status'} ne 'enabled') {
+ return;
+ }
+ my $samba = ($phpvirtualbox{'samba'} || 'all');
+ if ($samba ne 'all' && $samba ne 'adminUser') {
+ return;
+ }
my $validusers = '';
- if ($phpvirtualbox{'adminUser'} || $phpvirtualbox{'userGroups'}) {
+ my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
+ my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
+ if ($samba eq 'all' || $samba eq 'adminUser') {
if ($phpvirtualbox{'adminUser'}) {
$validusers = "$phpvirtualbox{'adminUser'}";
- if ($phpvirtualbox{'userGroups'}) {
- $validusers .= ",+$phpvirtualbox{'userGroups'}";
+ }
+ }
+ if ($samba eq 'all') {
+ if ($phpvirtualbox{'Users'}) {
+ foreach my $user (@phpvboxusers) {
+ if ($validusers) {
+ $validusers .= ",$user";
+ } else {
+ $validusers = "$user";
+ }
}
- } else {
- if ($phpvirtualbox{'userGroups'}) {
- $validusers = "+$phpvirtualbox{'userGroups'}";
+ }
+ if ($phpvirtualbox{'userGroups'}) {
+ foreach my $group (@phpvboxgroups) {
+ if ($validusers) {
+ $validusers .= ",\@$group";
+ } else {
+ $validusers = "\@$group";
+ }
}
}
}
@@ -22,7 +44,7 @@
writable = yes
printable = no
inherit permissions = yes
-create mode = 0640
+create mode = 0777
_VBOX
@@ -30,4 +52,4 @@
$OUT .= "valid users = $validusers\n";
}
-}
\ No newline at end of file
+}
diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php
--- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-19 14:43:29.380771500 +1100
+++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-19 14:37:53.000000000 +1100
@@ -78,7 +78,7 @@
# allow inclusion of any generic parameter stored in config db for phpvirtualbox
$OUT .= "# additional parameters defined in configuration DB\n";
- my @stdparms = qw(type status Name Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax);
+ my @stdparms = qw(type status Name samba Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax);
while (my ($param, $value) = each (%phpvirtualbox)) {
next if ( $param ~~ @stdparms );
$OUT .= "var \$$param = $value;\n";

View File

@ -0,0 +1,141 @@
%define name smeserver-phpvirtualbox
%define version 5.2.1
%define release 6
%define rpmver 5.2.1
Summary: smserver rpm to install phpvirtualbox
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Source: %{name}-%{version}.tar.gz
License: GNU GPL version 2
URL: http://mirror.de-labrusse.fr
Group: SMEserver/addon
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
Requires: e-smith-release >= 10.0
Requires: php-soap
Requires: phpvirtualbox = 5.2.1
Requires: smeserver-virtualbox = 5.2
AutoReqProv: no
%description
smserver rpm to install phpvirtualbox : An open source, AJAX implementation of the VirtualBox user interface written in PHP. As a
modern web interface, it allows you to access and control remote VirtualBox instances. phpVirtualBox is designed to allow users to
administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.
phpvirtualbox version MUST align with VirtualBox version (i.e. VirtualBox-6.1 requires phpvirtualbox-6.1)
%changelog
* Wed Mar 22 2023 Brian Read <brianr@bjsystems.co.uk> 5.2.1-6.sme
- fix [SME: ]
* Wed Mar 22 2023 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Sun Mar 19 2023 Trevor batley <trevor@batley.id.au> 5.2.1-5
- fix permissions on /opt/vbox/ISOs directory for sharing via samba 0777 [bug #12336]
- fix smb.conf fragment to include Users [bug #12336]
- fix smb.conf fragment to properly include more than 1 group in userGroups [bug #12336]
- add phpvirtualbox samba config item to allow control of if, and who, has access [bug # 12337]
* Fri Mar 10 2023 Trevor Batley <trevor@batley.id.au> 5.2.1-4
- add vbox password back into config.php
- replace /etc/php-fpm.d/phpvirtualbox with /etc/php-fpm.d/www.conf fragment and expand during update
- remove webauth config db item and add authType, with multiple values
- add support for BuiltIn, WebAuth (default), LDAP and AD authentication
- rename config items User => Users, Group => userGroups and add adminUser
- remove defaults for User and Group config items
- add basic default values for config.php as config db items (with same name) and allow entry of other config items
- create /var/lib/php/phpvirtualbox directories (opcache, session, tmp) with www:www ownership and 0755 permissions
- correct permissions on log files
- add smb.conf fragment to allow vboxuser and any userGroups access to /opt/vbox (VMs & ISOs) directories
- add restart of httpd-e-smith and smbd services on update
- create template2expand directive for virtualbox update (which generates/saves new password) for /opt/phpvirtualbox/config.php
* Thu Oct 20 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-3
- remove vbox passwd from config.php
* Wed Oct 19 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-2
- vbox user home directory moved
* Tue Oct 11 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-1
- Initial import to sme10
- requires phpvirtualbox 5.2.1, smeserver-virtualbox 5.2
- upgrade to httpd 2.4
- use php74-php-fpm
- bundle up patches and release new tarball
* Thu Aug 06 2015 stephane de labrusse <stephdl@de-labrusse.fr> 5.0.0-1
- require to phpvirtualbox-5.0
* Sun May 18 2014 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.1-3
- first release to sme9
- unixgroup removed from the contribs
- fix ssl redirection
* Wed Mar 19 2014 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.1-1
- due to the bug correction of phpvirtualbox, this version give back the web authentication with migrate fragment update
* Wed Jan 08 2014 JP Pialasse <tests@pialasse.com> 4.3.0-10.sme
- changing requires to phpvirtualbox = 4.3
* Mon Dec 30 2013 JP Pialasse <tests@pialasse.com> 4.3.0-9.sme
- renaming to import into buildsys
* Fri Dec 13 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-8
- remove the web authentication for the buildin phpvirtualbox authentication
* Sun Nov 10 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-7
- removing dependance to smeserver-virtualbox-4.3
* Tue Nov 05 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-6
- change name to match the phpvirtualbox version
* Wed Oct 23 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-5
- Clean 92phpvirtualbox to force only the localnetwork
- Add the plugin unixgroup (from pwauth) to allow unix groups to reach the apache server.
- you can see http://code.google.com/p/pwauth/ for more informations
* Sun Oct 20 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-4
- Force https protocol for phpvirtualbox
* Sat Oct 19 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-3
- Initial release
%prep
%setup
%build
perl createlinks
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
mkdir -p $RPM_BUILD_ROOT/opt/vbox/{ISOs,VMs}
mkdir -p $RPM_BUILD_ROOT/var/log/php/phpvirtualbox
mkdir -p $RPM_BUILD_ROOT/var/lib/php/phpvirtualbox/{opcache,tmp,session}
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /opt/vbox 'attr(0755,vbox,vboxusers)' \
--dir /opt/vbox/ISOs 'attr(0777,vbox,vboxusers)' \
--dir /opt/vbox/VMs 'attr(0774,vbox,vboxusers)' \
--dir /var/log/php/phpvirtualbox 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/tmp 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/opcache 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/session 'attr(0755,www,www)' \
> %{name}-%{version}-filelist
%clean
cd ..
rm -rf %{name}-%{version}
%pre
%preun
%post
%postun
#uninstall
if [ $1 = 0 ] ; then
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/sbin/e-smith/systemctl restart httpd-e-smith
fi
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)

View File

@ -0,0 +1,142 @@
%define name smeserver-phpvirtualbox
%define version 5.2.1
%define release 5
%define rpmver 5.2.1
Summary: smserver rpm to install phpvirtualbox
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Source: %{name}-%{version}.tar.gz
License: GNU GPL version 2
URL: http://mirror.de-labrusse.fr
Group: SMEserver/addon
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
Requires: e-smith-release >= 10.0
Requires: php-soap
Requires: phpvirtualbox = 5.2.1
Requires: smeserver-virtualbox = 5.2
Patch0: smeserver-phpvirtualbox-5.2.1-move_vbox_dir.patch
Patch1: smeserver-phpvirtualbox-5.2.1-remove_vbox_passwd.patch
Patch2: smeserver-phpvirtualbox-5.2.1-multiple_changes.patch
Patch3: smeserver-phpvirtualbox-5.2.1-samba_share.patch
AutoReqProv: no
%description
smserver rpm to install phpvirtualbox : An open source, AJAX implementation of the VirtualBox user interface written in PHP. As a
modern web interface, it allows you to access and control remote VirtualBox instances. phpVirtualBox is designed to allow users to
administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.
phpvirtualbox version MUST align with VirtualBox version (i.e. VirtualBox-6.1 requires phpvirtualbox-6.1)
%changelog
* Sun Mar 19 2023 Trevor batley <trevor@batley.id.au> 5.2.1-5
- fix permissions on /opt/vbox/ISOs directory for sharing via samba 0777 [bug #12336]
- fix smb.conf fragment to include Users [bug #12336]
- fix smb.conf fragment to properly include more than 1 group in userGroups [bug #12336]
- add phpvirtualbox samba config item to allow control of if, and who, has access [bug # 12337]
* Fri Mar 10 2023 Trevor Batley <trevor@batley.id.au> 5.2.1-4
- add vbox password back into config.php
- replace /etc/php-fpm.d/phpvirtualbox with /etc/php-fpm.d/www.conf fragment and expand during update
- remove webauth config db item and add authType, with multiple values
- add support for BuiltIn, WebAuth (default), LDAP and AD authentication
- rename config items User => Users, Group => userGroups and add adminUser
- remove defaults for User and Group config items
- add basic default values for config.php as config db items (with same name) and allow entry of other config items
- create /var/lib/php/phpvirtualbox directories (opcache, session, tmp) with www:www ownership and 0755 permissions
- correct permissions on log files
- add smb.conf fragment to allow vboxuser and any userGroups access to /opt/vbox (VMs & ISOs) directories
- add restart of httpd-e-smith and smbd services on update
- create template2expand directive for virtualbox update (which generates/saves new password) for /opt/phpvirtualbox/config.php
* Thu Oct 20 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-3
- remove vbox passwd from config.php
* Wed Oct 19 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-2
- vbox user home directory moved
* Tue Oct 11 2022 Trevor Batley <trevor@batley.id.au> 5.2.1-1
- Initial import to sme10
- requires phpvirtualbox 5.2.1, smeserver-virtualbox 5.2
- upgrade to httpd 2.4
- use php74-php-fpm
- bundle up patches and release new tarball
* Thu Aug 06 2015 stephane de labrusse <stephdl@de-labrusse.fr> 5.0.0-1
- require to phpvirtualbox-5.0
* Sun May 18 2014 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.1-3
- first release to sme9
- unixgroup removed from the contribs
- fix ssl redirection
* Wed Mar 19 2014 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.1-1
- due to the bug correction of phpvirtualbox, this version give back the web authentication with migrate fragment update
* Wed Jan 08 2014 JP Pialasse <tests@pialasse.com> 4.3.0-10.sme
- changing requires to phpvirtualbox = 4.3
* Mon Dec 30 2013 JP Pialasse <tests@pialasse.com> 4.3.0-9.sme
- renaming to import into buildsys
* Fri Dec 13 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-8
- remove the web authentication for the buildin phpvirtualbox authentication
* Sun Nov 10 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-7
- removing dependance to smeserver-virtualbox-4.3
* Tue Nov 05 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-6
- change name to match the phpvirtualbox version
* Wed Oct 23 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-5
- Clean 92phpvirtualbox to force only the localnetwork
- Add the plugin unixgroup (from pwauth) to allow unix groups to reach the apache server.
- you can see http://code.google.com/p/pwauth/ for more informations
* Sun Oct 20 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-4
- Force https protocol for phpvirtualbox
* Sat Oct 19 2013 stephane de labrusse <stephdl@de-labrusse.fr> 4.3.0-3
- Initial release
%prep
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
perl createlinks
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
mkdir -p $RPM_BUILD_ROOT/opt/vbox/{ISOs,VMs}
mkdir -p $RPM_BUILD_ROOT/var/log/php/phpvirtualbox
mkdir -p $RPM_BUILD_ROOT/var/lib/php/phpvirtualbox/{opcache,tmp,session}
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /opt/vbox 'attr(0755,vbox,vboxusers)' \
--dir /opt/vbox/ISOs 'attr(0777,vbox,vboxusers)' \
--dir /opt/vbox/VMs 'attr(0774,vbox,vboxusers)' \
--dir /var/log/php/phpvirtualbox 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/tmp 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/opcache 'attr(0755,www,www)' \
--dir /var/lib/php/phpvirtualbox/session 'attr(0755,www,www)' \
> %{name}-%{version}-filelist
%clean
cd ..
rm -rf %{name}-%{version}
%pre
%preun
%post
%postun
#uninstall
if [ $1 = 0 ] ; then
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/sbin/e-smith/systemctl restart httpd-e-smith
fi
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)