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

(-)a/scripts/network (-32 / +58 lines)
Lines 55-64 fi Link Here
55
55
56
test "$DEBUG" = "EXTRA" && . scripts/extradebug
56
test "$DEBUG" = "EXTRA" && . scripts/extradebug
57
57
58
systemd_running () {
59
	# We simply test whether systemd cgroup hierarchy is mounted
60
	# where we return 0, non-zero if not.
61
	/bin/mountpoint -q /sys/fs/cgroup/systemd
62
}
63
systemd_booting () {
64
	# returns 0 when we boot, 1 in running system
65
	systemctl show -p ActiveState default.target | grep -qi inactive
66
}
67
58
# Only use ifup option 'onboot' if booting or changing runlevel
68
# Only use ifup option 'onboot' if booting or changing runlevel
59
# Therefore we check if we were called from init
69
# Therefore we check if we were called from init or while systemd boot.
60
FS_FILTER=""
70
FS_FILTER=""
61
if [ -n "$INIT_VERSION" -a -z "$YAST_IS_RUNNING" ] ; then
71
SD_RUNNING=no
72
SD_BOOTING=no
73
if systemd_running ; then
74
	SD_RUNNING=yes
75
	systemd_booting && SD_BOOTING=yes
76
fi
77
if [ \( -n "$INIT_VERSION" -o "$SD_BOOTING" = yes \) -a \
78
	-z "$YAST_IS_RUNNING" ] ; then
62
	MODE=onboot
79
	MODE=onboot
63
	FS_FILTER=localfs
80
	FS_FILTER=localfs
64
fi
81
fi
Lines 102-144 test -f scripts/functions.common \ Link Here
102
   || exit $R_INTERNAL
119
   || exit $R_INTERNAL
103
120
104
121
105
systemd_running () {
106
# We simply test whether systemd cgroup hierarchy is mounted
107
	if /bin/mountpoint -q /sys/fs/cgroup/systemd ; then 
108
		return 1
109
	fi
110
	return 0
111
}
112
113
122
114
######################################################################
123
######################################################################
115
# Start NetworkManager if wanted
124
# Handle NetworkManager start when requested
116
#
125
#
117
# Some variables and functions are defined in
126
# Some variables and functions are defined in
118
# /etc/sysconfig/network/scripts/functions
127
# /etc/sysconfig/network/scripts/functions
119
# because they are also used in ifup
128
# because they are also used in ifup
120
#
129
#
121
systemd_running ; sd=$?
122
if [ "$NETWORKMANAGER" = yes ] ; then
130
if [ "$NETWORKMANAGER" = yes ] ; then
123
	if [ "$FS_FILTER" = "localfs" -o $sd = 1 ] ; then
131
	if [ "$FS_FILTER" = "localfs" ] ; then
124
		# NetworkManager is not supported without remotefs
132
		# Under systemd, NetworkManager is started via its
125
		# and will be started later via network-remotefs.
133
		# own .service file, thus never while localfs is set.
126
		# NetworkManager should be started with its own .service
134
		# Otherwise, NetworkManager will be started later via
127
		# under systemd
135
		# network-remotefs init script (it is installed in
136
		# /usr, thus depends on already started remotefs).
128
		case $ACTION in
137
		case $ACTION in
129
			(status) exit 3 ;;
138
			(status) exit 3 ;;
130
			(start)  if [ $sd = 1 ]; then
139
			(start)  exit 0 ;;
131
					systemctl start NetworkManager.service
132
				 fi
133
				 exit 0 ;;
134
			(stop)          ;;
140
			(stop)          ;;
135
			(reload) if [ $sd = 1 -a netcontrol_running ]; then
136
					cd "$OLDPWD"
137
					./$0 stop
138
					./$0 start
139
					systemctl start NetworkManager.service
140
			         fi
141
				 exit 0 ;;
142
			(*)      exit 6 ;;
141
			(*)      exit 6 ;;
143
		esac
142
		esac
144
	elif [ ! -x "$NETWORKMANAGER_BIN" ] ; then
143
	elif [ ! -x "$NETWORKMANAGER_BIN" ] ; then
Lines 147-157 if [ "$NETWORKMANAGER" = yes ] ; then Link Here
147
		         "Please set" \
146
		         "Please set" \
148
	        	 "\n/etc/sysconfig/network/config:NetworkManager=no" \
147
	        	 "\n/etc/sysconfig/network/config:NetworkManager=no" \
149
		         "or install NetworkManager."
148
		         "or install NetworkManager."
149
	elif [ "$SD_RUNNING" = "yes" ] ; then
150
		# NetworkManager is started via own .service file under
151
		# systemd, but we forward the restart/reload (sub)actions
152
		# to catch configuration change from/to the NetworkManager.
153
		case $ACTION in
154
			(start) 
155
				if netcontrol_running ; then
156
					cd "$OLDPWD"
157
					$0 stop
158
				fi
159
				systemctl start NetworkManager.service
160
				exit 0
161
			;;
162
			(stop)
163
				systemctl stop NetworkManager.service
164
			;;
165
			(reload)
166
				if netcontrol_running ; then
167
					cd "$OLDPWD"
168
					$0 stop
169
					$0 start
170
				fi
171
				systemctl start NetworkManager.service
172
				exit 0
173
			;;
174
			(status) exit 3 ;;
175
			(*)      exit 6 ;;
176
		esac
150
	fi
177
	fi
151
else
178
elif [ "$SD_RUNNING" = "yes" -a nm_running ] ; then
152
	if [ $sd = 1 -a nm_running ]; then
179
	# NetworkManager is disabled, stop it
153
		systemctl stop NetworkManager.service
180
	systemctl stop NetworkManager.service
154
	fi
155
fi
181
fi
156
182
157
check_firewall() {
183
check_firewall() {

Return to bug 719214