Skip to content

Commit

Permalink
added uenv program
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhangui committed Dec 26, 2024
1 parent 8403b3d commit 6122fb2
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 38 deletions.
2 changes: 2 additions & 0 deletions indimail-mta-x/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -482,3 +482,5 @@ authcram
authcram.o
authcram.1
qmail-qfilter.1
uenv
uenv.1
1 change: 1 addition & 0 deletions indimail-mta-x/BIN.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ f:::0755:/bin/:maildirqmtp:maildirqmtp
f:::0755:/bin/:maildirsmtp:maildirsmtp
f:::0755:/bin/:maildirserial:maildirserial
f:::0755:/bin/:sslerator:sslerator
f:::0755:/bin/:uenv:uenv
1 change: 1 addition & 0 deletions indimail-mta-x/MAN.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ f:::0644:/man1/:xsender.1:xsender.1
f:::0644:/man1/:qtop.1:qtop.1
f:::0644:/man1/:test-recipients.1:test-recipients.1
f:::0644:/man1/:make-recipients.1:make-recipients.1
f:::0644:/man1/:uenv.1:uenv.1
f:::0644:/man3/:greylist.3:greylist.3
f:::0644:/man3/:plugin_init.3:plugin_init.3
f:::0644:/man3/:tlsacheck.3:tlsacheck.3
Expand Down
44 changes: 26 additions & 18 deletions indimail-mta-x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ it = 822date 822field 822header 822print 822received addrlist analyzer \
setforward setmaillist slowq-send slowq-start smtpd-plugin.so \
sortedtest spawn-filter spfquery splogger srsfilter sslerator \
surblfilter surblqueue svctool swaks sys-checkpwd tcp-env testzero \
tokenize uacl udpclient udplogger update_tmprsadh viruscanner whois \
tokenize uacl udpclient udplogger uenv update_tmprsadh viruscanner whois \
yearcal

man = authcram.1 cdb-database.8 cdbdump.1 cdbget.1 cdbgetm.1 cdbmake.1 \
Expand All @@ -67,7 +67,7 @@ man = authcram.1 cdb-database.8 cdbdump.1 cdbget.1 cdbgetm.1 cdbmake.1 \
qmail-smtpd.8 qmail-spamfilter.8 indimail-srs.5 qmail-start.8 \
todo-proc.8 qmail-users.5 qmta-send.8 qnotify.1 qreceipt.1 qscanq.8 \
queue-fix.8 replier.1 make-recipients.1 test-recipients.1 \
rrforward.1 rrt.1 run-cleanq.8 slowq-send.8 slowq-start.8 \
rrforward.1 rrt.1 run-cleanq.8 slowq-send.8 slowq-start.8 uenv.1 \
spawn-filter.8 surblfilter.8 svctool.8 dnstlsarr.1 indimail-services.7

include Makefile.$(SYSTEM)
Expand Down Expand Up @@ -431,16 +431,16 @@ warn-auto.sh qfrontend.sh conf-libexec conf-sysconfdir
chmod 755 qfrontend

qf-smtp-ratelimit: \
warn-auto.sh qf-smtp-ratelimit.in conf-libexec
cat warn-auto.sh qf-smtp-ratelimit.in \
warn-auto.sh qf-smtp-ratelimit.sh conf-libexec
cat warn-auto.sh qf-smtp-ratelimit.sh \
| sed s}HOME}"`head -1 conf-qmail`"}g \
| sed s}LIBEXEC}"`head -1 conf-libexec`"}g \
> qf-smtp-ratelimit
chmod 755 qf-smtp-ratelimit

qf-log-subject: \
warn-auto.sh qf-log-subject.in conf-prefix
cat warn-auto.sh qf-log-subject.in | \
warn-auto.sh qf-log-subject.sh conf-prefix
cat warn-auto.sh qf-log-subject.sh | \
$(edit) > qf-log-subject
chmod 755 qf-log-subject

Expand Down Expand Up @@ -2198,8 +2198,8 @@ distclean: clean
/bin/rm -f Makefile. Makevars.

instcheck: \
warn-auto.sh instcheck.in conf-libexec conf-sysconfdir
cat warn-auto.sh instcheck.in | $(edit) > $@
warn-auto.sh instcheck.sh conf-libexec conf-sysconfdir
cat warn-auto.sh instcheck.sh | $(edit) > $@
chmod +x $@

installer: \
Expand Down Expand Up @@ -3880,10 +3880,10 @@ indimail-mta.perms: perm_list.in mysql_config \
conf-prefix conf-libexec conf-qmail conf-sysconfdir conf-shared
$(edit) perm_list.in > $@

svctool: svctool.in mysql_config conf-prefix conf-libexec conf-qmail \
svctool: svctool.sh mysql_config conf-prefix conf-libexec conf-qmail \
conf-sysconfdir conf-shared conf-servicedir warn-auto.sh
( cat warn-auto.sh; \
$(edit) $@.in \
$(edit) $@.sh \
| sed s}QUEUESPLIT}"`head -1 conf-split`"}g \
) > $@
chmod +x $@
Expand All @@ -3893,29 +3893,29 @@ conf-prefix conf-libexec conf-qmail conf-sysconfdir conf-shared \
conf-servicedir
$(edit) svctool.9 > $@

create_services: create_services.in \
create_services: create_services.sh \
conf-prefix conf-libexec conf-qmail \
conf-sysconfdir conf-shared conf-servicedir
$(edit) $@.in > $@; chmod 755 $@
$(edit) $@.sh > $@; chmod 755 $@

favicon.base64: favicon.png
base64 < favicon.png > favicon.base64

qlocal_upgrade: \
warn-auto.sh qlocal_upgrade.in conf-prefix conf-libexec \
warn-auto.sh qlocal_upgrade.sh conf-prefix conf-libexec \
conf-sysconfdir conf-servicedir
cat warn-auto.sh qlocal_upgrade.in \
cat warn-auto.sh qlocal_upgrade.sh \
| $(edit) > $@

qupgrade: \
warn-auto.sh qupgrade.in conf-prefix conf-libexec \
warn-auto.sh qupgrade.sh conf-prefix conf-libexec \
conf-sysconfdir conf-servicedir
cat warn-auto.sh qupgrade.in \
cat warn-auto.sh qupgrade.sh \
| $(edit) > $@

qtop: \
warn-auto.sh qtop.in
cat warn-auto.sh $@.in | $(edit) > $@
warn-auto.sh qtop.sh
cat warn-auto.sh $@.sh | $(edit) > $@
chmod 755 $@

qtop.1: qtop.9 conf-logdir
Expand Down Expand Up @@ -3959,6 +3959,14 @@ printass.1: \
printass.9 conf-sysconfdir
$(edit) printass.9 >$@

uenv: uenv.sh conf-prefix warn-auto.sh
( cat warn-auto.sh; \
$(edit) $@.sh \
) > $@
chmod +x $@
uenv.1: uenv.9 conf-prefix conf-sysconfdir
$(edit) uenv.9 > $@

#################################################################
indimail-mta-permissions.easy: indimail-mta-permissions.easy.in \
conf-prefix conf-libexec conf-qmail conf-sysconfdir conf-shared
Expand Down
2 changes: 2 additions & 0 deletions indimail-mta-x/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,5 @@ rd-remote.o
read_assign.o
recipient-cdb.o
valid_hname.o
uenv
uenv.1
2 changes: 1 addition & 1 deletion indimail-mta-x/conf-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.9
3.1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cp=$(which cp)
# End USER Configuration OPTIONS
#

# $Id: create_services.in,v 2.131 2024-02-22 01:04:24+05:30 Cprogrammer Exp mbhangui $
# $Id: create_services.sh,v 2.131 2024-02-22 01:04:24+05:30 Cprogrammer Exp mbhangui $

usage()
{
Expand Down Expand Up @@ -782,7 +782,7 @@ if [ $check_install -eq 1 ] ; then
fi

#
# $Log: create_services.in,v $
# $Log: create_services.sh,v $
# Revision 2.131 2024-02-22 01:04:24+05:30 Cprogrammer
# replace cat with qcat
#
Expand Down
7 changes: 6 additions & 1 deletion indimail-mta-x/doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
* XXX XXX XX XXXX XX:XX:XX +0000 @email@ @version@-@release@%{?dist}
Release @version@-@release@ Start 08/08/2024 End XX/XX/XXXX
Release 3.1-1.1 Start 26/12/2024 End XX/XX/XXXX
- 26/12/2024
1. Renamed scripts with .in extension to .sh

* Tue Dec 24 2024 20:28:14 +0000 Manvendra Bhangui <indimail-mta@indimail.org 3.0.9-1.1%{?dist}
Release 3.0.9-1.1 Start 08/08/2024 End 24/12/2024
- 08/08/2024
1. svctool: fixed mariadb db creation for mariadb 11.x on archlinux
- 01/09/2024
Expand Down
3 changes: 2 additions & 1 deletion indimail-mta-x/indimail-mta.spec.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
#
# $Id: indimail-mta.spec.in,v 1.406 2024-07-20 09:26:30+05:30 Cprogrammer Exp mbhangui $
# $Id: indimail-mta.spec.in,v 1.407 2024-12-27 00:51:30+05:30 Cprogrammer Exp mbhangui $
%undefine _missing_build_ids_terminate_build
%global _unpackaged_files_terminate_build 1

Expand Down Expand Up @@ -625,6 +625,7 @@ echo ../resolv.conf 1>&3
%attr(755,root,root) %{_prefix}/bin/srsfilter
%attr(0755,root,root) %{_prefix}/bin/udpclient
%attr(0755,root,root) %{_prefix}/bin/sslerator
%attr(0755,root,root) %{_prefix}/bin/uenv
%if %notlsarr == 0
%attr(755,root,root) %{_prefix}/bin/qdane
%endif
Expand Down
4 changes: 2 additions & 2 deletions indimail-mta-x/instcheck.in → indimail-mta-x/instcheck.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Log: instcheck.in,v $
# $Log: instcheck.sh,v $
# Revision 1.3 2022-09-18 23:01:10+05:30 Cprogrammer
# use uinstaller only for ucspi-tcp
#
Expand All @@ -10,7 +10,7 @@
# Initial revision
#
#
# $Id: instcheck.in,v 1.3 2022-09-18 23:01:10+05:30 Cprogrammer Exp mbhangui $
# $Id: instcheck.sh,v 1.3 2022-09-18 23:01:10+05:30 Cprogrammer Exp mbhangui $
#
if [ $# -eq 0 ] ; then
name=$(basename $0)
Expand Down
1 change: 1 addition & 0 deletions indimail-mta-x/perm_list.in
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
%attr(0755,root,root) @prefix@/bin/udpclient
%attr(0755,root,root) @prefix@/bin/qdane
%attr(0755,root,root) @prefix@/bin/sslerator
%attr(0755,root,root) @prefix@/bin/uenv
#
# sbin
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Log: qf-log-subject.in,v $
# $Log: qf-log-subject.sh,v $
# Revision 1.3 2024-02-22 01:04:53+05:30 Cprogrammer
# replace cat with qcat
#
Expand All @@ -10,7 +10,7 @@
# Initial revision
#
#
# $Id: qf-log-subject.in,v 1.3 2024-02-22 01:04:53+05:30 Cprogrammer Exp mbhangui $
# $Id: qf-log-subject.sh,v 1.3 2024-02-22 01:04:53+05:30 Cprogrammer Exp mbhangui $
#

[ -n "$ENVSIZE" -a -n "$MSGSIZE" ] && qmail_qfilter=1 || qmail_qfilter=0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Log: qf-smtp-ratelimit.in,v $
# $Log: qf-smtp-ratelimit.sh,v $
# Revision 1.5 2024-02-22 01:04:57+05:30 Cprogrammer
# replace cat with qcat
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Id: qlocal_upgrade.in,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $
# $Id: qlocal_upgrade.sh,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $
#
PATH=/bin:/usr/bin:/usr/sbin:/sbin
chown=$(which chown)
Expand All @@ -26,15 +26,15 @@ check_update_if_diff()

do_install()
{
echo "Running $1 $Id: qlocal_upgrade.in,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $"
echo "Running $1 $Id: qlocal_upgrade.sh,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $"
# upgrade libindimail (VIRTUAL_PKG_LIB) for dynamic loading of libindimail
# upgrade libmysqlclient path in /etc/indimail/control/libmysql
/usr/sbin/svctool --fixsharedlibs
}

do_post_upgrade()
{
echo "Running $1 $Id: qlocal_upgrade.in,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $"
echo "Running $1 $Id: qlocal_upgrade.sh,v 1.64 2024-02-22 09:10:41+05:30 Cprogrammer Exp mbhangui $"
if [ -x /bin/systemctl -o -x /usr/bin/systemctl ] ; then
systemctl is-enabled svscan >/dev/null 2>&1
if [ $? -ne 0 ] ; then
Expand Down Expand Up @@ -437,7 +437,7 @@ case $1 in
;;
esac
#
# $Log: qlocal_upgrade.in,v $
# $Log: qlocal_upgrade.sh,v $
# Revision 1.64 2024-02-22 09:10:41+05:30 Cprogrammer
# replace qmail-cat with qcat for qmail-logfifo service and filterargs control file
#
Expand Down
4 changes: 3 additions & 1 deletion indimail-mta-x/qmail-inject.9
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ Print the message rather than feeding it to

.PP
\fBqmail-inject\fR uses environment set according to files in
$HOME/.defaultqueue directory. If QUEUE_BASE environment variable is not
$HOME/.defaultqueue directory. You can skip setting environment variables
from $HOME/.defaultqueue by setting \fBSKIP_LOCAL_ENVIRONMENT\fR
environment variable. If \fBQUEUE_BASE\fR environment variable is not
set, it additionally uses environment set according to files in
@controldir@/defaultqueue directory. If the environment variable
\fBFASTQUEUE\fR is set, $HOME/.defaultqueue is not processed.
Expand Down
2 changes: 1 addition & 1 deletion indimail-mta-x/qtop.in → indimail-mta-x/qtop.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Log: qtop.in,v $
# $Log: qtop.sh,v $
# Revision 1.1 2022-04-16 13:02:52+05:30 Cprogrammer
# Initial revision
#
Expand Down
4 changes: 2 additions & 2 deletions indimail-mta-x/qupgrade.in → indimail-mta-x/qupgrade.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Id: qupgrade.in,v 1.13 2024-02-22 01:05:05+05:30 Cprogrammer Exp mbhangui $
# $Id: qupgrade.sh,v 1.13 2024-02-22 01:05:05+05:30 Cprogrammer Exp mbhangui $
#

do_upgrade()
Expand Down Expand Up @@ -204,7 +204,7 @@ case $1 in
;;
esac
#
# $Log: qupgrade.in,v $
# $Log: qupgrade.sh,v $
# Revision 1.13 2024-02-22 01:05:05+05:30 Cprogrammer
# replace cat with qcat
#
Expand Down
4 changes: 2 additions & 2 deletions indimail-mta-x/svctool.in → indimail-mta-x/svctool.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Id: svctool.in,v 2.732 2024-11-05 22:31:45+05:30 Cprogrammer Exp mbhangui $
# $Id: svctool.sh,v 2.732 2024-11-05 22:31:45+05:30 Cprogrammer Exp mbhangui $
#

#
Expand Down Expand Up @@ -27,7 +27,7 @@ host=@HOST@
shared_objects=0
use_dlmopen=0
skip_sendmail_check=0
RCSID="# \$Id: svctool.in,v 2.732 2024-11-05 22:31:45+05:30 Cprogrammer Exp mbhangui $"
RCSID="# \$Id: svctool.sh,v 2.732 2024-11-05 22:31:45+05:30 Cprogrammer Exp mbhangui $"

#
# End of User Configuration
Expand Down
42 changes: 42 additions & 0 deletions indimail-mta-x/uenv.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.\" vim: tw=75
.TH uenv 1
.SH NAME
uenv \- run a program with environment modified according to files in $HOME/.defaultqueue

.SH SYNOPSIS
\fBuenv\fR [\fB\-c\fR] \fIchild\fR

.SH DESCRIPTION
\fBuenv\fR sets various environment variables as specified by files in the
directory \fI$HOME/.defaultqueue\fR and then runs child with the modified
environment variables. Specifying -c option clears all existing environment
variables except $HOME. It works exactly like \fBenvdir\fR(8), except that
it uses the fixed directory \fI$HOME/.defaultqueue for setting new
environment variables.

\fIchild\fR consists of one or more arguments.

You can skip $HOME/.defaultqueue by setting \fBSKIP_LOCAL_ENVIRONMENT\fR
environment variable. It then sets environment variable specified by files
in \fI@controldir@/defaultqueue\fR. if \fBQUEUE_BASE\fR environment
variable is set, setting of environment variables from
\fI@controldir@/defaultqueue\fR is skipped.

.SH EXAMPLES

Run uenv as root to display local environment variables set for the user
\fIuser\fR with home directory \fI/home/user\fR.

.EX
# setuidgid \fIuser\fR env HOME=/home/user uenv -c env
.EE

Run uenv to display local environment variables for current user.

.EX
$ uenv env
.EE


.SH SEE ALSO
envdir(8)
Loading

0 comments on commit 6122fb2

Please sign in to comment.