quota: New package.

Required by nfs-utils.
This commit is contained in:
Michael Tremer 2013-01-26 19:32:30 +00:00
parent e448e01465
commit 96ab401170
7 changed files with 372 additions and 0 deletions

View File

@ -0,0 +1,38 @@
--- quota-tools/quotaon.8.orig Wed Aug 7 15:14:52 2002
+++ quota-tools/quotaon.8 Wed Aug 7 15:15:40 2002
@@ -3,7 +3,7 @@
.SH NAME
quotaon, quotaoff \- turn filesystem quotas on and off
.SH SYNOPSIS
-.B /usr/sbin/quotaon
+.B /sbin/quotaon
[
.B \-vugfp
] [
@@ -12,7 +12,7 @@
]
.IR filesystem .\|.\|.
.br
-.B /usr/sbin/quotaon
+.B /sbin/quotaon
[
.B \-avugfp
] [
@@ -20,7 +20,7 @@
.I format-name
]
.LP
-.B /usr/sbin/quotaoff
+.B /sbin/quotaoff
[
.B \-vugp
]
@@ -30,7 +30,7 @@
]
.IR filesystem .\|.\|.
.br
-.B /usr/sbin/quotaoff
+.B /sbin/quotaoff
[
.B \-avugp
]

View File

@ -0,0 +1,11 @@
--- quota-tools/rquota_svc.c.orig 2005-06-01 03:21:30.000000000 -0400
+++ quota-tools/rquota_svc.c 2006-11-01 15:11:29.161101000 -0500
@@ -140,7 +140,7 @@ static void parse_options(int argc, char
break;
case 'p':
port = strtol(optarg, &endptr, 0);
- if (*endptr || port <= 0) {
+ if (*endptr || port <= 0 || port > 0xffff) {
errstr(_("Illegal port number: %s\n"), optarg);
show_help();
exit(1);

View File

@ -0,0 +1,29 @@
From cc9476d5bf016375dc02453be424ac1ea9b01247 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 25 Sep 2012 15:27:44 +0200
Subject: [PATCH] Make group warning message more official
Port to 4.01-1.
---
warnquota.conf | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/warnquota.conf b/warnquota.conf
index 77f6a75..6d26bed 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -27,8 +27,9 @@ MESSAGE = Your disk usage has exceeded the agreed limits\
# is created)
SIGNATURE = root@example.com
# Following text is used for mails about group exceeding quotas
-GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
-I chose you to do the cleanup.|Delete group files on the following filesystems:|
+GROUP_MESSAGE = Hello,|\
+your group %i is using too much disk space at %h.|\
+I suggest you to clean up group files on the following filesystems:|
# Text in the end of the mail to the group (if not specified, default text using SUPPORT
# and PHONE is created).
GROUP_SIGNATURE = See you!| Your admin|
--
1.7.11.4

View File

@ -0,0 +1,79 @@
From aebb8189069f24e6f4e59cf79f179bcbafe7a098 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 6 Nov 2012 11:04:44 +0100
Subject: [PATCH 1/2] warnquota: Add MIME-Version header
Warnquota forgot to add MIME-Version header to sent email when Content-type
etc. fields were set.
Signed-off-by: Jan Kara <jack@suse.cz>
---
warnquota.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/warnquota.c b/warnquota.c
index 08827f2..80f528c 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -503,6 +503,7 @@ static int mail_user(struct offenderlist *offender, struct configparams *config)
if (should_cc(offender, config))
fprintf(fp, "Cc: %s\n", config->cc_to);
if ((config->charset)[0] != '\0') { /* are we supposed to set the encoding */
+ fprintf(fp, "MIME-Version: 1.0\n");
fprintf(fp, "Content-Type: text/plain; charset=%s\n", config->charset);
fprintf(fp, "Content-Disposition: inline\n");
fprintf(fp, "Content-Transfer-Encoding: 8bit\n");
--
1.7.11.7
From d8bb9ec3cef26cd3fb62534d896bf9c8feea67f9 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 6 Nov 2012 12:12:19 +0100
Subject: [PATCH 2/2] warnquota: Use current locale as default charset
If charset in warnquota.conf is not specified, use charset from current
locale as the charset of the warning email. This is to accomodate possible
translations of messages via gettext.
Signed-off-by: Jan Kara <jack@suse.cz>
---
warnquota.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/warnquota.c b/warnquota.c
index 80f528c..5c5a1b9 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -29,6 +29,8 @@
#include <grp.h>
#include <time.h>
#include <getopt.h>
+#include <locale.h>
+#include <langinfo.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/utsname.h>
@@ -707,6 +709,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
char *value;
char *pos;
int line, len, bufpos;
+ char *locale;
/* set default values */
sstrncpy(config->mail_cmd, MAIL_CMD, CNF_BUFFER);
@@ -716,6 +719,12 @@ static int readconfigfile(const char *filename, struct configparams *config)
sstrncpy(config->support, SUPPORT, CNF_BUFFER);
sstrncpy(config->phone, PHONE, CNF_BUFFER);
(config->charset)[0] = '\0';
+ setlocale(LC_ALL, NULL);
+ locale = setlocale(LC_MESSAGES, NULL);
+ if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) {
+ locale = nl_langinfo(CODESET);
+ sstrncpy(config->charset, locale, CNF_BUFFER);
+ }
maildev[0] = 0;
config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
config->use_ldap_mail = 0;
--
1.7.11.7

View File

@ -0,0 +1,71 @@
From d2f7a6be1526a6f46cbf37aa27587a51e4d5990f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 13:45:15 +0200
Subject: [PATCH] warnquota configuration tunes
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream (we had root@... addresses and more enterprise
wordings usually there).
---
warnquota.c | 2 +-
warnquota.conf | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 08827f2..c7ca6f2 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -806,7 +806,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
verify_format(config->group_signature, "GROUP_SIGNATURE");
}
else if (!strcmp(var, "LDAP_MAIL")) {
- if(strcasecmp(value, "true") == 0)
+ if(strncasecmp(value, "true", 4) == 0)
config->use_ldap_mail = 1;
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index 2a72b78..77f6a75 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,17 +4,16 @@
# and even blank lines
# values can be quoted:
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-MAIL_CMD = "/bin/echo"
-FROM = "bas@example.com"
+MAIL_CMD = "/usr/sbin/sendmail -t"
+FROM = "root@example.com"
# but they don't have to be:
-SUBJECT = Hey, user, clean up your account!
-CC_TO = "sysadm@example.com"
+SUBJECT = NOTE: You are exceeding your allocated disk space limits
+CC_TO = "root@example.com"
# If you set this variable CC will be used only when user has less than
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
# 12 hours, 5 days)
# CC_BEFORE = 2 days
-SUPPORT = "support@example.com"
+SUPPORT = "root@example.com"
PHONE = "(123) 456-1111 or (222) 333-4444"
# Text in the beginning of the mail (if not specified, default text is used)
# This way text can be split to more lines
@@ -22,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4444"
# The expressions %i, %h, %d, and %% are substituted for user/group name,
# host name, domain name, and '%' respectively. For backward compatibility
# %s behaves as %i but is deprecated.
-MESSAGE = Hello user %i, I've noticed you use too much space\
- on my disk in %h.%d.|Delete your files on the following filesystems:|
+MESSAGE = Your disk usage has exceeded the agreed limits\
+ on this server|Please delete any unnecessary files on following filesystems:|
# Text in the end of the mail (if not specified, default text using SUPPORT and PHONE
# is created)
-SIGNATURE = See you!| Your admin of %h|
+SIGNATURE = root@example.com
# Following text is used for mails about group exceeding quotas
GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
I chose you to do the cleanup.|Delete group files on the following filesystems:|
--
1.7.11.4

133
quota/quota.nm Normal file
View File

@ -0,0 +1,133 @@
###############################################################################
# IPFire.org - An Open Source Firewall Solution #
# Copyright (C) - IPFire Development Team <info@ipfire.org> #
###############################################################################
name = quota
version = 4.01
release = 1
groups = System/Base
url = http://sourceforge.net/projects/linuxquota/
license = BSD and GPLv2+
summary = System administration tools for monitoring users' disk usage
description
The quota package contains system administration tools for monitoring
and limiting user and or group disk usage per file system.
end
source_dl = http://downloads.sourceforge.net/linuxquota/
build
requires
dbus-devel
e2fsprogs-devel
gettext
glibc-headers >= 2.17-2
libnl-devel
openldap-devel
systemd-units
end
DIR_APP = %{DIR_SRC}/quota-tools
configure_options += \
--enable-ext2direct \
--enable-ldapmail \
--enable-netlink \
--enable-rpcsetquota \
--disable-strip-binaries
make_install_targets += ROOTDIR=%{BUILDROOT}
install_cmds
mkdir -pv %{BUILDROOT}%{sysconfdir}
install -m 644 warnquota.conf %{BUILDROOT}%{sysconfdir}
# Remove XFS stuff.
rm -vf %{BUILDROOT}{%{mandir},%{sbindir}}/{quot,xqmstats}*
end
end
packages
package %{name}
package %{name}-nld
summary = The quota_nld daemon.
description
Daemon that listens on netlink socket and processes received quota warnings.
The daemon supports forwarding warning messages to the system D-Bus
(so that desktop manager can display a dialog) and writing them to the
terminal user has last accessed.
end
requires
quota = %{thisver}
end
files
%{unitdir}/quota_nld.service
%{sbindir}/quota_nld
%{mandir}/man8/quota_nld.8*
end
script postin
systemctl daemon-reload >/dev/null 2>&1 || :
end
script postup
systemctl daemon-reload >/dev/null 2>&1 || :
systemctl try-restart quota_nld.service >/dev/null 2>&1 || :
end
script preun
systemctl --no-reload disable quota_nld.service >/dev/null 2>&1 || :
systemctl stop quota_nld.service >/dev/null 2>&1 || :
end
script postun
systemctl daemon-reload >/dev/null 2>&1 || :
end
end
package %{name}-warnquota
summary = Send e-mail to users over quota.
description
Utility that checks disk quota for each local file system and mails a warning
message to those users who have reached their soft limit. It is typically run
via cron(8).
end
requires
quota = %{thisver}
end
configfiles
%{sysconfdir}/quotagrpadmins
%{sysconfdir}/quotatab
%{sysconfdir}/warnquota.conf
end
files
%{configfiles}
%{sbindir}/warnquota
%{mandir}/man8/warnquota.8*
end
end
package %{name}-devel
template DEVEL
# Some header files have previously been
# shipped with glibc-headers.
conflicts
glibc-headers < 2.17-2
end
end
package %{name}-debuginfo
template DEBUGINFO
end
end

View File

@ -0,0 +1,11 @@
[Unit]
Description=Disk quota netlink message daemon
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/sbin/quota_nld
PIDFile=/var/run/quota_nld.pid
[Install]
WantedBy=multi-user.target