diff options
Diffstat (limited to 'extra')
-rw-r--r-- | extra/Makefile | 14 | ||||
-rw-r--r-- | extra/pip-helper.sh | 1 | ||||
-rwxr-xr-x | extra/stackbin.init | 2 | ||||
-rw-r--r-- | extra/stackbin.service | 4 | ||||
-rw-r--r-- | extra/stackbin.spec | 86 | ||||
-rw-r--r-- | extra/stackbin.sysusers | 2 |
6 files changed, 52 insertions, 57 deletions
diff --git a/extra/Makefile b/extra/Makefile index f707480..785d2df 100644 --- a/extra/Makefile +++ b/extra/Makefile @@ -7,7 +7,7 @@ # History: # Usage: # Reference: -# hex-zero Makefile +# fuss Makefile # Improve: # add man page? # Document: @@ -30,6 +30,7 @@ SYSVDIR = $(SYSCONFDIR)/init.d SYSDDIR = $(DESTDIR)$(prefix)/lib/systemd/system LOGDIR = $(DESTDIR)/var/log/stackbin APACHEDIR = $(SYSCONFDIR)/httpd/conf.d# for debian use '$(SYSCONFDIR)/apache2/sites-available' +NGINXDIR = $(SYSCONFDIR)/nginx/default.d CRONDIR = $(SYSCONFDIR)/cron.d SBINDIR = $(DESTDIR)$(prefix)/sbin @@ -54,7 +55,8 @@ truebin :=$(shell which true) uniqbin :=$(shell which uniq) xargsbin :=$(shell which xargs) -with_apache ?= YES +with_apache ?= NO +with_nginx ?= YES with_init ?= YES with_systemd ?= NO with_pip_helper ?= NO @@ -81,7 +83,7 @@ deplist_opts: @${grepbin} -h -o -riIE '\<(dep|rec|sug)-[^\ :]+:' ${SRCDIR} | ${sedbin} -r -e 's/(dep|rec|sug)-//;' -e 's/:$$//;' | ${sortbin} | ${uniqbin} 1>&2 install_files: - ${installbin} -m0755 -d ${LOGDIR} ${APPVARDIR}/upload ${APPDIR}/static ${APPDIR}/templates \ + ${installbin} -m0755 -d ${LOGDIR} ${APPVARDIR} ${APPDIR}/static ${APPDIR}/templates \ ${DOCDIR} ${SBINDIR} ${SYSCONFDIR} ${LIBEXECDIR}/${APPNAME} ${installbin} -m0755 -t ${SBINDIR} ${SRCDIR}/${APPNAME}.bin ${installbin} -m0644 -t ${LIBEXECDIR}/${APPNAME} ${SRCDIR}/${APPNAME}.py @@ -94,6 +96,10 @@ ifeq ($(with_apache),YES) ${installbin} -m0755 -d ${APACHEDIR} ${installbin} -m0644 ${SRCDIR}/extra/${APPNAME}.conf.apache ${APACHEDIR}/${APPNAME}.conf endif +ifeq ($(with_nginx),YES) + ${installbin} -m0755 -d ${NGINXDIR} + ${installbin} -m0644 ${SRCDIR}/extra/${APPNAME}.conf.nginx ${NGINXDIR}/${APPNAME}.conf +endif ifeq ($(with_init),YES) ${installbin} -m0755 -d ${SYSVDIR} ${installbin} -m0755 ${SRCDIR}/extra/${APPNAME}.init ${SYSVDIR}/${APPNAME} @@ -119,7 +125,7 @@ uninstall: ${rmbin} -f ${SYSVDIR}/${APPNAME} || : # remove all installed directories that are now blank. - ${rmdirbin} ${APPVARDIR}/upload ${APPDIR}/static \ + ${rmdirbin} ${APPVARDIR} ${APPDIR}/static \ ${SYSVDIR} ${APACHEDIR} ${DOCDIR} \ ${LIBEXECDIR}/${APPNAME} ${LOGDIR} 2>/dev/null || : ${rmdirbin} ${APPDIR} 2>/dev/null || : diff --git a/extra/pip-helper.sh b/extra/pip-helper.sh index 499ef3b..2cc1346 100644 --- a/extra/pip-helper.sh +++ b/extra/pip-helper.sh @@ -7,7 +7,6 @@ id="$( echo "${contents}" | sed -n -e '1p' )" version_id="$( echo "${contents}" | sed -n -e '2p' )" echo "Any parameters sent to this script ${0} will be added to the list of packages to install." -echo "This is particularly useful for adding the PyGObject for icon support on EL7." piplist="${1}" if echo "${id}" | grep -qiE 'rhel|centos' ; diff --git a/extra/stackbin.init b/extra/stackbin.init index 232bca9..a8cd25e 100755 --- a/extra/stackbin.init +++ b/extra/stackbin.init @@ -19,7 +19,7 @@ DAEMON=/usr/sbin/stackbin.bin DESC="stackbin" NAME=stackbin PATH=/sbin:/usr/sbin:/bin:/usr/bin -PIDFILE2=/var/www/stackbin/stackbin.pid +PIDFILE2=/var/run/$NAME-wsgi.pid PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME USER=stackbin diff --git a/extra/stackbin.service b/extra/stackbin.service index f3088be..a2ef4b9 100644 --- a/extra/stackbin.service +++ b/extra/stackbin.service @@ -5,13 +5,13 @@ After=network.target syslog.target [Service] #Environment= -WorkingDirectory=/var/www/stackbin +WorkingDirectory=/var/www User=stackbin Group=stackbin Type=simple ExecStart=/usr/sbin/stackbin.bin TimeoutStartSec=120 -ExecStop=/usr/sbin/uwsgi --stop /var/www/stackbin/stackbin.pid +ExecStop=/usr/sbin/uwsgi --stop /var/run/stackbin-wsgi.pid RestartSec=15 Restart=always KillSignal=SIGINT diff --git a/extra/stackbin.spec b/extra/stackbin.spec index fcc9f8f..f9a7792 100644 --- a/extra/stackbin.spec +++ b/extra/stackbin.spec @@ -1,20 +1,19 @@ -# File: fuss.spec -# Location: fuss package +# File: stackbin.spec +# Location: stackbin package # Author: bgstack15 # SPDX-License-Identifier: CC-BY-SA-4.0 # Startdate: 2021-01-05 -# Title: Rpm spec for fuss package +# Title: Rpm spec for stackbin package # Purpose: Provide build instructions for CentOS rpm for package # History: # Usage: # Reference: +# fuss.spec # Improve: # Documentation: # Dependencies: # Tunables -# If you set with_icons to 1, then you will pull in a large amount of dependencies! -%global with_icons 0 # If you set this to 1, use the systemd-rpm-macros functionality described at https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/ %global with_systemd_usercreate 0 %global pythonver python36 @@ -22,77 +21,64 @@ # Fedora defaults %if 0%{?fedora} %global with_systemd_usercreate 1 -%global with_icons 1 %global pythonver python3 %endif -%global _appvardir %{?_localstatedir}%{!?_localstatedir:/var}/www/fuss -%global _appdir %{?_datarootdir}%{!?_datarootdir:%{_prefix}/share}/fuss -%global _user fuss +%global _appvardir %{?_localstatedir}%{!?_localstatedir:/var}/www/stackbin +%global _appdir %{?_datarootdir}%{!?_datarootdir:%{_prefix}/share}/stackbin +%global _user stackbin %define devtty "/dev/null" %define debug_package %{nil} %global _python_bytecompile_errors_terminate_build 0 -Summary: file upload and storage service web app -Name: fuss -Version: 0.0.2 +Summary: Pastebin implementation in flask +Name: stackbin +Version: 0.0.1 Release: 1 License: GPL 3.0 Source0: %{name}_%{version}.orig.tar.gz %if 0%{?with_systemd_usercreate} Source1: extra/%{name}.sysusers %endif -%if ! 0%{?fedora} -Patch1: extra/%{name}-el7.patch -%endif -URL: https://bgstack15.wordpress.com/ +#%%if ! 0%%{?fedora} +#Patch1: extra/%%{name}-el7.patch +#%%endif +URL: https://bgstack15.ddns.net/ #Distribution: #Vendor: Packager: B. Stack <bgstack15@gmail.com> Requires: %{pythonver}-flask +Requires: %{pythonver}-sqlalchemy Requires: %{pythonver}-uwsgidecorators Requires: uwsgi-plugin-%{pythonver} +# WORKHERE Requires: uwsgi-logger-file %if 0%{?fedora} -Requires: %{pythonver}-magic -Requires: %{pythonver}-flask-script -%endif -# Mandatory pip3 requirements: flask-script, python-magic -%if 0%{?with_icons} -Requires: /usr/bin/xvfb-run -%if 0%{?fedora} -Requires: %{pythonver}-gobject -%else -# The following are needed for CentOS7 pip3 install --user PyGObject -Requires: cairo-gobject-devel -Requires: gcc -Requires: gobject-introspection-devel -Requires: gtk3-devel -Requires: python36-gobject -Requires: python3-devel -%endif +# Fedora has all the deps; no pip3 helper needed! +Requires: %{pythonver}-pytimeparse +Requires: %{pythonver}-flask-sqlalchemy %endif +# Mandatory pip3 requirements: pytimeparse, flask-sqlalchemy #BuildRequires: txt2man %if 0%{?with_systemd_usercreate} BuildRequires: systemd-rpm-macros %endif %if 0%{?fedora} || 0%{?rhel} >= 8 -Suggests: httpd +Suggests: nginx %endif Buildarch: noarch %description -File Upload and Storage Service is a demo flask application that can -be used for whatever purposes you want. +Stackbin is a flask-based pastebin implementation. %prep %setup -q -c %{name} test -d "%{name}" && cd "%{name}" test -d "%{name}-master" && cd "%{name}-master" -%if ! 0%{?fedora} -%patch1 -p1 -%endif +#%%if ! 0%%{?fedora} +#%%patch1 -p1 +#%%endif %build export srcdir="extra" @@ -104,8 +90,14 @@ export srcdir="extra" test -d "%{name}" && cd "%{name}" %make_install -C "${srcdir}" \ with_systemd=YES \ + with_nginx=YES \ + with_apache=NO \ with_init=NO \ +%if 0%{?fedora} + with_pip_helper=NO +%else with_pip_helper=YES +%endif %if 0%{?with_systemd_usercreate} install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/%{name}.conf %endif @@ -121,12 +113,12 @@ rm -rf %{buildroot} %else if ! getent group %{_user} 1>/dev/null 2>&1 ; then - /usr/sbin/groupadd --system --gid 723 %{_user} + /usr/sbin/groupadd --system --gid 724 %{_user} fi if ! getent passwd %{_user} 1>/dev/null 2>&1 ; then - /usr/sbin/useradd --system --gid 723 \ - --uid 723 --comment "FUSS system user" \ + /usr/sbin/useradd --system --gid 724 \ + --uid 724 --comment "stackbin system user" \ --home-dir %{_appvardir} --shell /sbin/nologin \ %{_user} fi @@ -154,18 +146,16 @@ exit 0 %attr(0644, %{_user}, %{_user}) %{_appdir}/templates/* %attr(0755, %{_user}, %{_user}) %dir %{_appdir}/static %attr(0755, %{_user}, %{_user}) %dir %{_appdir}/templates -%attr(0755, %{_user}, %{_user}) %dir %{_appvardir}/upload %attr(0755, %{_user}, %{_user}) %dir %{_appdir} %attr(0755, %{_user}, %{_user}) %dir %{_appvardir} +%if ! 0%{?fedora} %attr(0755, -, -) %{_libexecdir}/%{name}/pip-helper.sh +%endif %attr(0644, root, root) %{?_unitdir}%{!?_unitdir:/usr/lib/systemd/system}/%{name}.service -%attr(0644, root, root) %{_sysconfdir}/httpd/conf.d/%{name}.conf +%attr(0644, root, root) %{_sysconfdir}/nginx/default.d/%{name}.conf %attr(0755, %{_user}, %{_user}) %dir %{?_localstatedir}%{!?_localstatedir:/var}/log/%{name} %{_defaultdocdir}/%{name} %changelog -* Fri Sep 24 2021 B. Stack <bgstack15@gmail.com> - 0.0.2-1 -- Upstream update - -* Tue Jan 05 2021 B. Stack <bgstack15@gmail.com> - 0.0.1-1 +* Tue Feb 15 2022 B. Stack <bgstack15@gmail.com> - 0.0.1-1 - Initial release diff --git a/extra/stackbin.sysusers b/extra/stackbin.sysusers index d1ef475..e6b7b69 100644 --- a/extra/stackbin.sysusers +++ b/extra/stackbin.sysusers @@ -1,3 +1,3 @@ # Part of stackbin package #Type Name ID GECOS Home directory Shell -u stackbin - "FUSS system user" /var/www/stackbin /sbin/nologin +u stackbin - "stackbin system user" /var/www/stackbin /sbin/nologin |