View | Details | Raw Unified | Return to bug 28628
Collapse All | Expand All

(-)a/bin/vzifup-post.in (-1 / +1 lines)
Lines 1-4 Link Here
1
#!/bin/bash
1
#!/bin/sh
2
# Copyright (C) 2008-2011, Parallels, Inc. All rights reserved.
2
# Copyright (C) 2008-2011, Parallels, Inc. All rights reserved.
3
#
3
#
4
# Update ARP table for all containers on interface up
4
# Update ARP table for all containers on interface up
(-)a/bin/vzmigrate.in (-2 / +2 lines)
Lines 412-418 ploop_copy() { Link Here
412
412
413
		# check if ssh is still there
413
		# check if ssh is still there
414
		kill -0 $pid 2>/dev/null && break
414
		kill -0 $pid 2>/dev/null && break
415
		let try=try+1
415
		try="$((try+1))"
416
	done
416
	done
417
417
418
	if [ $try = 5 ]; then
418
	if [ $try = 5 ]; then
Lines 839-845 logexec 2 $SSH root@$host $VZCTL set $VEID --private $VE_PRIVATE_REMOTE --root $ Link Here
839
logexec 2 $SSH root@$host $VZCTL set $VEID --applyconfig_map name --save
839
logexec 2 $SSH root@$host $VZCTL set $VEID --applyconfig_map name --save
840
RET=$?
840
RET=$?
841
# vzctl return code 20 or 21 in case of unrecognized option
841
# vzctl return code 20 or 21 in case of unrecognized option
842
if [ $RET != 20 ] && [ $RET != 21 ] && [ $RET != 0 ]; then
842
if [ $RET != 20 -a $RET != 21 -a $RET != 0 ]; then
843
	log 0 "Failed to apply config on destination node"
843
	log 0 "Failed to apply config on destination node"
844
	undo_conf
844
	undo_conf
845
	exit $MIG_ERR_APPLY_CONFIG
845
	exit $MIG_ERR_APPLY_CONFIG
(-)a/configure.ac (-1 / +3 lines)
Lines 62-67 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) Link Here
62
# Disable build of static libraries by default.
62
# Disable build of static libraries by default.
63
AC_DISABLE_STATIC
63
AC_DISABLE_STATIC
64
64
65
# Arrange for 64-bit file offsets.
66
AC_SYS_LARGEFILE
67
65
# If AC_USE_SYSTEM_EXTENSIONS is available (autoconf >= 2.60),
68
# If AC_USE_SYSTEM_EXTENSIONS is available (autoconf >= 2.60),
66
# use it. Otherwise, use old AC_GNU_SOURCE
69
# use it. Otherwise, use old AC_GNU_SOURCE
67
m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
70
m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
Lines 78-84 AC_PROG_MAKE_SET Link Here
78
CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-qual -Winline -Wextra"
81
CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-qual -Winline -Wextra"
79
CFLAGS="${CFLAGS} -Wcast-align -Wno-unused-parameter"
82
CFLAGS="${CFLAGS} -Wcast-align -Wno-unused-parameter"
80
CFLAGS="${CFLAGS} -Wno-missing-field-initializers"
83
CFLAGS="${CFLAGS} -Wno-missing-field-initializers"
81
CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
82
84
83
# We need -m64 for ppc64 in order to get proper ioctls
85
# We need -m64 for ppc64 in order to get proper ioctls
84
if test x$target_cpu = xppc64 -o x$target_cpu = xpowerpc64; then
86
if test x$target_cpu = xppc64 -o x$target_cpu = xpowerpc64; then
(-)a/etc/dists/scripts/arch-add_ip.sh (-2 / +2 lines)
Lines 84-90 old_get_free_aliasid() Link Here
84
84
85
	[ -z "${IFNUMLIST}" ] && old_get_all_aliasid
85
	[ -z "${IFNUMLIST}" ] && old_get_all_aliasid
86
	while test -z ${found}; do
86
	while test -z ${found}; do
87
		let IFNUM=IFNUM+1
87
		IFNUM="$((IFNUM+1))"
88
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
88
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
89
			found=1
89
			found=1
90
	done
90
	done
Lines 219-225 get_free_aliasid() Link Here
219
219
220
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
220
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
221
	while test -z ${found}; do
221
	while test -z ${found}; do
222
		let IFNUM=IFNUM+1
222
		IFNUM="$((IFNUM+1))"
223
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
223
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
224
			found=1
224
			found=1
225
	done
225
	done
(-)a/etc/dists/scripts/arch-del_ip.sh (-2 / +2 lines)
Lines 57-63 old_del_ip() Link Here
57
			 grep "^${VENET_DEV}_" | cut -d'=' -f1)
57
			 grep "^${VENET_DEV}_" | cut -d'=' -f1)
58
		if [ -n "${ifname}" ]; then
58
		if [ -n "${ifname}" ]; then
59
		    # shutdown interface venet0:x
59
		    # shutdown interface venet0:x
60
		    /etc/rc.d/network ifdown ${ifname/_/:} 2> /dev/null
60
		    /etc/rc.d/network ifdown "$(echo "$ifname" | sed -e 's,_,:,')" 2> /dev/null
61
61
62
		    # remove venet0_x from cfg
62
		    # remove venet0_x from cfg
63
		    del_param "${OLDCFGFILE}" "${ifname}"
63
		    del_param "${OLDCFGFILE}" "${ifname}"
Lines 113-119 del_ip() Link Here
113
	netcfg "${VENET_DEV}"
113
	netcfg "${VENET_DEV}"
114
}
114
}
115
115
116
function netctl_del_ip()
116
netctl_del_ip()
117
{
117
{
118
	local ipm
118
	local ipm
119
119
(-)a/etc/dists/scripts/debian-add_ip.sh (-1 lines)
Lines 131-137 iface ${VENET_DEV}:${ifnum} inet static Link Here
131
	    sed -i -e "s/iface ${VENET_DEV} inet6 manual/iface ${VENET_DEV} inet6 manual\n\tup ifconfig ${VENET_DEV} add ${ip}\/${mask}\n\tdown ifconfig ${VENET_DEV} del ${ip}\/${mask}/" ${CFGFILE}.bak
131
	    sed -i -e "s/iface ${VENET_DEV} inet6 manual/iface ${VENET_DEV} inet6 manual\n\tup ifconfig ${VENET_DEV} add ${ip}\/${mask}\n\tdown ifconfig ${VENET_DEV} del ${ip}\/${mask}/" ${CFGFILE}.bak
132
	    need_restart=yes
132
	    need_restart=yes
133
	fi
133
	fi
134
135
}
134
}
136
135
137
get_all_aliasid()
136
get_all_aliasid()
(-)a/etc/dists/scripts/functions (-4 / +3 lines)
Lines 14-20 Link Here
14
#
14
#
15
#  You should have received a copy of the GNU General Public License
15
#  You should have received a copy of the GNU General Public License
16
#  along with this program; if not, write to the Free Software
16
#  along with this program; if not, write to the Free Software
17
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18
#
18
#
19
#
19
#
20
20
Lines 256-264 change_hostname() Link Here
256
	local comm='# Auto-generated hostname. Please do not remove this comment.'
256
	local comm='# Auto-generated hostname. Please do not remove this comment.'
257
257
258
	[ -f "$cfg" ] || touch "$cfg"
258
	[ -f "$cfg" ] || touch "$cfg"
259
	if [ "$host" = "localhost" -o "$host" = "localhost.localdomain" ];
259
	if [ "$host" = 'localhost' -o "$host" = 'localhost.localdomain' ]; then
260
	then
260
		put_param2 "$cfg" '127.0.0.1' 'localhost.localdomain localhost'
261
		put_param2 "$cfg" "127.0.0.1" "localhost.localdomain localhost"
262
		return 0
261
		return 0
263
	fi
262
	fi
264
	${CP} "$cfg" "$cfg.$$" ||
263
	${CP} "$cfg" "$cfg.$$" ||
(-)a/etc/dists/scripts/funtoo-add_ip.sh (-2 / +2 lines)
Lines 45-57 set_rc() Link Here
45
{
45
{
46
	[ -f "${SCRIPT}" ] && return 0
46
	[ -f "${SCRIPT}" ] && return 0
47
	ln -sf netif.tmpl /etc/init.d/netif.${VENET_DEV}
47
	ln -sf netif.tmpl /etc/init.d/netif.${VENET_DEV}
48
	rc-update add netif.${VENET_DEV} default &>/dev/null
48
	rc-update add netif.${VENET_DEV} default >/dev/null 2>&1
49
}
49
}
50
50
51
unset_rc()
51
unset_rc()
52
{
52
{
53
	# used for disabling venet if we are using veth and no IPs are specified
53
	# used for disabling venet if we are using veth and no IPs are specified
54
	rc-update del netif.${VENET_DEV} default &>/dev/null
54
	rc-update del netif.${VENET_DEV} default >/dev/null 2>&1
55
	rm -f /etc/init.d/netif.${VENET_DEV}
55
	rm -f /etc/init.d/netif.${VENET_DEV}
56
	rm -f /etc/conf.d/netif.${VENET_DEV}
56
	rm -f /etc/conf.d/netif.${VENET_DEV}
57
	ip link set ${VENET_DEV} down > /dev/null 2>&1
57
	ip link set ${VENET_DEV} down > /dev/null 2>&1
(-)a/etc/dists/scripts/funtoo-del_ip.sh (-1 / +1 lines)
Lines 25-31 CFGFILE=/etc/conf.d/netif.${VENET_DEV} Link Here
25
unset_rc()
25
unset_rc()
26
{
26
{
27
	# used for disabling venet if we are using veth and no IPs are specified
27
	# used for disabling venet if we are using veth and no IPs are specified
28
	rc-update del netif.${VENET_DEV} default &>/dev/null
28
	rc-update del netif.${VENET_DEV} default >/dev/null 2>&1
29
	rm -f /etc/init.d/netif.${VENET_DEV}
29
	rm -f /etc/init.d/netif.${VENET_DEV}
30
	rm -f /etc/conf.d/netif.${VENET_DEV}
30
	rm -f /etc/conf.d/netif.${VENET_DEV}
31
	ip link set ${VENET_DEV} down > /dev/null 2>&1
31
	ip link set ${VENET_DEV} down > /dev/null 2>&1
(-)a/etc/dists/scripts/funtoo-set_hostname.sh (-2 / +2 lines)
Lines 1-4 Link Here
1
#!/bin/bash
1
#!/bin/sh
2
#  Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
2
#  Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
3
#
3
#
4
#  This program is free software; you can redistribute it and/or modify
4
#  This program is free software; you can redistribute it and/or modify
Lines 18-24 Link Here
18
#
18
#
19
# This script sets hostname inside Funtoo based CT.
19
# This script sets hostname inside Funtoo based CT.
20
20
21
function set_hostname()
21
set_hostname()
22
{
22
{
23
	local cfgfile=$1
23
	local cfgfile=$1
24
	local hostname=$2
24
	local hostname=$2
(-)a/etc/dists/scripts/gentoo-add_ip.sh (-3 / +3 lines)
Lines 62-71 set_config() Link Here
62
set_rc()
62
set_rc()
63
{
63
{
64
	[ -f "${SCRIPT}" ] && return 0
64
	[ -f "${SCRIPT}" ] && return 0
65
	rc-update del net.eth0 &>/dev/null
65
	rc-update del net.eth0 >/dev/null 2>&1
66
	rc-update add net.lo boot &>/dev/null
66
	rc-update add net.lo boot >/dev/null 2>&1
67
	ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
67
	ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
68
	rc-update add net.${VENET_DEV} default &>/dev/null
68
	rc-update add net.${VENET_DEV} default >/dev/null 2>&1
69
}
69
}
70
70
71
init_netconfig()
71
init_netconfig()
(-)a/etc/dists/scripts/gentoo-del_ip.sh (-1 / +1 lines)
Lines 35-41 del_ip() Link Here
35
35
36
	if [ "x${IPDELALL}" = "xyes" ]; then
36
	if [ "x${IPDELALL}" = "xyes" ]; then
37
		/etc/init.d/net.${VENET_DEV} stop >/dev/null 2>&1
37
		/etc/init.d/net.${VENET_DEV} stop >/dev/null 2>&1
38
		rc-update del net.${VENET_DEV} default &>/dev/null
38
		rc-update del net.${VENET_DEV} default >/dev/null 2>&1
39
		rm -f /etc/init.d/net.${VENET_DEV}
39
		rm -f /etc/init.d/net.${VENET_DEV}
40
		sed -i -e '/_${VENET_DEV}/d' $CFGFILE
40
		sed -i -e '/_${VENET_DEV}/d' $CFGFILE
41
		return 0
41
		return 0
(-)a/etc/dists/scripts/postcreate.sh (-11 / +47 lines)
Lines 40-47 randcrontab() Link Here
40
		[ -f "${file}" ] || continue
40
		[ -f "${file}" ] || continue
41
		grep -wq VZCTL_POSTCREATE_SKIP "${file}" && continue
41
		grep -wq VZCTL_POSTCREATE_SKIP "${file}" && continue
42
42
43
		/bin/cp -fp ${file} ${file}.$$
43
		cp -fp ${file} ${file}.$$
44
		cat ${file} | awk '
44
		awk '
45
BEGIN { srand(); }
45
BEGIN { srand(); }
46
{
46
{
47
	if ($0 ~ /^[ \t]*#/ || $0 ~ /^[ \t]+*$/) {
47
	if ($0 ~ /^[ \t]*#/ || $0 ~ /^[ \t]+*$/) {
Lines 72-92 BEGIN { srand(); } Link Here
72
		line = line " "  ar[i];
72
		line = line " "  ar[i];
73
	}
73
	}
74
	print line;
74
	print line;
75
}' >		${file}.$$ && /bin/mv -f ${file}.$$ ${file}
75
}' <"$file" >	${file}.$$ && mv -f ${file}.$$ ${file}
76
		/bin/rm -f ${file}.$$ 2>/dev/null
76
		rm -f ${file}.$$ 2>/dev/null
77
	done
77
	done
78
}
78
}
79
79
80
disableroot()
80
disableroot()
81
{
81
{
82
	local file=${VE_ROOT}"/etc/passwd"
82
	local file="${VE_ROOT}/etc/passwd"
83
83
84
	[ -f "$file" ] || return 0
84
	[ -f "$file" ] &&
85
		grep -qs '^root::' "$file" ||
86
		return 0
85
87
86
	if /bin/grep -q "^root::" "${file}" 2>/dev/null; then
88
	sed -i 's/^root::/root:!!:/g' "$file"
87
		/bin/sed 's/^root::/root:!!:/g' < ${file} > ${file}.$$ &&
89
}
88
			/bin/mv -f ${file}.$$ ${file}
90
89
		/bin/rm -f ${file}.$$ 2>/dev/null
91
fixinittab()
92
{
93
	file="$VE_ROOT/etc/inittab"
94
95
	[ -f "$file" ] &&
96
		grep -qs '^[0-9].*mingetty.*tty' "$file" ||
97
		return 0
98
99
	sed -i 's|^[0-9].*mingetty.*tty|#&|' "$file"
100
}
101
102
fixsyslog()
103
{
104
	file="$VE_ROOT/etc/syslog.conf"
105
106
	[ -f "$file" ] &&
107
		grep -qs '^[^#[:space:]]\+[[:space:]]\+/dev/tty' "$file" ||
108
		return 0
109
110
	sed -i 's|^[^#[:space:]]\+[[:space:]]\+/dev/tty|#&|' "$file"
111
}
112
113
copy_localtime()
114
{
115
	local f=/etc/localtime
116
	if [ -s "$f" ]; then
117
		rm -f -- "$VE_ROOT$f" &&
118
			install -pm644 -- "$f" "$VE_ROOT$f"
90
	fi
119
	fi
91
}
120
}
92
121
Lines 150-160 set_file_caps() Link Here
150
	fi
179
	fi
151
}
180
}
152
181
153
[ -z "${VE_ROOT}" ] && exit 1
182
[ -n "$VE_ROOT" ] || exit 1
154
umask 0022
183
umask 0022
155
randcrontab
184
randcrontab
156
disableroot
185
disableroot
157
set_network
186
set_network
158
set_file_caps
187
set_file_caps
188
fixinittab
189
fixsyslog
190
copy_localtime
191
if [ -d /etc/hooks/post_create.d ] &&
192
   type run-parts >/dev/null 2>&1; then
193
	run-parts /etc/hooks/post_create.d
194
fi
159
195
160
exit 0
196
exit 0
(-)a/etc/dists/scripts/redhat-7.x_add_ip.sh (-1 / +1 lines)
Lines 104-110 get_free_aliasid() Link Here
104
104
105
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
105
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
106
	while test -z ${found}; do
106
	while test -z ${found}; do
107
		let IFNUM=IFNUM+1
107
		IFNUM=$((IFNUM+1))
108
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
108
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
109
			found=1
109
			found=1
110
	done
110
	done
(-)a/etc/dists/scripts/redhat-add_ip.sh (-23 / +19 lines)
Lines 31-44 fix_ifup() Link Here
31
	file="/sbin/ifup"
31
	file="/sbin/ifup"
32
32
33
	[ -f "${file}" ] || return 0
33
	[ -f "${file}" ] || return 0
34
	[ "x${VE_STATE}" != "xstarting" ] && return 0
34
	[ "${VE_STATE}" = "starting" ] || return 0
35
35
36
	if grep -q 'if \[ "\${DEVICE}" = "lo" \]; then' ${file} 2>/dev/null
36
	if grep -qs 'if \[ "\${DEVICE}" = "lo" \]; then' "${file}"; then
37
	then
37
		sed -i 's/if \[ "\${DEVICE}" = "lo" \]; then/if \[ "${IPADDR}" = "127.0.0.1" \]; then/g' "${file}"
38
		${CP} ${file} ${file}.$$ || return 1
39
		/bin/sed -e 's/if \[ "\${DEVICE}" = "lo" \]; then/if \[ "${IPADDR}" = "127.0.0.1" \]; then/g' < ${file} > ${file}.$$ &&
40
			mv -f ${file}.$$ ${file}
41
		rm -f ${file}.$$ 2>/dev/null
42
	fi
38
	fi
43
}
39
}
44
40
Lines 53-86 ARPCHECK=\"no\" Link Here
53
IPADDR=127.0.0.1
49
IPADDR=127.0.0.1
54
NETMASK=255.255.255.255
50
NETMASK=255.255.255.255
55
BROADCAST=0.0.0.0
51
BROADCAST=0.0.0.0
56
ARPCHECK=\"no\"" > $IFCFG || error "Can't write to file $IFCFG" $VZ_FS_NO_DISK_SPACE
52
ARPCHECK=\"no\"" > "${IFCFG}" || error "Can't write to file ${IFCFG}" ${VZ_FS_NO_DISK_SPACE}
57
53
58
	# Set /etc/sysconfig/network
54
	# Set /etc/sysconfig/network
59
	put_param $NETFILE NETWORKING yes
55
	put_param "${NETFILE}" NETWORKING yes
60
	# Set default route to venet0
56
	# Set default route to venet0
61
	put_param $NETFILE GATEWAYDEV ${VENET_DEV}
57
	put_param "${NETFILE}" GATEWAYDEV ${VENET_DEV}
62
	# Remove old (obsoleted) fake route
58
	# Remove old (obsoleted) fake route
63
	del_param $NETFILE GATEWAY
59
	del_param "${NETFILE}" GATEWAY
64
	# setup ipv6
60
	# setup ipv6
65
	setup6_network
61
	setup6_network
66
62
67
	# Set up /etc/hosts
63
	# Set up /etc/hosts
68
	if [ ! -f ${HOSTFILE} ]; then
64
	if [ ! -f "${HOSTFILE}" ]; then
69
		echo "127.0.0.1 localhost.localdomain localhost" > $HOSTFILE
65
		echo "127.0.0.1 localhost.localdomain localhost" > "${HOSTFILE}"
70
	fi
66
	fi
71
	fix_ifup
67
	fix_ifup
72
}
68
}
73
69
74
setup6_network()
70
setup6_network()
75
{
71
{
76
	[ "${IPV6}" != "yes" ] && return 0
72
	[ "${IPV6}" = "yes" ] || return 0
77
73
78
	if ! grep -q 'IPV6INIT="yes"' ${IFCFG}; then
74
	if ! grep -q 'IPV6INIT="yes"' "${IFCFG}"; then
79
		put_param ${IFCFG} IPV6INIT yes
75
		put_param "${IFCFG}" IPV6INIT yes
80
	fi
76
	fi
81
	if ! grep -q 'NETWORKING_IPV6="yes"' ${NETFILE}; then
77
	if ! grep -q 'NETWORKING_IPV6="yes"' "${NETFILE}"; then
82
		put_param ${NETFILE} NETWORKING_IPV6 yes
78
		put_param "${NETFILE}" NETWORKING_IPV6 yes
83
		put_param ${NETFILE} IPV6_DEFAULTDEV ${VENET_DEV}
79
		put_param "${NETFILE}" IPV6_DEFAULTDEV "${VENET_DEV}"
84
		NETWORKRESTART=yes
80
		NETWORKRESTART=yes
85
	fi
81
	fi
86
}
82
}
Lines 102-109 NETMASK=${netmask}" > $file || Link Here
102
98
103
add_ip6()
99
add_ip6()
104
{
100
{
105
	[ "${IPV6}" != "yes" ] && return 0
101
	[ "$IPV6" = "yes" ] || return 0
106
	if ! grep -qw "$1" ${IFCFG} 2>/dev/null; then
102
	if ! grep -qsw "$1" "${IFCFG}"; then
107
		setup6_network
103
		setup6_network
108
		add_param ${IFCFG} IPV6ADDR_SECONDARIES "$1/$2"
104
		add_param ${IFCFG} IPV6ADDR_SECONDARIES "$1/$2"
109
		if have_ifconfig; then
105
		if have_ifconfig; then
Lines 139-145 get_free_aliasid() Link Here
139
135
140
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
136
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
141
	while test -z ${found}; do
137
	while test -z ${found}; do
142
		let IFNUM=IFNUM+1
138
		IFNUM=$((IFNUM+1))
143
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
139
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
144
			found=1
140
			found=1
145
	done
141
	done
(-)a/etc/dists/scripts/set_console.sh (-1 / +1 lines)
Lines 1-4 Link Here
1
#!/bin/bash
1
#!/bin/sh
2
#  Copyright (C) 2012-2014, Parallels, Inc. All rights reserved.
2
#  Copyright (C) 2012-2014, Parallels, Inc. All rights reserved.
3
#
3
#
4
#  This program is free software; you can redistribute it and/or modify
4
#  This program is free software; you can redistribute it and/or modify
(-)a/etc/dists/scripts/set_dns.sh (-4 / +8 lines)
Lines 30-43 set_dns() Link Here
30
	fi
30
	fi
31
	if [ -n "${server}" ]; then
31
	if [ -n "${server}" ]; then
32
		[ -f ${cfgfile} ] || touch ${cfgfile}
32
		[ -f ${cfgfile} ] || touch ${cfgfile}
33
		sed '/^\s*nameserver\s/d' ${cfgfile} > ${cfgfile}.$$ &&
33
		sed -i '/^\s*nameserver\s/d' ${cfgfile} ||
34
			mv -f ${cfgfile}.$$ ${cfgfile} ||
35
			error "Can't change file ${cfgfile}" ${VZ_FS_NO_DISK_SPACE}
34
			error "Can't change file ${cfgfile}" ${VZ_FS_NO_DISK_SPACE}
36
		for srv in ${server}; do
35
		for srv in ${server}; do
37
			echo "nameserver ${srv}" >> ${cfgfile}
36
			echo "nameserver ${srv}" >> "${cfgfile}"
38
		done
37
		done
39
	fi
38
	fi
40
	chmod 644 ${cfgfile}
39
	chmod 644 "${cfgfile}"
41
}
40
}
42
41
43
gen_resolvconf() {
42
gen_resolvconf() {
Lines 54-57 else Link Here
54
	set_dns /etc/resolv.conf "${NAMESERVER}" "${SEARCHDOMAIN}"
53
	set_dns /etc/resolv.conf "${NAMESERVER}" "${SEARCHDOMAIN}"
55
fi
54
fi
56
55
56
if [ -d /etc/hooks/set_dns.d ] &&
57
   type run-parts >/dev/null 2>&1; then
58
	run-parts /etc/hooks/set_dns.d "$NAMESERVER" "$SEARCHDOMAIN"
59
fi
60
57
exit 0
61
exit 0
(-)a/etc/dists/scripts/set_userpass.sh (-3 / +7 lines)
Lines 26-38 set_serrpasswd() Link Here
26
	local user=$(echo $userpw | sed 's/:.*$//')
26
	local user=$(echo $userpw | sed 's/:.*$//')
27
	local passwd=$(echo $userpw | sed 's/^[^:]*://')
27
	local passwd=$(echo $userpw | sed 's/^[^:]*://')
28
28
29
	if [ -z "${user}" -o  -z "${passwd}" ]; then
29
	if [ -z "${user}" -o -z "${passwd}" ]; then
30
		exit $VZ_CHANGEPASS
30
		exit $VZ_CHANGEPASS
31
	fi
31
	fi
32
	if [ ! -c /dev/urandom ]; then
32
	if [ ! -c /dev/urandom ]; then
33
		mknod /dev/urandom c 1 9 > /dev/null
33
		mknod /dev/urandom c 1 9 > /dev/null
34
	fi
34
	fi
35
	if ! grep -E "^${user}:" ${CFGFILE} 2>&1 >/dev/null; then
35
	if ! grep -qs "^${user}:" ${CFGFILE}; then
36
		useradd -m "${user}" 2>&1 || exit $VZ_CHANGEPASS
36
		useradd -m "${user}" 2>&1 || exit $VZ_CHANGEPASS
37
	fi
37
	fi
38
	echo "${passwd}" | passwd --stdin "${user}" 2>/dev/null
38
	echo "${passwd}" | passwd --stdin "${user}" 2>/dev/null
Lines 41-47 set_serrpasswd() Link Here
41
	fi
41
	fi
42
}
42
}
43
43
44
[ -z "${USERPW}" ] && return 0
44
[ -n "${USERPW}" ] || return 0
45
set_serrpasswd "${USERPW}"
45
set_serrpasswd "${USERPW}"
46
if [ -d /etc/hooks/set_userpass.d ] &&
47
   type run-parts >/dev/null 2>&1; then
48
	run-parts /etc/hooks/set_userpass.d "$USERPW"
49
fi
46
50
47
exit 0
51
exit 0
(-)a/etc/dists/scripts/slackware-9.x_del_ip.sh (-2 / +2 lines)
Lines 27-33 del_ip() Link Here
27
	[ -f ${IFCFG}  ] || return 0
27
	[ -f ${IFCFG}  ] || return 0
28
28
29
	if [ "x${IPDELALL}" = "xyes" ]; then
29
	if [ "x${IPDELALL}" = "xyes" ]; then
30
		/sbin/ifconfig venet0 down
30
		ifconfig venet0 down
31
		mv -f ${IFCFG} ${IFCFG}.bak
31
		mv -f ${IFCFG} ${IFCFG}.bak
32
		return 0
32
		return 0
33
	fi
33
	fi
Lines 35-41 del_ip() Link Here
35
	for ipm in ${IP_ADDR}; do
35
	for ipm in ${IP_ADDR}; do
36
		ip_conv $ipm
36
		ip_conv $ipm
37
		if grep -wq "${_IP}" ${IFCFG} 2>/dev/null; then
37
		if grep -wq "${_IP}" ${IFCFG} 2>/dev/null; then
38
			/sbin/ifconfig venet0 down
38
			ifconfig venet0 down
39
			put_param ${IFCFG} "IPADDR" ""
39
			put_param ${IFCFG} "IPADDR" ""
40
			break
40
			break
41
		fi
41
		fi
(-)a/etc/dists/scripts/suse-7.x_add_ip.sh (-1 / +1 lines)
Lines 73-79 add_ip() Link Here
73
	for ipm in ${IP_ADDR}; do
73
	for ipm in ${IP_ADDR}; do
74
		ip_conv $ipm
74
		ip_conv $ipm
75
		aliasid=${IP_NUM}
75
		aliasid=${IP_NUM}
76
		let IP_NUM=IP_NUM+1
76
		IP_NUM=$((IP_NUM+1))
77
		# build 'IPADDR_x' records
77
		# build 'IPADDR_x' records
78
		put_param ${CFGFILE} IPADDR_${IP_NUM} "${_IP}"
78
		put_param ${CFGFILE} IPADDR_${IP_NUM} "${_IP}"
79
		# build 'NETDEV_x' records
79
		# build 'NETDEV_x' records
(-)a/etc/dists/scripts/suse-8.x_add_ip.sh (-1 / +1 lines)
Lines 77-83 get_free_aliasid() Link Here
77
77
78
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
78
	[ -z "${IFNUMLIST}" ] && get_all_aliasid
79
	while test -z ${found}; do
79
	while test -z ${found}; do
80
		let IFNUM=IFNUM+1
80
		IFNUM=$((IFNUM+1))
81
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
81
		echo "${IFNUMLIST}" | grep -q -E "^${IFNUM}$" 2>/dev/null ||
82
			found=1
82
			found=1
83
	done
83
	done
(-)a/etc/dists/scripts/suse-add_ip.sh (-2 / +2 lines)
Lines 100-106 IPADDR=127.0.0.1" > ${IFCFG} || Link Here
100
	error "Can't write to file ${IFCFG}" ${VZ_FS_NO_DISK_SPACE}
100
	error "Can't write to file ${IFCFG}" ${VZ_FS_NO_DISK_SPACE}
101
101
102
	# Set up /etc/hosts
102
	# Set up /etc/hosts
103
	[ -f $"{HOSTFILE}" ] || echo "127.0.0.1 localhost.localdomain localhost" > $HOSTFILE
103
	[ -f "${HOSTFILE}" ] || echo "127.0.0.1 localhost.localdomain localhost" > $HOSTFILE
104
	# Set default route to venet0 only if there are IPs
104
	# Set default route to venet0 only if there are IPs
105
	# and there is no other default route
105
	# and there is no other default route
106
	rm -f ${ROUTES}
106
	rm -f ${ROUTES}
Lines 151-157 add_ip() Link Here
151
			continue
151
			continue
152
		fi
152
		fi
153
		while test -z ${found}; do
153
		while test -z ${found}; do
154
			let ifnum++
154
			ifnum=$((ifnum+1))
155
			if ! echo "${IFNUMLIST}" | grep -w -q "${ifnum}"; then
155
			if ! echo "${IFNUMLIST}" | grep -w -q "${ifnum}"; then
156
				found=1
156
				found=1
157
			fi
157
			fi
(-)a/man/vzctl.8.in (-3 / +3 lines)
Lines 1458-1468 Error compacting ploop image Link Here
1458
.IP 167
1458
.IP 167
1459
Error listing ploop snapsots
1459
Error listing ploop snapsots
1460
.SH EXAMPLES
1460
.SH EXAMPLES
1461
To create and start "basic" container with ID of 1000 using
1461
To create and start "basic" container with ID of 1000 using \fBaltlinux\fR
1462
\fBcentos-5\fR OS template and IP address of 192.168.10.200:
1462
OS template and IP address of 192.168.10.200:
1463
.PP
1463
.PP
1464
.EX
1464
.EX
1465
   vzctl create 1000 --ostemplate centos-5 --config basic
1465
   vzctl create 1000 --ostemplate altlinux --config basic
1466
   vzctl set 1000 --ipadd 192.168.10.200 --save
1466
   vzctl set 1000 --ipadd 192.168.10.200 --save
1467
   vzctl start 1000
1467
   vzctl start 1000
1468
.EE
1468
.EE
(-)a/scripts/vz-postinstall.in (-5 / +5 lines)
Lines 1-4 Link Here
1
#!/bin/bash
1
#!/bin/sh
2
# OpenVZ post-install script
2
# OpenVZ post-install script
3
# Copyright (C) 2009-2013, Parallels, Inc. Licensed under GNU GPL.
3
# Copyright (C) 2009-2013, Parallels, Inc. Licensed under GNU GPL.
4
#
4
#
Lines 20-26 check_file() Link Here
20
	local file
20
	local file
21
21
22
	for file in $*; do
22
	for file in $*; do
23
		test -a $file || fatal "$file not found"
23
		test -f $file || fatal "$file not found"
24
		test -w $file || fatal "$file is not writable"
24
		test -w $file || fatal "$file is not writable"
25
	done
25
	done
26
}
26
}
Lines 34-40 change_param() Link Here
34
{
34
{
35
	local file=$1 p=$2 v=$3
35
	local file=$1 p=$2 v=$3
36
	# Escape dots, to be used for regexps
36
	# Escape dots, to be used for regexps
37
	local pp=${p//./\\.}
37
	local pp="$(echo $p | sed -e 's,\.,\\.,g')"
38
38
39
	# Check if param is there
39
	# Check if param is there
40
	if grep -q "^[ \t]*${p}[ \t]*=.*" $file; then
40
	if grep -q "^[ \t]*${p}[ \t]*=.*" $file; then
Lines 79-85 disable_selinux() Link Here
79
	test -d $(dirname $file) || return
79
	test -d $(dirname $file) || return
80
80
81
	# If there's no $file, create it
81
	# If there's no $file, create it
82
	test -a $file || touch $file
82
	test -e $file || touch $file
83
83
84
	# Check we can write to it
84
	# Check we can write to it
85
	check_file $file
85
	check_file $file
Lines 94-100 disable_kernel() Link Here
94
	local file=/etc/yum.conf
94
	local file=/etc/yum.conf
95
95
96
	# if there is no file, nothing to do
96
	# if there is no file, nothing to do
97
	test -a $file || return 0
97
	test -e $file || return 0
98
98
99
	# Check we can write to it
99
	# Check we can write to it
100
	check_file $file
100
	check_file $file
(-)a/scripts/vzevent-stop.in (-1 / +1 lines)
Lines 60-66 fi Link Here
60
	. @PKGCONFDIR@/vz.conf
60
	. @PKGCONFDIR@/vz.conf
61
	. @VPSCONFDIR@/$VEID.conf
61
	. @VPSCONFDIR@/$VEID.conf
62
	test -f $VE_ROOT/reboot || exit 0
62
	test -f $VE_ROOT/reboot || exit 0
63
	$(awk '$2 == "'$VE_ROOT'" && $4 !~ "^rw" {
63
	$(awk '$2 == "'$VE_ROOT'" && $4 !~ "^rw" { \
64
		print "mount -oremount,rw",$1,$2}' /proc/mounts)
64
		print "mount -oremount,rw",$1,$2}' /proc/mounts)
65
	rm -f $VE_ROOT/reboot
65
	rm -f $VE_ROOT/reboot
66
	exit 111
66
	exit 111

Return to bug 28628