Annotation of /trunk/vzctl/magellan-set_ugid_quota.sh
Parent Directory | Revision Log
Revision 272 -
(hide annotations)
(download)
(as text)
Sat Jul 21 22:43:26 2007 UTC (17 years, 2 months ago) by niro
File MIME type: application/x-sh
File size: 1924 byte(s)
Sat Jul 21 22:43:26 2007 UTC (17 years, 2 months ago) by niro
File MIME type: application/x-sh
File size: 1924 byte(s)
-magellan specific vzctl files
1 | niro | 272 | #!/bin/bash |
2 | # Copyright (C) 2000-2007 SWsoft. All rights reserved. | ||
3 | # | ||
4 | # This program is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 2 of the License, or | ||
7 | # (at your option) any later version. | ||
8 | # | ||
9 | # This program is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with this program; if not, write to the Free Software | ||
16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | # | ||
18 | # | ||
19 | # This script configures quota startup script inside VE for Magellan like distros | ||
20 | # | ||
21 | # Parameters are passed in environment variables. | ||
22 | # Required parameters: | ||
23 | # MINOR - root device minor number | ||
24 | # MAJOR - root device major number | ||
25 | SCRIPTANAME='/etc/rc.d/init.d/vzquota' | ||
26 | RCDIRS="/etc/rc.d" | ||
27 | |||
28 | if [ -z "$MAJOR" ]; then | ||
29 | rm -f ${SCRIPTANAME} > /dev/null 2>&1 | ||
30 | rm -f /etc/mtab > /dev/null 2>&1 | ||
31 | ln -sf /proc/mounts /etc/mtab | ||
32 | exit 0 | ||
33 | fi | ||
34 | echo -e '#!/bin/sh | ||
35 | start() { | ||
36 | [ -e "/dev/'${DEVFS}'" ] || mknod /dev/'${DEVFS}' b '$MAJOR' '$MINOR' | ||
37 | rm -f /etc/mtab >/dev/null 2>&1 | ||
38 | echo "/dev/'${DEVFS}' / reiserfs rw,usrquota,grpquota 0 0" > /etc/mtab | ||
39 | mnt=`grep -v " / " /proc/mounts` | ||
40 | if [ $? == 0 ]; then | ||
41 | echo "$mnt" >> /etc/mtab | ||
42 | fi | ||
43 | quotaon -aug | ||
44 | } | ||
45 | case "$1" in | ||
46 | start) | ||
47 | start | ||
48 | ;; | ||
49 | *) | ||
50 | exit | ||
51 | esac ' > ${SCRIPTANAME} || { | ||
52 | echo "Unable to create ${SCRIPTNAME}" | ||
53 | exit 1 | ||
54 | } | ||
55 | chmod 755 ${SCRIPTANAME} | ||
56 | |||
57 | RC= | ||
58 | for RC in ${RCDIRS}; do | ||
59 | [ -d ${RC}/rc3.d ] && break | ||
60 | done | ||
61 | |||
62 | if [ -z "${RC}" ]; then | ||
63 | echo "Unable to find runlevel directories" | ||
64 | exit 1 | ||
65 | fi | ||
66 | |||
67 | for dir in `ls -d ${RC}/rc[0-6].d`; do | ||
68 | ln -sf ${SCRIPTANAME} ${dir}/S10vzquota | ||
69 | done | ||
70 | |||
71 | exit 0 | ||
72 |