Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > 2cf2afe6281fb0311aa7a744849d6041 > files > 1

initscripts-10.04-7.mga9.src.rpm

diff --git a/.gitignore b/.gitignore
index 5a31cf56..e37d4f6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,8 @@
 ChangeLog
+*bz2
+*.mo
+.*.swp
+*.o
 *.tar.gz
+*~
+*.orig
diff --git a/Makefile b/Makefile
index 01a21223..61ce8370 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,12 @@ sharedstatedir = $(localstatedir)/lib
 VERSION       := $(shell gawk '/Version:/ { print $$2 }' initscripts.spec)
 NEXT_VERSION  := $(shell gawk '/Version:/ { print $$2 + 0.01}' initscripts.spec)
 
+Mageia_DIR     := mageia
+Mageia_FILES   := $(shell cd $(Mageia_DIR); find etc network-scripts usr -type f \! -name .keep)
+Mageia_SUBDIRS := $(shell cd $(Mageia_DIR); find -type d -links 2)
+PO             := po-mageia
+Mageia_MANDIR  := man-mageia
+
 
 all: make-binaries make-translations
 
@@ -42,21 +48,29 @@ make-binaries:
 	$(MAKE) -C src
 
 make-translations:
-	$(MAKE) -C po PYTHON=$(PYTHON)
+	$(MAKE) -C $(PO) PYTHON=$(PYTHON)
 
 
 # NOTE: We are no longer installing into /usr/sbin directory, because this is
 #       just a symlink to /usr/bin, thanks to UsrMove change. Instead, we just
 #       use virtual provides for /usr/sbin/<utility> in specfile (for backward
 #       compatibility).
-install: install-binaries install-translations install-etc install-usr install-network-scripts install-man install-post
+install: install-mageia install-binaries install-translations install-etc install-usr install-network-scripts install-man install-post
+
+install-mageia:
+	@echo "Modifying structure for Mageia"
+	# Ensure the directories used by Mageia exist in the main directory
+	@for i in $(Mageia_SUBDIRS); do mkdir -p $$i; echo "$$i";done
+	# Now copy over the various files to the main directory. This allows
+	# the standard logic of this Makefile to work
+	@for i in $(Mageia_FILES);do cp -a $(Mageia_DIR)/$$i $$i;done
 
 
 install-binaries:
 	$(MAKE) install -C src DESTDIR=$(DESTDIR) prefix=$(prefix) bindir=$(bindir) libdir=$(libdir)
 
 install-translations:
-	$(MAKE) install -C po  DESTDIR=$(DESTDIR) prefix=$(prefix) bindir=$(bindir) libdir=$(libdir) \
+	$(MAKE) install -C $(PO)  DESTDIR=$(DESTDIR) prefix=$(prefix) bindir=$(bindir) libdir=$(libdir) \
 	                                          datarootdir=$(datarootdir) datadir=$(datadir) sysconfdir=$(sysconfdir)
 
 
@@ -73,14 +87,20 @@ install-usr:
 install-network-scripts: install-usr install-etc
 	install -m 0755 -d      $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts
 	cp -a network-scripts/* $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/
-	ln -srf $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/{ifup-ippp,ifup-isdn}
-	ln -srf $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/{ifdown-ippp,ifdown-isdn}
 
 install-man: install-usr
 	install -m 0755 -d      $(DESTDIR)$(mandir)/man1
 	install -m 0755 -d      $(DESTDIR)$(mandir)/man8
 	install -m 0644 man/*.1 $(DESTDIR)$(mandir)/man1
 	install -m 0644 man/*.8 $(DESTDIR)$(mandir)/man8
+	# install translated man pages
+	for j in 1 8 ; do \
+	   for i in $(Mageia_MANDIR)/??* ; do \
+	       install -d $(DESTDIR)$(mandir)/`basename $$i`/man$$j ; \
+	       install -m 644 $$i/*.$$j $(DESTDIR)$(mandir)/`basename $$i`/man$$j ; \
+	   done ; \
+	done
+
 
 # Initscripts still ship some empty directories necessary for system to function
 # correctly...
@@ -97,11 +117,17 @@ install-post: install-etc
 	done
 	ln -srf $(DESTDIR)$(sysconfdir)/rc.d/init.d $(DESTDIR)$(sysconfdir)/init.d
 
-clean:
+clean: clean-mageia
 	$(MAKE) clean -C src
-	$(MAKE) clean -C po
+	$(MAKE) clean -C $(PO)
 	@find . -name "*~" -exec rm -v -f {} \;
 
+clean-mageia:
+	# Remove the files we've added
+	@for i in $(Mageia_FILES);do rm -f $$i;done
+	# Try to remove any empty directories caused by the files we've removed
+	@for i in $(Mageia_SUBDIRS);do [ -d "$$1" ] && [ ! -h "$$1" ] && rmdir "$$1" 2> /dev/null || :;done
+
 tag:
 	@git tag -a -f -m "$(VERSION) release" $(VERSION)
 	@echo "Tagged as $(VERSION)"
@@ -122,3 +148,16 @@ archive: clean
 	@gzip -f initscripts-$(VERSION).tar
 	@rm -rf initscripts-$(VERSION)
 	@echo "The archive is at initscripts-$(VERSION).tar.gz"
+
+
+mageiadist: clean
+	# Make a tarball for all the bits which are unlikely to change
+	@git archive --format=tar $$(git rev-parse HEAD) ':po-mageia' ':man-mageia' > initscripts-$(VERSION)-mageia.tar
+	@mkdir -p initscripts-$(VERSION)/
+	@tar --append -f initscripts-$(VERSION)-mageia.tar initscripts-$(VERSION)
+	@xz -f -5 initscripts-$(VERSION)-mageia.tar
+	@rm -rf initscripts-$(VERSION)
+	@echo "The Mageia archive is at initscripts-$(VERSION)-mageia.tar.xz"
+	# Make a tarball for all the bits which could change more often
+	@git diff 10.04...distro/mga ':!po-mageia' ':!man-mageia' > initscripts-$(VERSION)-mageia.patch
+	@echo "The Mageia patch is at initscripts-$(VERSION)-mageia.patch"
diff --git a/README.Mageia.md b/README.Mageia.md
new file mode 100644
index 00000000..00112860
--- /dev/null
+++ b/README.Mageia.md
@@ -0,0 +1,154 @@
+# Mageia's Init Scripts
+
+This is a fork of the Fedora Init Script package which currently lives over at
+[Fedora-SysV on GitHub](https://github.com/fedora-sysv/initscripts.git).
+
+----
+## History
+
+This repository was recreated from the original Mandriva initscripts by Mageia (and formerly Mandriva) contributor Colin Guthrie to help better manage merging of upstream Fedora changes.
+
+Many of the changes made relate to translations which are now hideously out of date, and various networking tweaks and various things to improve boot speed (aka SpeedBoot) from before the times of [systemd](http://www.freedesktop.org/wiki/Software/systemd/). Several of these changes have now been removed again as they are obsolete.
+
+The repository does not contain full history (although that was an original intention) as the benefits of this vs. the effort involved are somewhat questionable.
+
+### Known todo list (issues)
+
+- [x] Reduce divergence of mandrake/po/Makefile and upstreams po/Makefile. The mandrake/po/Makefile seems to be based of the po/Makefile from commit 5a6dbf7d3da8e5bdda3facb7c8aff2d2b9566ee6 (upstream initscripts).: Done except for the po-mageia/Makefile
+- [ ] Figure out if it's better to use upstream po files, outdated customized po files or possibly: somehow merge them
+- [x] Remove usage of /etc/locale; no need as systemd already ensures /usr is available
+- [ ] Upstreams service script had a lot of fixes. Our version deviates heavily. The fixes need to be investigated. Possibly be closer to upstream
+- [ ] Upstream gives a deprecation notice for the network scripts. Need to raise with dev mailing list. Current thought is to leave it in.
+- [ ] Investigate moving some of our things to /usr/libexec, similar to: netconsole, import-state, loadmodules, readonly-root
+- [ ] Commit 59928ce72da10f1c45a0aa08c9dd3a439fdd74a0 cleaned up the lang.{csh,sh} files before removing them. These cleanups need to be investigated. Also need to check any possible changes made in setup package
+- [x] Check if our customizations rely on the (removed) shvar program: Nope, see comment in next section
+- [x] Upstream switched from using awk to using tr in commit beeec3c4050e2986f514725c92d1cb1d65005926. Check if our scripts rely on that. Finding: this was only changed in a few lines. It still heavily relies on awk. No similar changes needed for our bits.
+
+Spec file related:
+- [ ] Need to cleanup /etc/locale in 10.04 spec file
+- [x] Need to move 9.78 specific ownership of files to correct packages: Found additional files /var/log/{btmp,wtmp}. Moved those to systemd as per  systemd-246-3.
+- [ ] Need to further analyze 9.78 spec file for deviations with upstream
+- [ ] Need to write 10.04 spec file, determine how much to deviate from upstream.
+- [ ] Upstream implemented alternatives system for ifup and ifdown. Need to align with NetworkManager.
+- [ ] NetworkManager: Need to also update the 'how to switch to NM instructions'
+- [ ] If NM is currently in use, ensure 10.04 spec file will still have NM as default, even if alternatives system is used
+
+Low priority:
+- [ ] Use gprintify.py from spec-helper. This fork carries an outdated slightly modified copy of gprintify.py. The current version of gprintify has been ported to Perl and can be found in spec-helper. The modifications to gprintify.py seem to be based off b83c14a5a82de64992144f24d819b8421cc417cf in spec-helper. Current status: version from spec-helper does not seem to work properly.
+- [ ] Figure out if upstream commit 4e2400798397ae2567a8cfd824c14ccd41983b08 solved one of our Mageia customizations (grep for "We need to wait for duplicate address detection to complete before running dhclient -6")
+- [x] Rename mandrake directory to mageia
+- [ ] Look at po-mageia/Makefile
+
+### Stuff upstream removed
+
+- [ ] cgroup support (use systemd!)
+- [ ] netreport functionality
+- [x] /etc/rwtab.d & /etc/statetab.d (empty) folders to 'filesystem' package: Moved as per filesystem-2.1.9-34. Cannot upload, asked sysadmins to fix.
+- [x] nis-domainname.service moved to the hostname package (https://src.fedoraproject.org/rpms/hostname/pull-request/1): As this was a different name, moved this in hostname-3.23-2
+- [x] /etc/networks moved into 'setup' package: Moved in setup 2.7.25. Also aligned setup to be more like Fedora. The setup repository still has quite some deviations with Fedora.
+- [x] lang.{sh,csh} moved into setup package: Kept in our fork for now.
+- [x] sushell was removed: Investigated this, any reference to this still handled the lack of sushell. Plus systemd has its own (better) thing.
+- [x] shvar was removed: Not used in our fork. Usage removed upstream in 2000. No use in my installation (checked /etc, /usr)
+- [x] po/xgettext_sh was removed: Also not used by us
+- [x] sys-unconfig was removed. It was a shell script to reconfigure the system upon next boot: Probably never used.
+- [x] etc/adjtime and /etc/sysconfig/clock moved into 'util-linux' package: /etc/adjtime moved. /etc/sysconfig/clock was just the documentation; file has not been in use. /etc/sysconfig/clock usage found in drakx-net, drakx, filed bug 27012
+
+Low priority:
+- [ ] /etc/rc.d/rc.local (for local changes by a sysadmin): systemd has a reference to this; but probably no need to have it as ghost in initscripts
+
+### Stuff deprecrated
+
+- [ ] consoletype: affects our lang.{csh,sh} forks
+- [ ] genhostid
+
+----
+## How to Use
+
+In order to use this repository usefully in Mageia, you have to follow a few rules for cloning that are somewhat non standard due to this being a "fork".
+
+### Cloning
+
+To clone, you should first clone from upstream Fedora first:
+
+    $ git clone https://github.com/fedora-sysv/initscripts
+
+Once it's cloned, you need to then add a remote for *our* fork:
+
+    $ cd initscripts
+    $ git remote add mga ssh://git@git.mageia.org/software/forks/initscripts
+    $ git remote update mga
+
+And once you have that updated, you should setup a local tracking branch for our main development branch which is named simple *distro/mga*:
+
+    $ git checkout -t mga/distro/mga
+
+* Note 1: The branches for stable distro releases are named *distro/mga1*, *distro/mga2* etc.
+* Note 2: It is strongly recommended to install the *git-prompt* package to see which branch you are currently using.
+
+### Merging with upstream
+
+When upstream release a new version, we will periodically merge in their changes. Due to the deviations over the years this is sometimes a rather complex task and not for the faint hearted! That said, some of our modifications really are out of date now and could, in all honesty, be dropped in favour of the upstream version - probably worth keeping this in mind when doing a complex merge and perhaps discussing with others on the Cauldron mailing list.
+
+#### Updating upstream
+
+You need to update from upstream so you can do:
+
+    $ git checkout master
+    $ git pull
+
+This should bring in new code from fedora.
+
+You can then push this to us quite happily:
+
+    $ git push mga master
+    $ git push mga --tags
+
+* **Important Note**: Keep in mind that our master branch should just be a mirror of Fedora's. We should not put any of our own changes on this branch.
+
+#### Merging
+
+Before doing a merge, it's good to minimize the changes with upstream. For example, if the fork is based upon 10.04, first check for the changes. Use:
+
+  $ git diff 10.04...mga/distro/mga ':!man/' ':!mageia' ':!po-mageia' ':!man-mageia'
+
+In above command git is instructed to hide certain directories. Make sure to run the command from the main directory for this to work.
+
+We try to stick to merging only upstream tags. To do this we would simply do:
+
+    $ git checkout distro/mga
+    $ git merge 10.04
+
+You then have the fun job of fixing the (no doubt) numerous conflicts!
+
+When you are ready to commit, please just use the default commit message git generates automatically for a merge commit. It will automatically list any files that had merge conflicts.
+
+If you have decided to revert a file to the upstream version in your commit, please mention this in the commit message at the end.
+
+### Packaging changes
+
+#### Super patch
+Periodically, we will generate a **super patch** containing all our changes. This patch is generated from the upstream tag of the tarball we are using and our current HEAD. It is generated via a command similar to:
+
+    $ git diff 10.04..mga/distro/mga | xz >initscripts-mgaconf.patch.xz
+
+* Note that the *upstream* branch for *distro/mga* is used (as it's prefixed with the remote name *mga/*). This is because you should be careful to only generate the super patch from changes you **have already pushed**. If you do not do this other contributors may not be able to verify your patch and some commits may even be lost. You have been warned!
+
+Once you have generated the super patch you should note the sha1 of the the current head and include it as a comment in the initscripts.spec file.
+
+#### Incremental patches
+
+In order to cut down on the number of times we regenerate the super patch we will usually package incremental patches to fix issues as they occur. These patches should be committed to the distro/mgaN branch and pushed. Once they have been pushed they should not be edited and any further changes should be made as new patches.
+
+To generate the incremental patches take the sha1 sum as noted in the initscripts.spec and run the following command:
+
+    $ git format-patch --start-number 100 SHA1..mga/distro/mga
+
+* Note: that I've used the full remote branch name here too which means changes have to be pushed first, but if you are creating a package for testing you can of course just use your local branch.
+
+### Pushing changes
+
+When you are happy with your changes you should push them. To do this type:
+
+    $ git push mga distro/mga
+
+You can adjust this accordingly to match various git config settings as you see fit.
diff --git a/doc/sysconfig.txt b/doc/sysconfig.txt
index b16338a9..8a74bad3 100644
--- a/doc/sysconfig.txt
+++ b/doc/sysconfig.txt
@@ -120,6 +120,11 @@ Generic options:
     on SPARC only, sun means a sun keyboard is attached on /dev/kbd,
     pc means a PS/2 keyboard is on ps/2 port.
   
+/etc/sysconfig/system:
+
+	SECURE_TMP=yes|no
+	   Set to 'yes' to have TMPDIR and TMP set to a secure temporary directory
+
 /etc/sysconfig/mouse:
 
   MOUSETYPE=microsoft|mouseman|mousesystems|ps/2|msbm|logibm|atibm|
@@ -136,13 +141,24 @@ Generic options:
   GATEWAY=<gateway IP>
   GATEWAYDEV=<gateway device to use, when multiple devices have GATEWAY=> (e.g. eth0)
   NISDOMAIN=<nis domain name>
+  IFPLUGD_ARGS="<args to pass to ifplugd>" default to "-w -b"
   NOZEROCONF=
     Set this to not set a route for dynamic link-local addresses.
 
   NETWORKDELAY=<delay in seconds>
     Delay in seconds after all network interfaces are initialized.  Useful if
     network has spanning tree running and must wait for STP convergence.
-    Default: 0 (no delay)
+    Default: 20
+
+  DEFAULT_LINK_DETECTION_DELAY=<time in seconds>
+    The default value used for link detection delay if the interface
+    configuration file does not specify it. After this time an interface with
+    missing link beat is considered to be unplugged.
+    Default: 2
+
+  MIN_LINK_DETECTION_DELAY=<delay in seconds>
+    Force minimum link detection delay on all interfaces.
+    Default: 0
 
   WAIT_UNTIL_REACHABLE=<IP address|DNS name>
     Network initscript will wait until specified target is reachable.
@@ -367,6 +383,44 @@ Generic options:
     -q option is not given to sendmail if /etc/sysconfig/sendmail
     exists and QUEUE is empty or undefined.
 
+/etc/locale.conf
+
+  A configutration file for locale settings. See locale.conf(5) for
+  more details. 
+
+  LANG= set locale for all categories, can be any two letter ISO
+    language code
+  LC_CTYPE= locale data configuration for classification and conversion
+    of characters
+  LC_COLLATE= locale data configuration for collation (sort order) of
+    strings
+  LC_MESSAGES= locale data configuration for translation of messages
+  LC_NUMERIC= locale data configuration for non-monetary numeric data
+  LC_MONETARY= locale data configuration for monetary data
+  LC_TIME= locale data configuration for date and time
+  LC_ALL= locale data configuration overriding all of the above
+  LANGUAGE= can be a : separated list of ISO language codes
+  LINGUAS= can be a ' ' separated list of ISO language codes
+
+  The above variables are used in /etc/profile.d/lang.sh.
+
+  If ~/.i18n exists, it is used in addition to /etc/locale.conf and
+  for per-user customization of the locales.
+
+/etc/vconsole.conf:
+
+  SYSFONT= Console font. Fonts are found in /usr/lib/kbd/consolefonts.
+
+  UNIMAP= Unicode font map. Most fonts have these built-in. Font maps
+  can be found in /usr/lib/kbd/unimaps. These are applied via setfont's
+  -u option.
+ 
+  SYSFONTACM= Console map. These are applied via setfont's -m option,
+  and are found in /usr/lib/kbd/consoletrans.
+ 
+  The above are used to set up the keyboard at boot time. For more
+  information, see vconsole.conf(5).
+
 Files in /etc/sysconfig/network-scripts/
 ========================================
 
@@ -429,18 +483,8 @@ Files in /etc/sysconfig/network-scripts/
       Most important for PPP.  Only used in front ends.
     DEVICE=<name of physical device (except dynamically-allocated PPP
       devices where it is the "logical name")>
-    IPADDRn=
-    PREFIXn=
-      Network prefix.  It is used for all configurations except aliases
-      and ippp devices.  It takes precedence over NETMASK when both
-      PREFIX and NETMASK are set.
-    NETMASKn=
-      Subnet mask; just useful for aliases and ippp devices.  For all other
-      configurations, use PREFIX instead.
-
-    The "n" is expected to be consecutive positive integers starting from 0.
-    It can be omitted if there is only one address being configured.
-
+    IPADDR=
+    NETMASK=
     GATEWAY=
     METRIC=
       Metric for the default route using GATEWAY
@@ -466,6 +510,11 @@ Files in /etc/sysconfig/network-scripts/
       configured IP address.
     SRCADDR=
       use the specified source address for outgoing packets
+    MII_NOT_SUPPORTED=
+      if set don't try to use ifstatus to detect if the link is up.
+    METRIC=
+      if set, assign the route associated with this interface to this
+    metric using ifmetric.
     HWADDR=
       ethernet hardware address for this device
     MACADDR=
@@ -543,6 +592,48 @@ Files in /etc/sysconfig/network-scripts/
       where $IPV6_AUTOCONF is set to `yes`. Defaults to `yes`, set to `no` if you
       want to manage these yourself.
 
+  You can specify which dhcp client to use with the DHCP_CLIENT, if
+  the DHCP_CLIENT is not specified we trying to launch in order :
+      /sbin/dhclient
+      /sbin/dhcpcd
+      /sbin/pump
+      /sbin/dhcpxd
+  if you have a preferred client define the DHCP_CLIENT variable.
+  When you use dhclient (which it is the default on a Mandrake-Linux
+  system) you can specify a timeout of waiting the answer from server,
+  the option is called DHCP_TIMEOUT the default is 60 sec.
+
+  Mageia specific items for DHCP clients:
+    DHCP_HOSTNAME=
+      This option specifies the hostname to request to the DHCP server.
+      The name  may  or  may not  be qualified with the local domain name.
+    NEEDHOSTNAME=yes|no
+      If set to 'yes', set hostname to the host-name option supplied
+      by the DHCP server.
+    PEERDNS=yes|no
+      If set to 'no', do not modify /etc/resolv.conf
+    PEERGATEWAY=yes|no
+      If set to 'no', do not add the gateway provided by DHCP server
+      in the routing table (does not work with dhcpxd).
+    PEERYP=yes|no
+      If set to 'yes', update /etc/yp.conf (specific to dhcpcd)
+    PEERNTPD=yes|no
+      If set to 'yes', update /etc/ntp.conf (specific to dhcpcd)
+    DOMAINNAME=
+      If specified and DHCP_HOSTNAME is not empty, strip DOMAINNAME
+      value in DHCP_HOSTNAME.
+      If empty and dhcpd is used, set the host domainname to the
+      domainname option supplied by DHCP server.
+    DHCP_TIMEOUT=
+      If not empty, this option specifies (in  seconds) for how long
+      the DHCP client will try to get an IP address after its initial request
+      (specific to dhclient and dhcpcd, default is 60 seconds)
+
+  Mageia items:
+    LINK_DETECTION_DELAY=<time in seconds>
+      Delay after which a lack of link beat will be considered to
+      result from an unplugged interface, rather than just down
+
   Base items being deprecated:
     NETWORK=<will be calculated automatically with ipcalc>
     BROADCAST=<will be calculated automatically with ipcalc>
@@ -644,8 +735,8 @@ Files in /etc/sysconfig/network-scripts/
 
    IPv6-only option to enable DHCPv6 client:
       DHCPV6C=yes|no
-      This will enable the DHCPv6 features of dhclient to be run for the interface.
-      See man dhclient(8) and dhclient.conf(5).
+      This will enable the DHCPv6 client, dhcp6c, to be run for the interface.
+      See man dhcp6c(8) and dhcp6c.conf(5).
       DHCPV6C_OPTIONS=...
       This will pass given arguments to the DHCPv6 client.  For example,
       "-S" option will request network information (e.g., DNS addresses)
@@ -690,7 +781,8 @@ Files in /etc/sysconfig/network-scripts/
 
   Ethernet 802.1q VLAN items:
      DEVICE=eth0.42
-       Initscripts use the device name for VLAN devices.
+       Initscripts use DEV_PLUS_VID_NO_PAD naming mode for VLAN
+       devices.
                Example: eth0.42 for vlan 42 on device eth0.
        Valid VLAN ID range is 0-4095. Most ethernet switches reserve
        VLAN ID 1 to be used as management VLAN; starting from VLAN
@@ -951,6 +1043,12 @@ Files in /etc/sysconfig/network-scripts/
 
   Bring up aliases for a device.
 
+/etc/sysconfig/network-scripts/ifdhcpc-done
+
+  Called by dhcpcd once dhcp configuration is complete; sets
+  up /etc/resolv.conf from the version dhcpcd dropped in
+  /etc/dhcpc/resolv.conf
+
 /etc/sysconfig/network-scripts/route-<interface-name>
 
   Contains lines that specify additional routes that should be added when the
diff --git a/etc/rc.d/init.d/functions b/etc/rc.d/init.d/functions
old mode 100644
new mode 100755
index 9e33ee06..d8fbf265
--- a/etc/rc.d/init.d/functions
+++ b/etc/rc.d/init.d/functions
@@ -6,6 +6,10 @@
 
 TEXTDOMAIN=initscripts
 
+TMP=/tmp
+TMPDIR=/tmp
+export TMP TMPDIR
+
 # Make sure umask is sane
 umask 022
 
@@ -55,9 +59,17 @@ systemctl_redirect () {
     action "$s" /bin/systemctl $options $command "$prog.service"
 }
 
-# Get a sane screen width
+# Get a sane screen width, and default to 80 when exact info not available
+[ -z "${COLUMNS:-}" ] && COLUMNS=`stty -a 2>/dev/null | sed -n 's/.*columns \([0-9]*\);.*/\1/p'`
 [ -z "${COLUMNS:-}" ] && COLUMNS=80
 
+if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && \
+        [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then
+    . /etc/profile.d/lang.sh 2>/dev/null
+    # avoid propagating LANGSH_SOURCED any further
+    unset LANGSH_SOURCED
+fi
+
 # Read in our configuration
 if [ -z "${BOOTUP:-}" ]; then
     if [ -f /etc/sysconfig/init ]; then
@@ -96,6 +108,62 @@ if [ -z "${BOOTUP:-}" ]; then
     fi
 fi
 
+gprintf() {
+    if [ -x /bin/gettext ] && [ -n "$1" ]; then
+        if [ -n "$GP_LANG" ]; then
+            local TEXT=$(LC_ALL=$GP_LANG LANGUAGE=$GP_LANGUAGE gettext -e --domain=$TEXTDOMAIN -- "$1")
+        else
+            local TEXT=$(gettext -e --domain=$TEXTDOMAIN -- "$1")
+        fi
+    else
+        local TEXT=$1
+    fi
+    [ "${1#*\\n}" ] || TEXT="$TEXT\n"
+
+    shift
+    printf -- "$TEXT" "$@"
+}
+
+# Frontend to gprintf (support up to 4 %s in format string)
+# returns the message transleted in GPRINTF_MSG and
+# the resting parms in GPRINTF_REST
+# This simplifies a lot the call of functions like action,
+# now with i18n support
+gprintf_msg_rest() {
+    case "$1" in
+        *%s*%s*%s*%s*)
+            GPRINTF_MSG=$(gprintf "$1" "$2" "$3" "$4" "$5")
+            shift 5;;
+        *%s*%s*%s*)
+            GPRINTF_MSG=$(gprintf "$1" "$2" "$3" "$4")
+            shift 4;;
+        *%s*%s*)
+            GPRINTF_MSG=$(gprintf "$1" "$2" "$3")
+            shift 3;;
+        *%s*)
+            GPRINTF_MSG=$(gprintf "$1" "$2")
+            shift 2;;
+        *)
+            GPRINTF_MSG=$(gprintf "$1")
+            # function may be called without any arguments, e.g. for 'success'
+            [ $# -ne 0 ] && shift
+            ;;
+    esac
+    GPRINTF_REST="$@"
+}
+
+# Check if $pid (could be plural) are running with
+# the same root as this script
+inmyroot() {
+	local i r
+
+	for i in $* ; do
+		[ "/proc/$i/root" -ef "/proc/$$/root" ] && r="$r $i"
+	done
+	echo "$r"
+}
+
+
 # Check if any of $pid (could be plural) are running
 checkpid() {
     local i
@@ -559,6 +627,7 @@ update_boot_stage() {
 
 # Log that something succeeded
 success() {
+    gprintf_msg_rest "$@"
     [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
     return 0
 }
@@ -566,6 +635,7 @@ success() {
 # Log that something failed
 failure() {
     local rc=$?
+    gprintf_msg_rest "$@"
     [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure
     [ -x /bin/plymouth ] && /bin/plymouth --details
     return $rc
@@ -574,6 +644,7 @@ failure() {
 # Log that something passed, but may have had errors. Useful for fsck
 passed() {
     local rc=$?
+    gprintf_msg_rest "$@"
     [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed
     return $rc
 }
@@ -581,6 +652,7 @@ passed() {
 # Log a warning
 warning() {
     local rc=$?
+    gprintf_msg_rest "$@"
     [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning
     return $rc
 }
@@ -588,11 +660,10 @@ warning() {
 # Run some action. Log its output.
 action() {
     local STRING rc
+    gprintf_msg_rest "$@"
+    echo -n "$GPRINTF_MSG "
 
-    STRING=$1
-    echo -n "$STRING "
-    shift
-    "$@" && success $"$STRING" || failure $"$STRING"
+    $GPRINTF_REST && success "$GPRINTF_MSG" || failure "$GPRINTF_MSG"
     rc=$?
     echo
     return $rc
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
index bc5c1502..03b29b85 100755
--- a/etc/rc.d/init.d/network
+++ b/etc/rc.d/init.d/network
@@ -5,10 +5,13 @@
 # chkconfig: - 10 90
 # description: Activates/Deactivates all network interfaces configured to \
 #              start at boot time.
+# probe: false
 #
 ### BEGIN INIT INFO
-# Provides: $network
-# Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager $network-pre
+# Provides: network
+# Should-Start: irda resolvconf iptables ip6tables NetworkManager-wait-online NetworkManager
+# Should-Stop: irda resolvconf
+# Default-Start: 2 3 4 5
 # Short-Description: Bring up/down networking
 # Description: Bring up/down networking
 ### END INIT INFO
@@ -17,6 +20,7 @@
 . /etc/init.d/functions
 
 if [ ! -f /etc/sysconfig/network ]; then
+    echo "NETWORKING=no" > /etc/sysconfig/network
     exit 6
 fi
 
@@ -44,9 +48,10 @@ cd /etc/sysconfig/network-scripts
 interfaces=$(ls ifcfg-* | \
         LC_ALL=C sed -e "$__sed_discard_ignored_files" \
                -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
-               -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \
+               -e '/ifcfg-[ A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
+        LC_ALL=C grep -v '^ifcfg-' | \
         LC_ALL=C sort -k 1,1 -k 2n | \
-        LC_ALL=C sed 's/ //')
+        LC_ALL=C sed -e 's/ \([0-9]\)/\1/')
 rc=0
 
 net_log $"You are using 'network' service provided by 'network-scripts', which are now deprecated." warning network >&2
diff --git a/mageia/etc/X11/xsetup.d/.keep b/mageia/etc/X11/xsetup.d/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/etc/modprobe.preload.d/.keep b/mageia/etc/modprobe.preload.d/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/etc/modules b/mageia/etc/modules
new file mode 100644
index 00000000..600a93e0
--- /dev/null
+++ b/mageia/etc/modules
@@ -0,0 +1,6 @@
+# /etc/modules: kernel modules to load at boot time.
+#
+# This file should contain the names of kernel modules that are
+# to be loaded at boot time, one per line.  Comments begin with
+# a `#', and everything on the line after them are ignored.
+
diff --git a/mageia/etc/profile.d/10inputrc.csh b/mageia/etc/profile.d/10inputrc.csh
new file mode 100644
index 00000000..f520f800
--- /dev/null
+++ b/mageia/etc/profile.d/10inputrc.csh
@@ -0,0 +1,25 @@
+# but tcsh command line doesn't use inputrc, so we have to define the
+# keys here:
+bindkey "\e[3~" delete-char
+bindkey "^[[^@" beginning-of-line
+bindkey "[5~" down-history
+bindkey "[6~" up-history
+bindkey "\e[1~" beginning-of-line
+bindkey "\e[4~" end-of-line
+bindkey "\e\C-h" backward-delete-word
+bindkey "\e\C-?" delete-word
+bindkey "\e\e[3~" delete-word
+# rxvt
+bindkey "\e[7~" beginning-of-line
+bindkey "\e[8~" end-of-line
+# some xterms
+bindkey "\e[H" beginning-of-line
+bindkey "\e[F" end-of-line
+# nxterms
+bindkey "\e[\C-@" beginning-of-line
+bindkey "\e[e" end-of-line
+# some more X11 oddity
+bindkey "\eOD" backward-char
+bindkey "\eOC" forward-char
+bindkey "\eOB" down-history
+bindkey "\eOA" up-history
diff --git a/mageia/etc/profile.d/10tmpdir.csh b/mageia/etc/profile.d/10tmpdir.csh
new file mode 100644
index 00000000..c0deecab
--- /dev/null
+++ b/mageia/etc/profile.d/10tmpdir.csh
@@ -0,0 +1,25 @@
+# $Id$
+# Set TMPDIR and TMP
+
+if (-f /etc/security/shell) then
+    eval `cat /etc/security/shell | grep -v ^# | sed -re 's/^([^=]+=)/set \1/'`
+endif
+
+if ($?SECURE_TMP) then
+    if ($SECURE_TMP == "yes") then
+        if ( -d ${HOME}/tmp && -w ${HOME}/tmp ) then
+            setenv TMPDIR ${HOME}/tmp
+            setenv TMP ${HOME}/tmp
+            exit
+        endif
+
+        if ( { mkdir -p ${HOME}/tmp >&! /dev/null } ) then 
+            setenv TMPDIR ${HOME}/tmp
+            setenv TMP ${HOME}/tmp
+            exit
+        endif
+    endif
+endif
+
+setenv TMPDIR /tmp
+setenv TMP /tmp
diff --git a/mageia/etc/profile.d/10tmpdir.sh b/mageia/etc/profile.d/10tmpdir.sh
new file mode 100644
index 00000000..87d984e8
--- /dev/null
+++ b/mageia/etc/profile.d/10tmpdir.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# $Id$
+# Set TMPDIR to ~/tmp and create it if directory not exist.
+
+if [ -z "$SECSHELL" -a -r /etc/security/shell ]; then
+    . /etc/security/shell
+    export SECSHELL=1
+fi
+
+if [[ "$SECURE_TMP" = "yes" ]];then
+    if [ -d ${HOME}/tmp -a -w ${HOME}/tmp ];then
+        export TMPDIR=${HOME}/tmp
+        export TMP=${HOME}/tmp
+    elif mkdir -p ${HOME}/tmp >/dev/null 2>&1;then
+        chmod 700 ${HOME}/tmp
+        export TMPDIR=${HOME}/tmp
+        export TMP=${HOME}/tmp
+    else
+        export TMPDIR=/tmp
+        export TMP=/tmp
+    fi
+else
+    export TMPDIR=/tmp
+    export TMP=/tmp
+fi
diff --git a/mageia/etc/profile.d/lang.csh b/mageia/etc/profile.d/lang.csh
new file mode 100755
index 00000000..f53290e9
--- /dev/null
+++ b/mageia/etc/profile.d/lang.csh
@@ -0,0 +1,129 @@
+# /etc/profile.d/lang.csh - set i18n stuff
+
+if (! $?LC_SOURCED) then
+    set LC_SOURCED=0
+endif
+
+foreach file ("$HOME/.i18n" /etc/locale.conf /etc/sysconfig/i18n)
+	if ($LC_SOURCED != 1 && -f $file ) then
+	    eval `sed 's|=C$|=en_US|g' $file | sed 's|^#.*||' | sed 's|\([^=]*\)=\([^=]*\)|setenv \1 \2|g' | sed 's|$|;|' `
+	    setenv LC_SOURCED 1
+	endif
+end
+
+if ($LC_SOURCED == 1) then
+    if ($?LC_ALL && $?LANG) then
+        if ($LC_ALL == $LANG) then
+            unsetenv LC_ALL
+        endif
+    endif
+    
+    set consoletype=`/sbin/consoletype stdout 2> /dev/null`
+
+    if ($?CHARSET) then
+        switch ($CHARSET)
+            case 8859-1:
+            case 8859-2:
+            case 8859-5:
+	    case 8859-8:
+            case 8859-15:
+            case KOI*:
+            case LATIN2*:
+                if ( $?TERM ) then
+                    if ( "$TERM" == "linux" ) then
+                        if ( "$consoletype" == "vt" ) then
+                            /bin/echo -n -e '\033(K' >/dev/tty
+                        endif
+                    endif
+                endif
+                breaksw
+	endsw
+    endif
+    if ($?SYSFONTACM) then
+        switch ($SYSFONTACM)
+	    case iso01*:
+	    case iso02*:
+	    case iso05*:
+	    case iso08*:
+	    case iso15*:
+	    case koi*:
+	    case latin2-ucw*:
+	        if ( $?TERM ) then
+		    if ( "$TERM" == "linux" ) then
+		        if ( "$consoletype" == "vt" ) then
+			    /bin/echo -n -e '\033(K' > /dev/tty
+		        endif
+		    endif
+		endif
+		breaksw
+	endsw
+    endif
+    if ($?LANG) then
+        switch ($LANG)
+	    case *.utf8*:
+	    case *.UTF-8*:
+		if ( $?TERM ) then
+		    if ( "$TERM" == "linux" ) then
+			if ( "$consoletype" == "vt" ) then
+			    switch ($LANG)
+			    	case en_IN*:
+			    		breaksw
+			    	case ja*:
+			    	case ko*:
+			    	case si*:
+			    	case zh*:
+			    	case ar*:
+			    	case fa*:
+			    	case he*:
+			    	case *_IN*:
+			    		setenv LANG en_US.UTF-8
+			    		breaksw
+			    endsw
+			    if ( -x /bin/unicode_start ) then
+			      if { /sbin/consoletype fg 2> /dev/null } then
+			        if ( $?SYSFONT ) then
+			          if ( $?SYSFONTACM ) then
+			            unicode_start $SYSFONT $SYSFONTACM
+			          else
+			            unicode_start $SYSFONT
+			          endif
+			        endif
+			      endif
+			    endif
+			endif
+		    endif
+		endif
+		breaksw
+	    case *:
+		if ( $?TERM ) then
+		    if ( "$TERM" == "linux" ) then
+			if ( "$consoletype" == "vt" ) then
+			    switch ($LANG)
+			    	case en_IN*:
+			    		breaksw
+			    	case ja*:
+			    	case ko*:
+			    	case si*:
+			    	case zh*:
+			    	case ar*:
+			    	case fa*:
+			    	case he*:
+			    	case *_IN*:
+			    		setenv LANG en_US
+			    		breaksw
+			    endsw
+			    if ( -x /bin/unicode_stop ) then
+                              if { /sbin/consoletype fg 2> /dev/null } then
+                                /bin/unicode_stop
+                              endif
+                            endif
+			endif
+		    endif
+		endif
+		breaksw
+	endsw
+    endif    
+    unsetenv SYSFONTACM
+    unsetenv SYSFONT
+    unset consoletype
+endif
diff --git a/mageia/etc/profile.d/lang.sh b/mageia/etc/profile.d/lang.sh
new file mode 100755
index 00000000..59cdcf17
--- /dev/null
+++ b/mageia/etc/profile.d/lang.sh
@@ -0,0 +1,157 @@
+# /etc/profile.d/lang.sh - set i18n stuff
+
+# revert special console/X11 settings if needed
+if [ "$LC_SOURCED_CONSOLE" = 1 -a -n "$DISPLAY" ]; then
+	unset LC_SOURCED
+	unset LC_SOURCED_CONSOLE
+elif [ "$LC_SOURCED_X11" = 1 -a -z "$DISPLAY" ]; then
+	unset LC_SOURCED
+	unset LC_SOURCED_X11
+fi
+
+# only source one of the possible files, and in that order;
+# if system wide and user config are mixed and different, umpredictable
+# things will happen...
+for langfile in "$HOME/.i18n" /etc/locale.conf /etc/sysconfig/i18n ; do
+	[ -f $langfile -a "$LC_SOURCED" != 1 ] && . $langfile && LC_SOURCED=1 && export LC_SOURCED
+done    
+
+if [ "$LC_SOURCED" = 1 ]; then
+    if [ -n "$LANG" ] ; then
+       [ "$LANG" = "C" ] && LANG="en_US"
+       export LANG
+    else
+       unset LANG
+    fi
+    [ -n "$LANG" ] && export LANG || unset LANG
+    [ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
+    [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
+    [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
+    [ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION
+    [ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT
+    [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
+    [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
+    [ -n "$LC_NAME" ] && export LC_NAME || unset LC_NAME
+    [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
+    [ -n "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER
+    [ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE
+    [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
+    if [ -n "$LC_ALL" ]; then
+       if [ "$LC_ALL" != "$LANG" ]; then
+         export LC_ALL
+       else
+         unset LC_ALL
+       fi
+    else
+       unset LC_ALL
+    fi
+    [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
+    [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
+    
+    if [ -n "$RPM_INSTALL_LANG" ]; then
+       export RPM_INSTALL_LANG
+    else
+       unset RPM_INSTALL_LANG
+    fi
+
+    # XIM and keyboard stuff
+    [ -n "$ENC" ] && export ENC || unset ENC
+    [ -n "$XIM" ] && export XIM || unset XIM
+    [ -n "$XIM_PROGRAM" ] && export XIM_PROGRAM || unset XIM_PROGRAM
+    [ -n "$XMODIFIERS" ] && export XMODIFIERS || unset XMODIFIERS
+    [ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET
+    [ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE || unset GTK_IM_MODULE
+    [ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE || unset QT_IM_MODULE
+    
+    consoletype=$CONSOLETYPE
+    if [ -z "$consoletype" ]; then
+      consoletype=$(/sbin/consoletype stdout 2> /dev/null)
+    fi
+
+    if [ -n "$CHARSET" ]; then
+	case $CHARSET in
+	    8859-1|8859-2|8859-5|8859-8|8859-15|KOI*)
+                if [ "$TERM" = "linux" && tty | grep --quiet -e '/dev/tty'; then
+                       echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0
+                fi
+                ;;
+        esac
+    elif [ -n "$SYSFONTACM" ]; then
+	case $SYSFONTACM in
+	    iso01*|iso02*|iso05*|iso08*|iso15*|koi*|latin2-ucw*)
+		if [ "$TERM" = "linux" && tty | grep --quiet -e '/dev/tty'; then
+			echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0
+		fi
+		;;
+	esac
+    fi
+    if [ -n "$LANG" ]; then
+      case $LANG in
+    	*.utf8*|*.UTF-8*)
+    	if [ "$TERM" = "linux" ]; then
+    	    if [ "$consoletype" = "vt" ]; then
+		if [ -x /bin/unicode_start ] && /sbin/consoletype fg 2> /dev/null ; then
+			for langfile in /etc/sysconfig/i18n "$HOME/.i18n" ; do
+				[ -f $langfile ] && . $langfile
+			done
+			/bin/unicode_start $SYSFONT $SYSFONTACM
+		fi
+    	    	case $LANG in 
+    	    		ja*) LANG=en_US.UTF-8 ;;
+    	    		ko*) LANG=en_US.UTF-8 ;;
+			si*) LANG=en_US.UTF-8 ;;
+    	    		zh*) LANG=en_US.UTF-8 ;;
+    	    		ar*) LANG=en_US.UTF-8 ;;
+    	    		fa*) LANG=en_US.UTF-8 ;;
+    	    		he*) LANG=en_US.UTF-8 ;;
+    	    		en_IN*) ;;
+    	    		*_IN*) LANG=en_US.UTF-8 ;;
+    	    	esac
+            fi
+        fi
+	;;
+	*)
+	if [ "$TERM" = "linux" ]; then
+	    if [ "$consoletype" = "vt" ]; then
+    	    	case $LANG in 
+    	    		ja*) LANG=en_US ;;
+    	    		ko*) LANG=en_US ;;
+			si*) LANG=en_US ;;
+    	    		zh*) LANG=en_US ;;
+    	    		ar*) LANG=en_US ;;
+    	    		fa*) LANG=en_US ;;
+    	    		he*) LANG=en_US ;;
+    	    		en_IN*) ;;
+    	    		*_IN*) LANG=en_US ;;
+    	    	esac
+		[ -x /bin/unicode_stop ] && /sbin/consoletype fg 2> /dev/null && /bin/unicode_stop
+	    fi
+	fi
+	;;
+      esac
+    fi
+
+    # handling of special cases where localization is done
+    # only on console or only on X11.
+    # when launching an xdm-like program we are not yet in X11 (so
+    # $DISPLAY is not defined) but obviously we will, so we check
+    # also $DESKTOP which is defined before calling xdm-like program
+    if [ -n "$DISPLAY" ]; then
+	if [ "$X11_NOT_LOCALIZED" = "yes" ]; then
+		LANGUAGE=C
+		LC_SOURCED_X11=1
+		export LC_SOURCED_X11
+	fi
+    elif [ -z "$DESKTOP" ]; then
+	if [ "$CONSOLE_NOT_LOCALIZED" = "yes" ]; then
+		LANGUAGE=C
+		LC_SOURCED_CONSOLE=1
+		export LC_SOURCED_CONSOLE
+	fi
+    fi
+    
+    [ -n "$LANGUAGE" ] && export LANGUAGE
+    unset consoletype
+
+fi
+unset langfile
diff --git a/mageia/etc/rc.d/init.d/network-auth b/mageia/etc/rc.d/init.d/network-auth
new file mode 100755
index 00000000..1509940b
--- /dev/null
+++ b/mageia/etc/rc.d/init.d/network-auth
@@ -0,0 +1,28 @@
+#! /bin/bash
+#
+### BEGIN INIT INFO
+# Provides: $named network-auth
+# Required-Start: $network
+# Required-Stop: $network
+# Should-Start: ypbind winbind ldap
+# X-Start-Before: systemd-user-sessions
+# Default-Start: 2 3 4 5
+# Short-Description: Requires network to be up if enabled
+# Description: Requires network to be up if enabled.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+
+case "$1" in
+  start)
+	;;
+  stop)
+	;;
+  *)
+        gprintf "Usage: %s\n" "$(basename "$0") {start|stop}"
+        exit 1
+esac
+
+exit 0
diff --git a/mageia/etc/rc.d/init.d/network-up b/mageia/etc/rc.d/init.d/network-up
new file mode 100755
index 00000000..2ac8f514
--- /dev/null
+++ b/mageia/etc/rc.d/init.d/network-up
@@ -0,0 +1,188 @@
+#! /bin/bash
+#
+### BEGIN INIT INFO
+# Provides: $network $named
+# Should-Start: portreserve NetworkManager
+# Default-Start: 2 3 4 5
+# Short-Description: Wait for the hotplugged network to be up
+# Description: Wait for all network interfaces started asynchronously
+#              at boot time.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+NETWORKDELAY=20
+DEFAULT_LINK_DETECTION_DELAY=2
+MIN_LINK_DETECTION_DELAY=0
+MAX_LINK_DETECTION_DELAY=$MIN_LINK_DETECTION_DELAY
+ELAPSED_TIME=0
+RESOLVCONF_FLAGFILE=/run/resolvconf/enable-updates
+RESOLVCONF_DIR=/run/resolvconf/interface
+
+# source network configuration
+. /etc/sysconfig/network
+
+# Check that networking is up.
+is_false "${NETWORKING}" && exit 0
+cd /etc/sysconfig/network-scripts
+
+. network-functions
+
+# find all the interfaces besides loopback.
+# ignore aliases, alternative configurations, and editor backup files
+interfaces=$(/bin/ls ifcfg* | \
+	    LC_ALL=C sed -e "$__sed_discard_ignored_files" \
+		       -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
+		       -e '/ifcfg-[ A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
+	    LC_ALL=C grep -v '^ifcfg-' | \
+	    LC_ALL=C sort -k 1,1 -k 2n | \
+	    LC_ALL=C sed -e 's/ \([0-9]\)/\1/')
+
+function may_have_link() {
+    local DEVICE=$1
+    local LINKDELAY=0
+    ! check_link_down "${DEVICE}" || is_associating "${DEVICE}"
+}
+
+function is_associating() {
+    local DEVICE=$1
+    is_wireless_device "${DEVICE}" || return 1
+    local AP=$(iwgetid -a -r "${DEVICE}" 2>/dev/null)
+    [ -n "$AP" ] && [ "$AP" != "00:00:00:00:00:00" ] && [ "$AP" != "44:44:44:44:44:44" ] && [ "$AP" != "FF:FF:FF:FF:FF:FF" ]
+}
+
+function should_wait_network() {
+    for i in $interfaces; do
+        unset DEVICE TYPE BOOTPROTO MII_NOT_SUPPORTED PEERDNS DNS1 DNS2
+	unset REALDEVICE PARENTDEVICE NM_CONTROLLED
+        LINK_DETECTION_DELAY=$DEFAULT_LINK_DETECTION_DELAY
+        eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i")
+        eval $(LANG=C grep -F "REALDEVICE=" "ifcfg-$i")
+        eval $(LANG=C grep -F "PARENTDEVICE=" "ifcfg-$i")
+        eval $(LANG=C grep -F "TYPE=" "ifcfg-$i")
+        eval $(LANG=C grep -F "BOOTPROTO=" "ifcfg-$i")
+        eval $(LANG=C grep -F "MII_NOT_SUPPORTED=" "ifcfg-$i")
+        eval $(LANG=C grep -F "LINK_DETECTION_DELAY=" "ifcfg-$i")
+        eval $(LANG=C grep -F "PEERDNS=" "ifcfg-$i")
+        eval $(LANG=C grep -F "DNS1=" "ifcfg-$i")
+        eval $(LANG=C grep -F "DNS2=" "ifcfg-$i")
+        eval $(LANG=C grep -F "NM_CONTROLLED=" "ifcfg-$i")
+	[ -z "$REALDEVICE" ] && [ -n "$PARENTDEVICE" ] && REALDEVICE=$PARENTDEVICE
+	[ -z "$REALDEVICE" ] && REALDEVICE=${DEVICE%%:*}
+        if [ $LINK_DETECTION_DELAY -lt $MIN_LINK_DETECTION_DELAY ]; then
+            LINK_DETECTION_DELAY=$MIN_LINK_DETECTION_DELAY
+        fi
+
+        if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
+        if [ "$BOOTPROTO" != "static" ] \
+            && [ "$BOOTPROTO" != "dhcp" ] \
+            && [ "$BOOTPROTO" != "bootp" ]; then
+            continue
+        fi
+
+        # Ignore Wifi network files created by NetworkManager
+        if [ "$TYPE" = "Wireless" ]; then
+          continue
+        fi
+
+        # only check interfaces using ifplug, other interfaces are
+        # started synchronously from the network service
+        if is_true "$MII_NOT_SUPPORTED"; then
+            continue
+        fi
+
+        # only check interfaces automatically launched
+        if LANG=C grep -q -E "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i"; then
+            continue
+        fi
+
+        # ignore devices that are not present
+        ip -o link show "${DEVICE}" &>/dev/null || continue
+
+        ! is_false "$NM_CONTROLLED" && is_nm_running && _use_nm=true
+        # for NM controlled just ask NetworkManager
+        if [ "$_use_nm" = "true" ]; then
+            # Ignore disabled wifi h/w
+            if is_nm_device_unavailable "${DEVICE}"; then
+                # Question: Is NM cleverer than us here? Does it do this delay
+                # internally and mark it as disconnected until it knows better?
+
+                # before configured delay, consider a lack of link beat
+                # as not ready, and unplugged thereafter
+                if [ $ELAPSED_TIME -lt $LINK_DETECTION_DELAY ]; then
+                    return 0
+                fi
+                # no need to wait for unplugged devices to come up
+                continue
+            fi
+
+            is_nm_active "${DEVICE}" || return 0
+
+            # The resolvconf check below uses a single generic "NetworkManager"
+            # DNS file, rather than device specific ones, so fudge the device.
+            DEVICE=NetworkManager
+        else
+            # check link beat
+            if ! may_have_link ${DEVICE}; then
+                # before configured delay, consider a lack of link beat
+                # as not ready, and unplugged thereafter
+                if [ $ELAPSED_TIME -lt $LINK_DETECTION_DELAY ]; then
+                    return 0
+                fi
+                # no need to wait for unplugged devices to come up
+                continue
+            fi
+
+            # check address is set
+	    ADDR=$(ip addr show scope global "${DEVICE}" | awk '/inet/ {print $2;}')
+            if [ -z "$ADDR" ]; then
+                return 0
+            fi
+        fi
+
+        # wait for changes to be propagated by resolvconf if needed
+        if [ -e $RESOLVCONF_FLAGFILE ]; then
+            if [ "$BOOTPROTO" = "dhcp" ] && ! is_false "$PEERDNS" \
+                || [ -n "$DNS1" ] || [ -n "$DNS2" ]; then
+                if [ ! -e $RESOLVCONF_DIR/$DEVICE ]; then
+                    return 0
+                fi
+                if [ $RESOLVCONF_DIR/$DEVICE -nt /etc/resolv.conf ]; then
+                    return 0
+                fi
+            fi
+        fi
+    done
+    # all interfaces are ready
+    return 1
+}
+
+case "$1" in
+  start)
+    gprintf "Waiting for network to be up"
+
+    for i in $interfaces; do
+        LINK_DETECTION_DELAY=$DEFAULT_LINK_DETECTION_DELAY
+        eval $(LANG=C grep -F "LINK_DETECTION_DELAY=" "ifcfg-$i")
+        if [ "$LINK_DETECTION_DELAY" -gt $MAX_LINK_DETECTION_DELAY ]; then
+            MAX_LINK_DETECTION_DELAY=$LINK_DETECTION_DELAY
+        fi
+    done
+    NETWORKDELAY=$(( NETWORKDELAY + MAX_LINK_DETECTION_DELAY ))
+
+    while should_wait_network && [ $ELAPSED_TIME -lt $NETWORKDELAY ]; do
+        sleep 1
+        (( ELAPSED_TIME++ ))
+    done
+    [ $ELAPSED_TIME -ge $NETWORKDELAY ] && failure || success
+    echo
+    ;;
+  stop)
+      ;;
+  *)
+        gprintf "Usage: %s\n" "$(basename "$0") {start|stop}"
+        exit 1
+esac
+
+exit 0
diff --git a/mageia/etc/rc.d/init.d/partmon b/mageia/etc/rc.d/init.d/partmon
new file mode 100644
index 00000000..0c893020
--- /dev/null
+++ b/mageia/etc/rc.d/init.d/partmon
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Checks if a partition is close to full up
+#
+# description: Checks if a partition is close to full up
+# chkconfig: 345 13 20
+#
+### BEGIN INIT INFO
+# Provides: partmon
+# Default-Start: 3 4 5
+# Short-Description: Checks if a partition is close to full up
+# Description: Checks if a partition is close to full up
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# The following file prevents from "starting" again when changing
+# runlevel
+SYSCONF_FILE=/var/lock/subsys/partmon
+
+# See how we were called.
+case "$1" in
+  start)
+	gprintf "Checking if partitions have enough free diskspace: "
+	str=$(/usr/bin/partmon)
+	if [ "$str" = "" ]; then
+	    echo_success
+	    touch $SYSCONF_FILE
+	else
+	    echo            # to start to print problems at column 0
+	    echo "$str"
+	    echo_failure
+	    echo
+	    exit 1
+	fi
+	echo
+	;;
+  stop)
+	rm -f $SYSCONF_FILE
+	;;
+  status)
+	if [ -f $SYSCONF_FILE ]
+	then
+		gprintf "partmon has been started"
+	else
+		gprintf "partmon has not been started, or check gave a failure"
+	fi
+	;;
+  restart)
+	$0 stop
+	$0 start
+	;;
+  *)
+	gprintf "Usage: %s\n" "$0 {start|stop|restart|status}"
+	exit 1
+esac
+
+exit 0
diff --git a/mageia/etc/rc.modules b/mageia/etc/rc.modules
new file mode 100644
index 00000000..fadc9804
--- /dev/null
+++ b/mageia/etc/rc.modules
@@ -0,0 +1,44 @@
+#!/bin/sh
+# (c) Mandriva, Chmouel Boudjnah <chmouel@mandriva.com>
+# $Id$
+# description: launch modules specified in /etc/modules inspired by a
+# Debian idea.
+
+MODULES=/etc/modprobe.preload
+MODULES_D=$MODULES.d
+
+# hardcoded from /etc/init.d/functions (to be faster and dash compliant)
+strstr() {
+  [ "${1#*$2*}" = "$1" ] && return 1
+  return 0
+}
+
+cmdline=$(cat /proc/cmdline)
+if strstr "$cmdline" modprobedebug; then
+    MODPROBE_OPTIONS="-v"
+    export MODPROBE_OPTIONS
+    gprintf "Pre-loading modules\n"
+fi
+
+echo_modules() {
+    # Loop over every line
+    while read module args
+    do
+	case "$module" in
+	    \#*|"") continue ;;
+	esac
+	echo $module
+    done
+}
+
+TOLOAD=""
+for f in $MODULES $MODULES_D/*; do
+    [ -f $f ] || continue
+    NEW=$( (cat $f; echo) | echo_modules )
+    [ -n "$NEW" ] && TOLOAD="$TOLOAD $NEW"
+done
+
+[ -z "$TOLOAD" ] && exit 0
+
+echo "Loading modules:"$TOLOAD >&2
+/sbin/modprobe -a $TOLOAD
diff --git a/mageia/etc/sysconfig/autofsck b/mageia/etc/sysconfig/autofsck
new file mode 100644
index 00000000..d0291e46
--- /dev/null
+++ b/mageia/etc/sysconfig/autofsck
@@ -0,0 +1,11 @@
+# -*- Mode: sh -*-
+# $Id$
+
+# Specify here how many seconds we wait for timeout
+AUTOFSCK_TIMEOUT=5
+
+# Specify if we do automatic fsck.
+AUTOFSCK_DEF_CHECK=no
+
+# Specify how many seconds we wait for mounting crypto.
+AUTOFSCK_CRYPTO_TIMEOUT=5
diff --git a/mageia/etc/sysconfig/partmon b/mageia/etc/sysconfig/partmon
new file mode 100644
index 00000000..622e4492
--- /dev/null
+++ b/mageia/etc/sysconfig/partmon
@@ -0,0 +1,5 @@
+/	20000
+/tmp	20000
+/usr	50000
+/var	50000
+/boot	 5000
diff --git a/mageia/network-scripts/cellular.d/.keep b/mageia/network-scripts/cellular.d/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/network-scripts/hostname.d/.keep b/mageia/network-scripts/hostname.d/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/network-scripts/ifdown-hso b/mageia/network-scripts/ifdown-hso
new file mode 100755
index 00000000..a920c17c
--- /dev/null
+++ b/mageia/network-scripts/ifdown-hso
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. /etc/init.d/functions
+
+cd /etc/sysconfig/network-scripts
+. ./network-functions
+
+CONFIG=${1}
+
+source_config
+
+[ -z "$CELLULAR_CID" ] && CELLULAR_CID=1
+[ "${DEBUG}" = "yes" ] && CHATDBG="-v"
+
+CHATSCRIPT=$(mktemp /tmp/chatXXXXXX)
+cat > "$CHATSCRIPT" <<EOF
+ABORT ERROR
+TIMEOUT 5
+"" ATZ
+OK "AT_OWANCALL=${CELLULAR_CID},0,0"
+OK ""
+EOF
+
+if ! /usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"; then
+    echo $"Disconnect script failed (HSO)"
+fi
+
+# ask status (it also waits for device state to be cleaner)
+# do not fail if status querying fail
+cat > "$CHATSCRIPT" <<EOF
+ABORT ERROR
+TIMEOUT 2
+"" ATZ
+OK "AT_OWANDATA=${CELLULAR_CID}"
+EOF
+/usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"
+
+rm -f "$CHATSCRIPT"
+
+ip addr flush dev "${DEVICE}" 2>/dev/null
+ip link set dev "${DEVICE}" down 2>/dev/null
+retcode=$?
+
+# wait up to 5 seconds for device to actually come down...
+waited=0
+while ! check_device_down "${DEVICE}" && [ "$waited" -lt 50 ] ; do
+    usleep 10000
+    (( waited++ ))
+done
+
+if [ "$retcode" = 0 ] ; then
+    /etc/sysconfig/network-scripts/ifdown-post "$CONFIG"
+    # do NOT use $? because ifdown should return whether or not
+    # the interface went down.
+fi
+
+exit $retcode
diff --git a/mageia/network-scripts/ifdown.d/vpn b/mageia/network-scripts/ifdown.d/vpn
new file mode 100755
index 00000000..f7be6435
--- /dev/null
+++ b/mageia/network-scripts/ifdown.d/vpn
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ -r "/etc/sysconfig/network-scripts/ifcfg-$1" ]; then
+    . "/etc/sysconfig/network-scripts/ifcfg-$1"
+    if [ -n "$VPN_TYPE" ] && [ -n "$VPN_NAME" ]; then
+        /usr/sbin/vpn-stop "$VPN_TYPE" "$VPN_NAME"
+    fi
+fi
diff --git a/mageia/network-scripts/ifup-hso b/mageia/network-scripts/ifup-hso
new file mode 100755
index 00000000..556ae797
--- /dev/null
+++ b/mageia/network-scripts/ifup-hso
@@ -0,0 +1,78 @@
+#! /bin/bash
+
+. /etc/init.d/functions
+
+cd /etc/sysconfig/network-scripts
+. ./network-functions
+
+CONFIG=$1
+[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
+source_config
+
+if [ "${2}" = "boot" ] && [ "${ONBOOT}" = "no" ]; then
+  exit
+fi
+
+[ -z "$CELLULAR_CID" ] && CELLULAR_CID=1
+[ "${DEBUG}" = "yes" ] && CHATDBG="-v"
+
+CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME}
+[ -f "${CHATSCRIPT}" ] || {
+  CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${PARENTDEVNAME}
+}
+[ -f "${CHATSCRIPT}" ] || {
+ echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist"
+ echo $"ifup-hso for ${DEVNAME} exiting"
+ logger -p daemon.info -t ifup-hso \
+   $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"
+ exit 1
+}
+
+CELLULAR_PIN=$(cat "pin-${DEVICE}" 2>/dev/null)
+if [ -n "$CELLULAR_PIN" ] && [ -x /usr/sbin/comgt ]; then
+    COMGTPIN=$CELLULAR_PIN comgt PIN -d "$MODEMPORT"
+fi
+
+if ! /usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"; then
+    echo $"Connect script failed"
+    exit 1
+fi
+
+CHATSCRIPT=$(mktemp /tmp/chatXXXXXX)
+CHATRESULT=$(mktemp /tmp/chatXXXXXX)
+cat > "$CHATSCRIPT" <<EOF
+ABORT ERROR
+TIMEOUT 10
+"" ATZ
+OK "AT_OWANCALL=${CELLULAR_CID},1,0"
+OK "AT_OWANDATA=${CELLULAR_CID}"
+OK ""
+EOF
+TRIES=10
+BOOTARG=$2
+
+while [ "$TRIES" -gt 0 ]; do
+    if /usr/sbin/chat ${CHATDBG} -s -V -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT" 2> "${CHATRESULT}"; then
+	DATA=$(grep ^_OWANDATA "$CHATRESULT")
+	if [ -n "$DATA" ]; then
+	    set $(echo $DATA | cut -d ',' -f 2,4,5 --output-delimiter ' ')
+	    IPADDR=$1
+	    DNS1=$2
+	    DNS2=$3
+	    break
+	fi
+    fi
+    sleep 2
+    (( TRIES-- ))
+done
+rm -f "$CHATSCRIPT" "$CHATRESULT"
+
+if [ "$TRIES" = 0 ]; then
+    echo $"Connect script failed (HSO)"
+    exit 1
+fi
+
+ifconfig "$DEVICE" "$IPADDR" up
+route add default dev "$DEVICE" "${METRIC:+metric $METRIC}"
+export DNS1 DNS2
+exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} $BOOTARG
diff --git a/mageia/network-scripts/ifup.d/vpn b/mageia/network-scripts/ifup.d/vpn
new file mode 100755
index 00000000..ccdf68dd
--- /dev/null
+++ b/mageia/network-scripts/ifup.d/vpn
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ -r "/etc/sysconfig/network-scripts/ifcfg-$1" ]; then
+    . "/etc/sysconfig/network-scripts/ifcfg-$1"
+    if [ -n "$VPN_TYPE" ] && [ -n "$VPN_NAME" ]; then
+        /usr/sbin/vpn-start "$VPN_TYPE" "$VPN_NAME"
+    fi
+fi
diff --git a/mageia/network-scripts/vpn.d/openvpn/.keep b/mageia/network-scripts/vpn.d/openvpn/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/network-scripts/vpn.d/pptp/.keep b/mageia/network-scripts/vpn.d/pptp/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/network-scripts/vpn.d/vpnc/.keep b/mageia/network-scripts/vpn.d/vpnc/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/network-scripts/wireless.d/.keep b/mageia/network-scripts/wireless.d/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/mageia/usr/bin/listhome b/mageia/usr/bin/listhome
new file mode 100644
index 00000000..733dbe08
--- /dev/null
+++ b/mageia/usr/bin/listhome
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Chmouel Boudjnah <chmouel@mandriva.com>
+# Description: List the home greather than 501 should be unusefull now, but
+# here for backward compatibilities
+
+LC_ALL=C LANG=C LANGUAGE=C \
+perl -n -e 'while(my @list=getpwent){print $list[-2], "\n" unless $list[2] <= 999}' < /etc/passwd
diff --git a/mageia/usr/bin/partmon b/mageia/usr/bin/partmon
new file mode 100644
index 00000000..d6d297b6
--- /dev/null
+++ b/mageia/usr/bin/partmon
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+#
+# Guillaume Cottenceau (gc@mandriva.com)
+#
+# Copyright 2002 Mandriva
+#
+# This software may be freely redistributed under the terms of the GNU
+# public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+#use strict;
+use MDK::Common;
+
+my ($verbose);
+
+sub free_space {
+    my ($mntpoint) = @_;
+    my ($blocksize, $size, $avail);
+    my $buf = ' ' x 20000;
+    syscall_('statfs', $mntpoint, $buf) or return;
+    (undef, $blocksize, $size, undef, $avail, undef) = unpack "L!6", $buf;
+    return $avail * ($blocksize / 1024);
+}
+
+my %partlimits = map { if_(/^(.*\S)(?:\s+?)(\d+)$/, $1 => $2 ) } cat_('/etc/sysconfig/partmon');
+
+
+my $params = join '', @ARGV;
+
+$params =~ /-h/ and die "usage: partmon [-v]\n";
+$params =~ /-v/ and $verbose = 1;
+
+
+my $ok = 1;
+foreach (cat_('/etc/fstab')) {
+    /^\s*#/ and next;
+    my (undef, $mountpoint, undef, undef, undef, undef) = split or next;  #- I want at least 6 fields to consider it a valid entry
+    member($mountpoint, keys %partlimits) or next;
+    my $free = free_space($mountpoint);
+    $verbose and print "Free space of <$mountpoint> is <$free>\n";
+    if ($free < $partlimits{$mountpoint}) {
+	print "Warning, free space for <$mountpoint> is only <", free_space($mountpoint), "> (which is inferior to <$partlimits{$mountpoint}>\n";
+	$ok = 0;
+    }
+}
+
+$ok or exit -1;
+
+
+#-------------------------------------------------
+#- $Log$
+#- Revision 1.3  2006/05/11 12:45:38  tvignaud
+#- more s/Mandrakesoft/mandriva/
+#-
+#- Revision 1.2  2002/01/15 13:45:24  chmouel
+#- Fix warnings.
+#-
+#- Revision 1.1  2002/01/15 13:44:15  chmouel
+#- Add partition monitor from GC
+#-
diff --git a/mageia/usr/lib/lsb/lsb-init-functions b/mageia/usr/lib/lsb/lsb-init-functions
new file mode 100644
index 00000000..4e11f32e
--- /dev/null
+++ b/mageia/usr/lib/lsb/lsb-init-functions
@@ -0,0 +1,52 @@
+#!/bin/sh
+# LSB compliant init functions
+
+# source standard Mandrake init functions
+. /etc/init.d/functions
+
+start_daemon() {
+    # Start daemons.
+    local force= nicelevel=
+    while [ "$1" != "${1##[-+]}" ]; do
+        case $1 in
+	  -f)
+             force="--force"
+	     shift
+             ;;
+	  -n)
+	     nicelevel=$2
+	     shift 2
+	     ;;
+        esac
+    done
+    if [ -z "$1" ]; then
+	gprintf "%s: Usage: start_daemon [-f] [-n nicelevel] {program} [args]\n" $0
+        return 1
+    fi
+    gprintf "Starting %s: " $1
+    daemon $force $nicelevel $*
+    RETVAL=$?
+    if [ $RETVAL -eq 0 ]; then
+        touch /var/lock/subsys/$1
+    fi
+    echo
+    return $RETVAL
+}
+
+# killproc is handled by the normal init.d/functions
+
+# pidofproc is handled by the normal init.d/functions
+
+log_success_msg() {
+    success
+}
+
+log_failure_msg() {
+    failure
+}
+
+log_warning_msg() {
+    echo_warning
+}
+
+
diff --git a/mageia/usr/lib/systemd/system/mandriva-everytime.service b/mageia/usr/lib/systemd/system/mandriva-everytime.service
new file mode 100644
index 00000000..85adbda5
--- /dev/null
+++ b/mageia/usr/lib/systemd/system/mandriva-everytime.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Reconfigure the system on administrator request
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=basic.target shutdown.target
+After=local-fs.target dkms-autorebuild.service
+
+[Service]
+ExecStart=-/usr/libexec/mageia_everytime
+Type=oneshot
+TimeoutSec=0
+StandardInput=tty
+RemainAfterExit=yes
+
+[Install]
+WantedBy=basic.target
diff --git a/mageia/usr/lib/systemd/system/mandriva-save-dmesg.service b/mageia/usr/lib/systemd/system/mandriva-save-dmesg.service
new file mode 100644
index 00000000..d783b228
--- /dev/null
+++ b/mageia/usr/lib/systemd/system/mandriva-save-dmesg.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Save boot dmesg content
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-udev-settle.service local-fs.target
+Before=shutdown.target
+
+[Service]
+ExecStart=-/usr/libexec/mageia-save-dmesg
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=shutdown.target
diff --git a/mageia/usr/lib/tmpfiles.d/mageia.conf b/mageia/usr/lib/tmpfiles.d/mageia.conf
new file mode 100644
index 00000000..5f0c697e
--- /dev/null
+++ b/mageia/usr/lib/tmpfiles.d/mageia.conf
@@ -0,0 +1,33 @@
+# The following was present in rc.sysinit
+
+r /fsckoptions
+r /.autofsck
+r /halt
+r /poweroff
+r /.suspended
+r /etc/killpower
+
+# The following should really go away after /run and /run/lock
+# are converted to tmpfs
+R /run/lock/cvs/*
+R /run/screen/*
+
+r /tmp/.lock.*
+r /tmp/.s.PGSQL.*
+R /tmp/hsperfdata_*
+R /tmp/kde-*
+R /tmp/ksocket-*
+R /tmp/mc-*
+R /tmp/mcop-*
+R /tmp/orbit-*
+R /tmp/ssh-*
+R /tmp/.fam_socket
+R /tmp/.esd
+R /tmp/.esd-*
+R /tmp/pulse-*
+R /tmp/.sawfish-*
+R /tmp/esrv*
+R /tmp/kio*
+R /var/lib/gdm/core.*
+
+R /tmp/gpg-*
diff --git a/mageia/usr/libexec/mageia-save-dmesg b/mageia/usr/libexec/mageia-save-dmesg
new file mode 100755
index 00000000..92562fcc
--- /dev/null
+++ b/mageia/usr/libexec/mageia-save-dmesg
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+[ -f /var/log/dmesg ] && mv -f /var/log/dmesg /var/log/dmesg.old
+dmesg -s 131072 > /var/log/dmesg
diff --git a/mageia/usr/libexec/mageia_everytime b/mageia/usr/libexec/mageia_everytime
new file mode 100755
index 00000000..76ff67e6
--- /dev/null
+++ b/mageia/usr/libexec/mageia_everytime
@@ -0,0 +1,125 @@
+#!/bin/bash
+# Description: Launch diverses Mandriva Scripts on boot.
+# (c) Mandriva, Chmouel Boudjnah <chmouel@mandriva.com>
+# 	$Id$	
+
+. /etc/rc.d/init.d/functions
+
+[ -e /etc/sysconfig/system ] && . /etc/sysconfig/system
+
+# Globetrotter support:
+if [ -x /usr/share/harddrake/hwprofile ]; then
+    action "Starting %s: " Globetrotter /usr/share/harddrake/hwprofile
+else
+	# Call netprofile as it must be called before /etc/rc.d/rc to be able to change
+	# the active services.
+	if [ -x /sbin/set-netprofile ]; then
+	    INITLOG_ARGS="" action "Starting %s: " netprofile /sbin/set-netprofile
+	fi
+fi
+
+# check if /etc/resolv.conf exist - if not creates it
+[ -f /etc/resolv.conf ] || {
+               touch /etc/resolv.conf
+}
+
+# start hardware detection tools
+# dkms module build has been split out to dkms-autorebuild.service in dkms package
+
+HARDDRAKE_TOOL=/usr/share/harddrake/service_harddrake
+if [ "$HARDDRAKE_ONBOOT" != "no" ] && [ -x $HARDDRAKE_TOOL ]; then
+    gprintf "Checking for new hardware"
+    SYSTEMCTL_NO_BLOCK=1 $HARDDRAKE_TOOL 2>/dev/null
+    RETVAL=$?
+    if [ "$RETVAL" -eq 0 ]; then
+        action "" /bin/true
+    else
+        action "" /bin/false
+    fi
+fi
+
+# /etc/issue and /etc/issue.net stuff
+
+[ -f /etc/sysconfig/system ] && source /etc/sysconfig/system
+[ -f /etc/sysconfig/msec ] && source /etc/sysconfig/msec
+[ -z "$SECURE_LEVEL" ] && SECURE_LEVEL=3
+[ -f /etc/sysconfig/init ] && source /etc/sysconfig/init
+if [ $SECURE_LEVEL -lt 4 ]; then
+    [ -z "$REWRITEISSUE" ] && REWRITEISSUE=rewrite
+    if [ $SECURE_LEVEL -lt 3 ]; then
+	[ -z "$REWRITEISSUENET" ] && REWRITEISSUENET=rewrite
+    fi
+fi
+
+SYSTEM=${SYSTEM="Mageia"}
+R=$(cat /etc/release)
+
+if [ -r /etc/sysconfig/oem ]; then
+    . /etc/sysconfig/oem
+
+    if [ -n "$SYSTEM" -a -n "$PRODUCT" ]; then
+	R="$SYSTEM $PRODUCT for `uname -m`"
+    fi
+fi
+
+# Source functions
+. /etc/init.d/functions
+
+if [ "$REWRITEISSUE" = "rewrite" -a -f /etc/release ]; then
+
+    arch=$(uname -m)
+    a="a"
+    case "_$arch" in
+	    _a*) a="an";;
+	    _i*) a="an";;
+    esac
+    
+    NUMPROC=`grep -E -c "^cpu[0-9]+" /proc/stat`
+    if [ "$NUMPROC" -gt "1" ]; then
+        SMP="$NUMPROC-processor "
+	[ "$NUMPROC" = "2" ] && \
+	SMP="Dual-processor "
+        if [ "$NUMPROC" = "8" -o "$NUMPROC" = "11" ]; then
+            a="an"
+	else
+	    a="a"
+        fi
+    fi
+
+    # This will overwrite /etc/issue at every boot.  So, make any changes you
+    # want to make to /etc/issue here or you will lose them when you reboot.
+
+    if [ -x /usr/bin/linux_logo ]; then
+	/usr/bin/linux_logo -n -f | sed -e 's|\\|\\\\|g' > /etc/issue
+	echo "" >> /etc/issue
+    else
+	> /etc/issue
+    fi
+    echo "$R" >> /etc/issue
+    echo "Kernel $(uname -r) on $a $SMP$(uname -m) / \l" >> /etc/issue
+    
+    if [ "$REWRITEISSUENET" = "rewrite" ]; then
+	echo "Welcome to ${HOST}" > /etc/issue.net
+	echo "$R" >> /etc/issue.net
+	echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue.net
+    else
+	NAME="$SYSTEM"
+	gprintf "Welcome to %s\n" "$NAME" > /etc/issue.net
+	echo "-------------------------" >> /etc/issue.net
+    fi
+else
+    if [ -f /etc/security/msec/issue.$SECURE_LEVEL ]; then
+	cat /etc/security/msec/issue.$SECURE_LEVEL > /etc/issue
+    elif [ -f /etc/security/msec/issue ]; then
+	cat /etc/security/msec/issue > /etc/issue
+    else
+	rm -f /etc/issue
+    fi
+    if [ -f /etc/security/msec/issue.net.$SECURE_LEVEL ]; then
+	cat /etc/security/msec/issue.net.$SECURE_LEVEL > /etc/issue.net
+    elif [ -f /etc/security/msec/issue.net ]; then
+	cat /etc/security/msec/issue.net > /etc/issue.net
+    else
+	rm -f /etc/issue.net
+    fi
+fi
diff --git a/mageia/usr/sbin/hibernate-cleanup.sh b/mageia/usr/sbin/hibernate-cleanup.sh
new file mode 100755
index 00000000..49451859
--- /dev/null
+++ b/mageia/usr/sbin/hibernate-cleanup.sh
@@ -0,0 +1,121 @@
+#!/bin/sh
+
+# This script invalidates any stale swsusp and Software Suspend 2 images. It
+# searches all swap partitions on your machine, as well as Suspend2's
+# filewriter files (by way of the hibernate script telling it where to find
+# it).
+#
+# It should be called on boot, after mounting filesystems, but before enabling
+# swap or clearing out /var/run. Copy this into /etc/init.d/ (or the appropriate
+# place on your system), then add a symlink at the appropriate point on boot.
+# On a Debian system, you would do this:
+#   update-rc.d hibernate-cleanup.sh start 31 S .
+#
+# On other SysV-based systems, you would do something like:
+#   ln -s ../init.d/hibernate-cleanup.sh /etc/rcS.d/S31hibernate-cleanup.sh
+
+HIBERNATE_FILEWRITER_TRAIL="/var/run/suspend2_filewriter_image_exists"
+
+get_part_label() {
+	local ID_FS_LABEL
+
+	eval "$(vol_id -x $1 2> /dev/null)"
+	echo "$ID_FS_LABEL"
+}
+
+get_part_uuid() {
+	local ID_FS_UUID
+
+	eval "$(vol_id -x $1 2> /dev/null)"
+	echo "$ID_FS_UUID"
+}
+
+get_swap_id() {
+	local line
+	fdisk -l 2>/dev/null | while read line; do
+		case "$line" in
+			/*Linux\ [sS]wap*) echo "${line%% *}"
+		esac
+	done
+}
+
+clear_swap() {
+	local where wason label uuid
+	where=$1
+	wason=
+	test x"$2" = x || label="-L $2"
+	test x"$3" = x || uuid="-U $3"
+	swapoff $where 2>/dev/null && wason=yes
+	mkswap $where $label $uuid > /dev/null || echo -n " (failed: $?)"
+	[ -n "$wason" ] && swapon $where
+}
+
+check_swap_sig() {
+	local part="$(get_swap_id)"
+	local where what type rest p c dev label
+	while read  where what type rest ; do
+		test "$type" = "swap" || continue
+		c=continue
+		dev=
+		label=
+		for p in $part ; do
+			case "$where" in
+				LABEL=* )
+					test x"$(get_part_label $p)" = x"${where#LABEL=}" &&  {
+						c=:
+						dev=$p
+						label=${where#LABEL=}
+					}
+				;;
+				UUID=* )
+					test x"$(get_part_uuid $p)" = x"${where#UUID=}" &&  {
+						c=:
+						dev=$p
+						uuid=${where#UUID=}
+					}
+				;;
+				* )	
+					test "$p" = "$where" && {
+						c=:
+						dev=$p
+					}
+				;;
+			esac
+		done
+		$c
+		case "$(dd if=$dev bs=1 count=6 skip=4086 2>/dev/null)" in
+			ULSUSP|S1SUSP|S2SUSP|pmdisk|[zZ]*)
+				echo -n "$dev"
+				clear_swap $dev "$label" "$uuid"
+				echo -n ", "
+		esac
+	done < /etc/fstab
+}
+
+check_filewriter_sig() {
+	local target
+	[ -f "$HIBERNATE_FILEWRITER_TRAIL" ] || return
+	read target < $HIBERNATE_FILEWRITER_TRAIL
+	[ -f "$target" ] || return
+	case "`dd \"if=$target\" bs=8 count=1 2>/dev/null`" in
+		HaveImag)
+			/bin/echo -ne "Suspend2\n\0\0" | dd "of=$target" bs=11 count=1 conv=notrunc 2>/dev/null
+			echo -n "$target, "
+			rm -f $HIBERNATE_FILEWRITER_TRAIL
+	esac
+}
+
+case "$1" in
+start)
+        echo -n "Invalidating stale software suspend images... "
+        check_swap_sig
+        check_filewriter_sig
+        echo "done."
+        ;;
+stop|restart|force-reload)
+        ;;
+*)
+        echo "Usage: /etc/init.d/hibernate {start|stop|restart|force-reload}"
+esac
+
+exit 0
diff --git a/mageia/usr/sbin/mdv-network-event b/mageia/usr/sbin/mdv-network-event
new file mode 100755
index 00000000..705361b7
--- /dev/null
+++ b/mageia/usr/sbin/mdv-network-event
@@ -0,0 +1,15 @@
+#!/bin/sh
+# usage "mdv-network-event <event> <interface>
+
+EVENT=$1
+INTERFACE=$2
+if [ -z "$EVENT" ] || [ -z "$INTERFACE" ] || [ ! -x /usr/bin/dbus-send ]; then
+  exit
+fi
+
+/usr/bin/dbus-send --system --type=signal \
+ /org/mageia/network/status \
+ org.mageia.network.status \
+ "string:$EVENT" \
+ "string:$INTERFACE" \
+ 2>/dev/null
diff --git a/mageia/usr/sbin/vpn-start b/mageia/usr/sbin/vpn-start
new file mode 100755
index 00000000..18cef8d2
--- /dev/null
+++ b/mageia/usr/sbin/vpn-start
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+TYPE=$1
+NAME=$2
+shift 2
+if [ -z "$TYPE" ] || [ -z "$NAME" ]; then
+   echo "usage: $0: <VPN type> <VPN name> [parameters]"
+fi
+
+DIR=/etc/sysconfig/network-scripts/vpn.d/"$TYPE"
+CONFIG="$DIR"/"$NAME".conf
+PID=/run/"$TYPE"-"$NAME".pid
+
+. /etc/init.d/functions
+
+if pidofproc "$PID" >/dev/null; then
+    gprintf "Connection is already started, please stop it first.\n"
+    exit 1
+fi
+
+case $TYPE in
+     pptp)
+        gprintf "No implementation for connection type $TYPE yet.\n";
+        exit 1
+     ;;
+     openvpn)
+        action "Starting VPN connection: " openvpn --user openvpn --group openvpn --daemon --writepid "$PID" --config "$CONFIG" --cd "$DIR" $*
+     ;;
+     vpnc)
+        action "Starting VPN connection: " /usr/sbin/vpnc "$CONFIG" --pid-file "$PID" $*
+     ;;
+     *)
+        gprintf "Connection type $TYPE is not supported.\n";
+        exit 1
+     ;;
+esac
diff --git a/mageia/usr/sbin/vpn-stop b/mageia/usr/sbin/vpn-stop
new file mode 100755
index 00000000..48863868
--- /dev/null
+++ b/mageia/usr/sbin/vpn-stop
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+TYPE=$1
+NAME=$2
+if [ -z "$TYPE" ] || [ -z "$NAME" ]; then
+   echo "usage: $0: <VPN type> <VPN name>"
+fi
+
+PID=/run/"$TYPE"-"$NAME".pid
+
+. /etc/init.d/functions
+if [ -e "$PID" ]; then
+    gprintf "Stopping VPN connection: "
+    killproc -p "$PID"
+    echo
+else
+    gprintf "Connection isn't started.\n"
+fi
diff --git a/man/usernetctl.8 b/man/usernetctl.8
index 2fb84da1..ebf86e1a 100644
--- a/man/usernetctl.8
+++ b/man/usernetctl.8
@@ -34,6 +34,10 @@ Attempt to bring the interface up or down.
 .TP
 report
 Report on whether users can bring the interface up or down.
+
+.SH FILES
+.IR /etc/sysconfig/network-scripts/ifcfg-*
+
 .SH NOTES
 Alternate device configurations may inherit the default configuration's
 permissions.
diff --git a/network-scripts/ifcfg-lo b/network-scripts/ifcfg-lo
old mode 100644
new mode 100755
diff --git a/network-scripts/ifdown b/network-scripts/ifdown
index ceba9bab..72cc49d5 100755
--- a/network-scripts/ifdown
+++ b/network-scripts/ifdown
@@ -7,7 +7,7 @@ unset WINDOW # defined by screen, conflicts with our usage
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=$1
 
@@ -58,6 +58,8 @@ if is_true "$_use_nm"; then
         fi
         exit 0
     fi
+    echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2
+    exit 0
 fi
 
 if [ -x /sbin/ifdown-pre-local ]; then
diff --git a/network-scripts/ifdown-bnep b/network-scripts/ifdown-bnep
index 9b2d385d..59201fd9 100755
--- a/network-scripts/ifdown-bnep
+++ b/network-scripts/ifdown-bnep
@@ -5,7 +5,7 @@
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=${1}
 
diff --git a/network-scripts/ifdown-eth b/network-scripts/ifdown-eth
index 7b457e85..d7ce103a 100755
--- a/network-scripts/ifdown-eth
+++ b/network-scripts/ifdown-eth
@@ -20,9 +20,12 @@
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=${1}
+boot=$2
+daemon=
+[ "foo${boot}" = "fooboot" -o "foo${boot}" = "foodaemon" ] && daemon=1
 
 source_config
 
@@ -84,6 +87,10 @@ if is_bonding_device ${DEVICE} ; then
 fi
 
 /etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG}
+if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -f /var/run/dhcp6c_${DEVICE}.pid ]; then
+	kill $(cat /var/run/dhcp6c_${DEVICE}.pid);
+	rm -f /var/run/dhcp6c_${DEVICE}.pid;
+fi
 
 retcode=0
 
@@ -106,6 +113,29 @@ for VER in "" 6 ; do
     fi
 done
 
+# Kill running dhcp client if present (supports more clients than the above)
+dhcp_client_pids() {
+    CLIENTS='dhcpcd|pump|dhcpxd|dhclient|zcip'
+    [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ] && CLIENTS="${CLIENTS}|wpa_supplicant"
+    ps xw | grep -E "${CLIENTS}" | grep ${DEVICE} | awk '{print $1;}'
+}
+
+if [ -n "${daemon}" -a "$MII_NOT_SUPPORTED" != "yes" ]; then
+    # use ifplugd -k -W to wait for it to be killed
+    /sbin/ifplugd -k -W -i ${DEVICE}
+fi
+
+pids=`dhcp_client_pids`
+if [ -n "$pids" ]; then
+    kill $pids
+    retcode=$?
+    waited=0
+    while ! dhcp_client_pids > /dev/null && [ "$waited" -lt 50 ] ; do
+	usleep 10000
+	waited=$(($waited+1))
+    done
+fi
+
 # we can't just delete the configured address because that address
 # may have been changed in the config file since the device was
 # brought up.  Flush all addresses associated with this
@@ -129,6 +159,11 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then
         echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
     fi
 
+    # Remove ip addresses from kernel
+    for ip in `ip addr show | grep -E ${DEVICE}\$ | grep inet | awk '{print $2;}'`; do
+        ip addr del $ip dev ${DEVICE}
+    done
+
     if [ "${REALDEVICE}" = "${DEVICE}" ]; then
         ip link set dev ${DEVICE} down 2>/dev/null
     fi
@@ -163,7 +198,7 @@ while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do
 done
 
 # don't leave an outdated key sitting around
-if [ -n "${WIRELESS_ENC_KEY}" ] && [ -x /sbin/iwconfig ]; then
+if [ -z "$IN_HOTPLUG" ] && [ -n "${WIRELESS_ENC_KEY}" ] && [ -x /sbin/iwconfig ]; then
     /sbin/iwconfig ${DEVICE} enc 0 >/dev/null 2>&1
 fi
 
diff --git a/network-scripts/ifdown-ipv6 b/network-scripts/ifdown-ipv6
old mode 100755
new mode 100644
diff --git a/network-scripts/ifdown-post b/network-scripts/ifdown-post
index 334cdaeb..4cf6aa61 100755
--- a/network-scripts/ifdown-post
+++ b/network-scripts/ifdown-post
@@ -62,6 +62,12 @@ if [ "${REALDEVICE}" != "lo" ]; then
               > /dev/null 2>&1
 fi
 
+mdv-network-event interface_down ${DEVICE}
+
+if [ -d /etc/sysconfig/network-scripts/ifdown.d -a -x /usr/bin/run-parts ]; then
+    /usr/bin/run-parts --arg ${DEVICE} /etc/sysconfig/network-scripts/ifdown.d
+fi
+
 if [ -x /sbin/ifdown-local ]; then
     /sbin/ifdown-local ${DEVICE}
 fi
diff --git a/network-scripts/ifdown-sit b/network-scripts/ifdown-sit
old mode 100755
new mode 100644
diff --git a/network-scripts/ifdown-tunnel b/network-scripts/ifdown-tunnel
index a5384b18..d2ac6922 100755
--- a/network-scripts/ifdown-tunnel
+++ b/network-scripts/ifdown-tunnel
@@ -25,7 +25,7 @@
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=$1
 need_config "$CONFIG"
diff --git a/network-scripts/ifup-bnep b/network-scripts/ifup-bnep
index 019e741b..5650b092 100755
--- a/network-scripts/ifup-bnep
+++ b/network-scripts/ifup-bnep
@@ -5,7 +5,7 @@
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=${1}
 
diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth
index 178b5173..5562d46c 100755
--- a/network-scripts/ifup-eth
+++ b/network-scripts/ifup-eth
@@ -15,14 +15,20 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+TEXTDOMAIN=initscripts
+
 . /etc/init.d/functions
 
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 CONFIG=${1}
+boot=${2}
+daemon=
+[ "foo${boot}" = "fooboot" -o "foo${boot}" = "foodaemon" ] && daemon=1
 
 need_config "${CONFIG}"
 
@@ -30,6 +36,7 @@ source_config
 
 if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
     DYNCONFIG=true
+    [ "${BOOTPROTO}" = bootp ] && DHCP_CLIENT=/sbin/pump
 fi
 
 # load the module associated with that device
@@ -41,6 +48,7 @@ if [ -n "${HWADDR}" ]; then
     FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
     if [ "${FOUNDMACADDR}" != "${HWADDR}" -a "${FOUNDMACADDR}" != "${MACADDR}" ]; then
         net_log $"Device ${DEVICE} has different MAC address than expected, ignoring."
+        mdv-network-event connection_failure ${DEVICE}
         exit 1
     fi
 fi
@@ -124,9 +132,67 @@ is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || {
     else
         net_log $"Device ${DEVICE} does not seem to be present, delaying initialization."
     fi
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 }
 
+# is the device wireless? If so, configure wireless device specifics
+IS_WIRELESS=
+if is_wireless_device ${DEVICE}; then
+    # ralink devices need to be up for wireless-tools to work
+    ip link set dev ${DEVICE} up
+    if [ -n "${daemon}" ] || is_true "$MII_NOT_SUPPORTED" ; then
+        # try to trigger association (and always load wireless settings)
+        WIRELESS_CONFIG="wireless.d/$WIRELESS_ESSID"
+        [ -f "$WIRELESS_CONFIG" ] && source "$WIRELESS_CONFIG"
+        . ./ifup-wireless
+        if [ -n "$WIRELESS_WPA_DRIVER" -a -x /usr/sbin/wpa_supplicant -a -f /etc/wpa_supplicant.conf ]; then
+            if wpa_cli -i${DEVICE} status &>/dev/null; then
+                echo "Another wpa_supplicant instance is already running for device $DEVICE"
+            else
+                /usr/sbin/wpa_supplicant -B -i ${DEVICE} \
+                    -c /etc/wpa_supplicant.conf  \
+                    -D ${WIRELESS_WPA_DRIVER}
+            fi
+            if is_true "$WIRELESS_WPA_REASSOCIATE"; then
+                sleep 2
+                wpa_cli reassociate
+            fi
+        fi
+    elif [ -n "$WIRELESS_WPA_DRIVER" ]; then
+        # roaming enabled, on association
+        # source interface parameters related to current ESSID or AP if any
+        WIRELESS_CURRENT_ESSID=`iwgetid -r ${DEVICE}`
+        if [ -n "$WIRELESS_CURRENT_ESSID" ]; then
+            WIRELESS_CONFIG="wireless.d/$WIRELESS_CURRENT_ESSID"
+            if [ ! -f "$WIRELESS_CONFIG" ]; then
+                WIRELESS_CURRENT_AP=`iwgetid -r -a ${DEVICE}`
+                WIRELESS_CONFIG="wireless.d/$WIRELESS_CURRENT_AP"
+            fi
+            if [ -f "$WIRELESS_CONFIG" ]; then
+                source "$WIRELESS_CONFIG"
+            else
+                echo "Wireless device $DEVICE is associated with $WIRELESS_CURRENT_ESSID but configuration is missing"
+            fi
+        else
+            echo "Wireless device $DEVICE is configured with a roaming daemon but isn't associated"
+        fi
+    fi
+    IS_WIRELESS=1
+fi
+
+# DVB Card
+if [ -n "${DVB_ADAPTER_ID}" -a -n "${DVB_NETWORK_DEMUX}" -a -n "${DVB_NETWORK_PID}" ]; then
+       dvbnet -a ${DVB_ADAPTER_ID} -n ${DVB_NETWORK_DEMUX} -p ${DVB_NETWORK_PID}
+fi
+
+# ATMARP protocol support, enabled if ATM_ADDR is defined (VCI.VPI)
+# useful for modems using the atm kernel module (e.g. Speedtouch)
+# and ISP using "RFC 1483 Routed VC MUX" (e.g. Free Degroupe)
+if [ -n "${ATM_ADDR}" -a -x /usr/sbin/atmarpd -a -x /usr/sbin/atmarp ]; then
+      pidof atmarpd >/dev/null 2>&1 || /usr/sbin/atmarpd -b -l syslog >/dev/null 2>&1
+      atmarp -c ${DEVICE} 2>/dev/null
+fi 
 
 # this isn't the same as the MAC in the configuration filename.  It is
 # available as a configuration option in the config file, forcing the kernel
@@ -138,9 +204,6 @@ if [ -n "${MTU}" ]; then
     ip link set dev ${DEVICE} mtu ${MTU}
 fi
 
-# is the device wireless? If so, configure wireless device specifics
-is_wireless_device ${DEVICE} && . ./ifup-wireless
-
 # Team slave device?
 if [ -n "${TEAM_MASTER}" ] && [ ! "${DEVICETYPE}" = "TeamPort" ] && [ -x ./ifup-TeamPort ]; then
     ./ifup-TeamPort ${CONFIG} $2
@@ -204,37 +267,155 @@ if [ -n "${BRIDGE}" ]; then
     exit 0
 fi
 
-if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
+# exec ifplugd daemon at boot if supported
+if [ -n "${daemon}" ] && ! is_true "$MII_NOT_SUPPORTED"; then
+    IFPLUGD_ARGS="${IFPLUGD_ARGS=-I -b}"
+    exec /sbin/ifplugd $IFPLUGD_ARGS -i $DEVICE
+fi
+
+
+BLURB="# temporary ifup addition"
+
+if [ -n "$DYNCONFIG" -a "XXX$DHCP_CLIENT" = "XXX" ];then
+    if [ -x /sbin/dhclient ];then
+        DHCP_CLIENT=/sbin/dhclient
+        # Remove any temporary references which were previously added to dhclient config
+        if [ -w /etc/dhclient-${DEVICE}.conf -a -x /sbin/dhclient ] ; then
+            grep -v "$BLURB" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
+            cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
+            rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
+        fi
+    elif [ -x /sbin/dhcpcd ];then
+        DHCP_CLIENT=/sbin/dhcpcd
+    elif [ -x /sbin/pump ];then
+        DHCP_CLIENT=/sbin/pump
+    elif [ -x /sbin/dhcpxd ];then
+        DHCP_CLIENT=/sbin/dhcpxd
+    else
+        echo $"Can't find a dhcp client"
+        mdv-network-event connection_failure ${DEVICE}
+        exit 1;
+    fi
+fi
+
+if [ "$DHCP_HOSTNAME" ] && [ "$DOMAINNAME" ]
+then
+        DHCP_HOSTNAME=`echo $DHCP_HOSTNAME | sed -e "s/\.$DOMAINNAME//g"`
+fi
+
+DHCP_ARGS=
+if [ "XXX$DHCP_CLIENT" != "XXX" ];then
+case $(basename $DHCP_CLIENT) in
+    dhcpcd)
+    DHCP_ARGS="--waitip"
+    [ -n "${DHCP_HOSTNAME}" ] && DHCP_ARGS="${DHCP_ARGS} -h ${DHCP_HOSTNAME}"
+    is_false "${PEERDNS}" && DHCP_ARGS="${DHCP_ARGS} -C resolv.conf"
+    is_false "${PEERGATEWAY}" && DHCP_ARGS="${DHCP_ARGS} -G"
+    [ -n "${DHCP_TIMEOUT}" ] && DHCP_ARGS="${DHCP_ARGS} -t ${DHCP_TIMEOUT}"
+    is_false "${NEEDHOSTNAME}" && DHCP_ARGS="${DHCP_ARGS} -C lookup-hostname"
+    if is_true "${PEERNTPD}"; then
+        DHCP_ARGS="${DHCP_ARGS} -o ntp_servers"
+    else
+        DHCP_ARGS="${DHCP_ARGS} -C ntp.conf -O ntp_servers"
+    fi
+    if is_true "${PEERYP}"; then
+        DHCP_ARGS="${DHCP_ARGS} -o nis_domain -o nis_servers"
+    else
+        DHCP_ARGS="${DHCP_ARGS} -C yp.conf -C ypbind -O nis_domain -O nis_servers"
+    fi
+
+    DHCP_ARGS="${DHCP_ARGS} ${DEVICE}"
+    PIDF=/var/run/dhcpcd-${DEVICE}.pid
+    if [[ -f ${PIDF} ]]; then
+        PID=$(cat ${PIDF})
+        if [[ -n ${PID} ]]; then
+            echo "dhcpcd is running, ifdown the interface first"
+            exit;
+        fi
+        /bin/rm -f ${PIDF}; #clear it
+    fi
+    ;;
+    pump)
+    [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-h $DHCP_HOSTNAME"
+    is_true "${NEEDHOSTNAME}" && DHCP_ARGS="$DHCP_ARGS --lookup-hostname"
+    is_false "${PEERDNS}" && DHCP_ARGS="$DHCP_ARGS -d"
+    is_false "${PEERGATEWAY}" && DHCP_ARGS="$DHCP_ARGS --no-gateway"
+    DHCP_ARGS="$DHCP_ARGS -i $DEVICE"
+    ;;
+    dhcpxd)
+    # dhcpxd don't support NEEDHOSTNAME, PEERGATEWAY
+    [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-H $HOSTNAME"
+    DHCP_ARGS="$DHCP_ARGS --wait $DEVICE"
+    ;;
+    dhclient)
     if is_true "${PERSISTENT_DHCLIENT}"; then
-        ONESHOT="";
+        ONESHOT=
     else
-        ONESHOT="-1";
-    fi;
+        ONESHOT="-1"
+    fi
     generate_config_file_name
     generate_lease_file_name
+    DHCP_ARGS="$DHCP_ARGS $ONESHOT -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid $DEVICE"
+    if [ -n "$DHCP_HOSTNAME" ]; then
+        if [ ! -e /etc/dhclient-${DEVICE}.conf ] || ! grep -q "[^# ]*send *host-name" /etc/dhclient-${DEVICE}.conf; then
+            echo "send host-name \"${DHCP_HOSTNAME}\";  $BLURB" >> /etc/dhclient-${DEVICE}.conf
+        fi
+    fi
+    if [ -n "$DHCP_TIMEOUT" ]; then
+        if [ ! -e /etc/dhclient-${DEVICE}.conf ] || ! grep -q "[^# ]*timeout" /etc/dhclient-${DEVICE}.conf; then
+            echo "timeout $DHCP_TIMEOUT;  $BLURB" >> /etc/dhclient-${DEVICE}.conf
+        fi
+    fi
+    ;;
+esac
+fi
 
-    # Initialize the dhclient args and obtain the hostname options if needed:
-    DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /run/dhclient-${DEVICE}.pid"
-    set_hostname_options DHCLIENTARGS
+# Remove any temporary references which were previously added to dhclient config
+if [ -w /etc/dhclient-${DEVICE}.conf ] && [ -x /sbin/dhclient ] ; then
+   LC_ALL=C grep -v "# temporary MDK ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
+   cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
+   rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
+fi
 
+if [ -n "${DYNCONFIG}" ]; then
     echo
     echo -n $"Determining IP information for ${DEVICE}..."
     if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then
         echo $" failed; no link present.  Check cable?"
+        ip link set dev ${DEVICE} down >/dev/null 2>&1
+        mdv-network-event connection_failure ${DEVICE}
         exit 1
     fi
 
     ethtool_set
 
-    if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
+    mdv-network-event dhcp_request ${DEVICE}
+    if $DHCP_CLIENT $DHCP_ARGS ; then
+        mdv-network-event dhcp_success ${DEVICE}
         echo $" done."
         dhcpipv4="good"
     else
+        mdv-network-event dhcp_failure ${DEVICE}
+        # Associate a zeroconf IP address to an alias of the interface
+        if [ -x /sbin/zcip ]; then
+            mdv-network-event zcip_request ${DEVICE}
+            if /sbin/zcip -s -i $DEVICE:${ZEROCONF_ALIAS_NUMER=9}; then
+                mdv-network-event zcip_success ${DEVICE}
+                echo $" done."
+                if [ -x /etc/init.d/tmdns ]; then
+                    /etc/init.d/tmdns reload > /dev/null 2>&1
+                fi
+                exit 0
+            fi
+        fi
+        mdv-network-event zcip_failure ${DEVICE}
         echo $" failed."
         if is_true "${IPV4_FAILURE_FATAL}"; then
+            mdv-network-event connection_failure ${DEVICE}
             exit 1
         fi
         if is_false "$IPV6INIT" || ! is_true "$DHCPV6C"; then
+            mdv-network-event connection_failure ${DEVICE}
             exit 1
         fi
         net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
@@ -255,6 +436,7 @@ else
 
         if ! ip link set dev ${REALDEVICE} up ; then
             net_log $"Failed to bring up ${DEVICE}."
+            mdv-network-event connection_failure ${DEVICE}
             exit 1
         fi
 
@@ -274,18 +456,21 @@ else
             SRC=
         fi
 
+    if [ "${REALDEVICE}" != "lo" ]; then
         # set IP address(es)
         for idx in {0..256} ; do
             if [ -z "${ipaddr[$idx]}" ]; then
                 break
             fi
 
+
             if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
                 if [ "${REALDEVICE}" != "lo" ] && ! is_false "${arpcheck[$idx]}"; then
                     ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
                     if [ $? = 1 ]; then
                         ARPINGMAC=$(echo $ARPING |  sed -ne 's/.*\[\(.*\)\].*/\1/p')
                         net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
+                        mdv-network-event connection_failure ${DEVICE}
                         exit 1
                     fi
                 fi
@@ -310,6 +495,7 @@ else
             # set lifetime of address to forever
             ip addr change ${ipaddr[$idx]}/${prefix[$idx]} dev ${REALDEVICE} valid_lft forever preferred_lft forever
         done
+        fi
 
         # Set a default route.
         if ! is_false "${DEFROUTE}" && [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then
@@ -372,7 +558,15 @@ if is_true "${DHCPV6C}" && [ -x /sbin/dhclient ]; then
     fi;
 
     DHCLIENTARGS="-6 ${ONESHOT} ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /run/dhclient6-${DEVICE}.pid ${DEVICE}"
-    set_hostname_options DHCLIENTARGS
+
+    # We need to wait for duplicate address detection to complete before running dhclient -6
+    for i in $(seq 5); do
+        lladdress=$(ip -6 -o a s dev "$DEVICE" scope link -tentative)
+        if [ -n "$lladdress" ]; then
+            break
+        fi
+        sleep 1
+    done
 
     if /sbin/dhclient $DHCLIENTARGS; then
         echo $" done."
diff --git a/network-scripts/ifup-ipv6 b/network-scripts/ifup-ipv6
old mode 100755
new mode 100644
index 55762264..f9760d06
--- a/network-scripts/ifup-ipv6
+++ b/network-scripts/ifup-ipv6
@@ -79,6 +79,7 @@ ipv6_test || exit 1
 ipv6_test_device_status $DEVICE
 if [ $? != 0 -a $? != 11 ]; then
     # device doesn't exist or other problem occurs
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 fi
 
@@ -180,6 +181,7 @@ if is_true "$IPV6TO4INIT"; then
     if [ $? = 0 ]; then
         # device is already up
         net_log $"Device 'tun6to4' (from '$DEVICE') is already up, shutdown first"
+        mdv-network-event connection_failure ${DEVICE}
         exit 1
     fi
 
@@ -308,6 +310,7 @@ if is_true "$IPV6TO4INIT"; then
         fi
     else
         net_log $"6to4 configuration is not valid"
+        mdv-network-event connection_failure ${DEVICE}
         exit 1
     fi
 fi
diff --git a/network-scripts/ifup-plusb b/network-scripts/ifup-plusb
old mode 100755
new mode 100644
diff --git a/network-scripts/ifup-post b/network-scripts/ifup-post
index 4cb986f8..008af3ff 100755
--- a/network-scripts/ifup-post
+++ b/network-scripts/ifup-post
@@ -6,7 +6,7 @@
 cd /etc/sysconfig/network-scripts
 . ./network-functions
 
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 unset REALDEVICE
 if [ "$1" = --realdevice ] ; then
@@ -141,6 +141,12 @@ if [ "${REALDEVICE}" != "lo" ]; then
               > /dev/null 2>&1
 fi
 
+mdv-network-event interface_up ${DEVICE}
+
+if [ -d /etc/sysconfig/network-scripts/ifup.d -a -x /usr/bin/run-parts ]; then
+    /usr/bin/run-parts --arg ${DEVICE} /etc/sysconfig/network-scripts/ifup.d
+fi
+
 if [ -x /sbin/ifup-local ]; then
     /sbin/ifup-local ${DEVICE}
 fi
diff --git a/network-scripts/ifup-sit b/network-scripts/ifup-sit
old mode 100755
new mode 100644
index 3daa3801..d29bb4d1
--- a/network-scripts/ifup-sit
+++ b/network-scripts/ifup-sit
@@ -56,11 +56,13 @@ ipv6_test || exit 1
 # Generic tunnel device sit0 is not supported here
 if [ "$DEVICE" = "sit0" ]; then
     net_log $"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and restart (IPv6) networking"
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 fi
 
 if [ -z "$IPV6TUNNELIPV4" ]; then
     net_log $"Missing remote IPv4 address of tunnel, configuration is not valid"
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 fi
 
@@ -69,6 +71,7 @@ ipv6_test_device_status $DEVICE
 if [ $? = 0 ]; then
     # device is already up
     net_log $"Device '$DEVICE' is already up, please shutdown first"
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 fi
 
diff --git a/network-scripts/ifup-tunnel b/network-scripts/ifup-tunnel
index ea85df52..d2b2b6a0 100755
--- a/network-scripts/ifup-tunnel
+++ b/network-scripts/ifup-tunnel
@@ -66,6 +66,7 @@ esac
 # Generic tunnel devices are not supported here
 if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 -o "$DEVICE" = ip6tnl0 ]; then
     net_log $"Device '$DEVICE' isn't supported as a valid GRE device name."
+    mdv-network-event connection_failure ${DEVICE}
     exit 1
 fi
 
diff --git a/network-scripts/ifup-wireless b/network-scripts/ifup-wireless
old mode 100755
new mode 100644
index 702b6199..9b77f8fd
--- a/network-scripts/ifup-wireless
+++ b/network-scripts/ifup-wireless
@@ -18,45 +18,178 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # Configure wireless network device options.  See iw(8) for more info.
+# Mageia prefixes the following variables with WIRELESS_ prefix.
 # Valid variables:
 #    MODE: Ad-Hoc, Managed, etc.
 #    ESSID: Name of the wireless network
+#    NWID: Name of this machine on the network.  Hostname is default
 #    FREQ: Frequency to operate on.  See CHANNEL
+#    CHANNEL: Numbered frequency to operate on.  See FREQ
+#    SENS: Sensitivity threshold for packet rejection.
+#    RATE: Transfer rate.  Usually one of Auto, 11, 5, 2, or 1.
+#    RTS: Explicit RTS handshake.  Usually not specified (auto)
+#    FRAG: Fragmentation threshold to split packets.  Usually not specified.
+#    IWCONFIG: Extra parameters to pass directly to IWCONFIG
+#    IWPRIV: Extra parameters to pass directly to IWPRIV
+#
+#    redhat-only variables:
 #    KEY: Encryption key for WEP.
+#    KEY[1-4]: Encryption key for WEP in position [1-4]
+#    SECURITYMODE: Security mode, e.g: 'open' or 'restricted'
+#    SPYIPS: List of IP addresses to "spy" on for link performance stats.
+#
+#    mandriva-only variables:
+#    WIRELESS_NICK: nickname for wireless connection
+#    WIRELESS_ENC_KEY: Encryption key for WEP.
+#    WIRELESS_ENC_MODE: Security mode, e.g: 'open' or 'restricted'
+#    WIRELESS_XSUPPLICANT: Enabling xsupplicant support
+#    WIRELESS_XSUPPLICANT_FILE: Custom location for xsupplicant.conf file
 
 # Only meant to be called from ifup.
 
-cd /etc/sysconfig/network-scripts
-. ./network-functions
+# unify variables common to RH and Mageia-style ifcfg
+MODE=${MODE:-$WIRELESS_MODE}
+ESSID=${ESSID:-$WIRELESS_ESSID}
+NWID=${NWID:-$WIRELESS_NWID}
+FREQ=${FREQ:-$WIRELESS_FREQ}
+CHANNEL=${CHANNEL:-$WIRELESS_CHANNEL}
+SENS=${SENS:-$WIRELESS_SENS}
+RATE=${RATE:-$WIRELESS_RATE}
+POWER=${POWER:-$WIRELESS_POWER}
+RTS=${RTS:-$WIRELESS_RTS}
+FRAG=${FRAG:-$WIRELESS_FRAG}
+IWCONFIG=${IWCONFIG:-$WIRELESS_IWCONFIG}
+IWSPY=${IWSPY:-$WIRELESS_IWSPY}
+IWPRIV=${IWPRIV:-$WIRELESS_IWPRIV}
 
-IW=${IW:-iw}
+# Mode need to be first : some settings apply only in a specific mode !
+if [ -n "$MODE" ] ; then
+    # for some cards, the mode can only be set with the card is down
+    # so we bring the card down (and suspending ifplugd if it is running)
+    # in order to do so (mdv bug #43166)
+    ifplugd -S -i $DEVICE 2>/dev/null
+    /sbin/ip link set dev $DEVICE down
+    iwconfig $DEVICE mode $MODE
+    ifplugd -R -i $DEVICE 2>/dev/null
+fi
 
-[ "$KEY" ] && KEYS="key d:0:$KEY"
+# Set link up (some cards require this.)
+/sbin/ip link set dev ${DEVICE} up
 
-shopt -s nocasematch
+# Setup the card nickname
+# This is a bit hackish, but should do the job right...
+if [ -n "$ESSID" -o -n "$MODE" ] ; then
+    NICKNAME=$(/bin/hostname)
+    iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
+fi
+if [ -n "$WIRELESS_NICK" ] ; then
+    iwconfig $DEVICE nick $WIRELESS_NICK >/dev/null 2>&1
+elif [ -n "$ESSID" ] || [ -n "$MODE" ] ; then
+   # This is a bit hackish, but should do the job right...
+    NICKNAME=`/bin/hostname`
+    iwconfig $DEVICE nick $NICKNAME >/dev/null 2>&1
+fi
 
-case "$MODE" in
-managed)
-    if [ "$ESSID" ]; then
-        $IW dev "$DEVICE" set type managed
-        $IW dev "$DEVICE" connect -w "$ESSID" $FREQ $KEYS
-    fi
-    ;;
-ad-hoc)
-    if [ -n "$ESSID" -a -n "$FREQ" ]; then
-        $IW dev "$DEVICE" set type ibss
-        $IW dev "$DEVICE" ibss join "$ESSID" "$FREQ" $KEYS
-    fi
-    ;;
-monitor)
-    if [ "$FREQ" ]; then 
-        $IW dev "$DEVICE" set type monitor
-        $IW dev "$DEVICE" set freq "$FREQ"
+# Regular stuff...
+# network id
+if [ -n "$NWID" ] ; then
+    iwconfig $DEVICE nwid $NWID
+fi
+
+# frequency and channel
+if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
+    iwconfig $DEVICE freq $FREQ
+elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
+    iwconfig $DEVICE channel $CHANNEL
+fi
+
+# sensitivity
+if [ -n "$SENS" ] ; then
+    iwconfig $DEVICE sens $SENS
+fi
+
+# rate
+if [ -n "$RATE" ] ; then
+    iwconfig $DEVICE rate "$RATE"
+fi
+
+# encryption
+# for redhat-style ifcfg
+if [ -n "$KEY" -o -n "$KEY1" -o -n "$KEY2" -o -n "$KEY3" -o -n "$KEY4" ] ; then
+    [ -n "$KEY1" ] && iwconfig $DEVICE key "[1]" $KEY1
+    [ -n "$KEY2" ] && iwconfig $DEVICE key "[2]" $KEY2
+    [ -n "$KEY3" ] && iwconfig $DEVICE key "[3]" $KEY3
+    [ -n "$KEY4" ] && iwconfig $DEVICE key "[4]" $KEY4
+    [ -n "$DEFAULTKEY" ] && iwconfig $DEVICE key "[${DEFAULTKEY}]"
+    [ -n "$KEY" ] && iwconfig $DEVICE key $KEY
+else
+    iwconfig $DEVICE key off
+fi
+
+# for mandriva-style ifcfg
+if [ -n "$WIRELESS_ENC_KEY" -o "$WIRELESS_ENC_MODE" ] ; then
+    if [ -n "$WIRELESS_ENC_MODE" ]; then
+        iwconfig $DEVICE key $WIRELESS_ENC_MODE "$WIRELESS_ENC_KEY"
+    else
+        # compatibility for older config files
+        # that used to contain enc mode in key
+        echo "$WIRELESS_ENC_KEY" | grep -E -q '^(open|restricted) '
+        if [ $? == 0 ]; then
+                iwconfig $DEVICE key $WIRELESS_ENC_KEY
+        else
+                iwconfig $DEVICE key "$WIRELESS_ENC_KEY"
+        fi
     fi
-    ;;
-esac
+fi
+
+# security mode
+if [ -n "$SECURITYMODE" ]; then
+    iwconfig $DEVICE enc $SECURITYMODE
+fi
+
+# power
+if [ -n "$POWER" ] ; then
+    iwconfig $DEVICE power $POWER
+fi
+
+# rts
+if [ -n "$RTS" ] ; then
+    iwconfig $DEVICE rts $RTS
+fi
+
+# fragmentation
+if [ -n "$FRAG" ] ; then
+    iwconfig $DEVICE frag $FRAG
+fi
+
+# More specific parameters passed directly to IWCONFIG
+if [ -n "$IWCONFIG" ] ; then
+    iwconfig $DEVICE $IWCONFIG
+fi
+
+# iwspy settings
+if [ -n "$SPYIPS" ] ; then
+    for IP in $SPYIPS; do
+        iwspy $DEVICE + $IP
+    done
+fi
+if [ -n "$IWSPY" ] ; then
+    /sbin/iwspy $DEVICE $IWSPY
+fi
+
+# private options
+if [ -n "$IWPRIV" ] ; then
+    IFS=$'\n' echo "$IWPRIV" | while read priv; do
+        [ -n -n "$priv" ] && eval "/sbin/iwpriv $DEVICE $priv"
+    done
+fi
 
-if [ -n "$WOWLAN" ] ; then
-    PHYDEVICE=$(phy_wireless_device $DEVICE)
-    iw phy $PHYDEVICE wowlan enable ${WOWLAN}
+# ESSID need to be last : most device re-perform the scanning/discovery
+# when this is set, and things like encryption keys are better be
+# defined if we want to discover the right set of APs/nodes.
+if [ -n "$ESSID" ] ; then
+    iwconfig $DEVICE essid "$ESSID"
+else
+    # use any essid
+    iwconfig $DEVICE essid any >/dev/null 2>&1
 fi
diff --git a/network-scripts/network-functions b/network-scripts/network-functions
old mode 100644
new mode 100755
index 332115b8..9cb659d1
--- a/network-scripts/network-functions
+++ b/network-scripts/network-functions
@@ -13,6 +13,8 @@ HOSTNAME="$(hostname)"
 
 [ -z "$__sed_discard_ignored_files" ] && . /etc/init.d/functions
 
+RESOLVCONF_FLAGFILE=/var/run/resolvconf/enable-updates
+
 get_hwaddr ()
 {
     if [ -f /sys/class/net/${1}/address ]; then
@@ -291,19 +293,28 @@ is_nm_running ()
         string:"org.freedesktop.NetworkManager" >/dev/null 2>&1
 }
 
+is_nm_device_unavailable ()
+{
+    [ -x /usr/bin/nmcli ] && \
+    LANG=C LC_ALL=C nmcli -t --fields device,state  dev status 2>/dev/null | grep -q "^${1}:unavailable$"
+}
+
 is_nm_active ()
 {
-    LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:connected$"
+    [ -x /usr/bin/nmcli ] && \
+    LANG=C LC_ALL=C nmcli -t --fields device,state  dev status 2>/dev/null | grep -q "^${1}:connected$"
 }
 
 is_nm_handling ()
 {
-    LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
+    [ -x /usr/bin/nmcli ] && \
+    LANG=C nmcli -t --fields device,state  dev status 2>/dev/null | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
 }
 
 is_nm_device_unmanaged ()
 {
-    LANG=C nmcli -t --fields GENERAL dev show "${1}" 2>/dev/null | awk -F ':' '/GENERAL.STATE/ { if ($2 == "unmanaged") exit 0 ; else exit 1; }'
+    [ -x /usr/bin/nmcli ] && \
+    LANG=C LC_ALL=C nmcli -t --fields GENERAL dev show "${1}"  2>/dev/null | awk -F ':' '/GENERAL.STATE/ { if ($2 == "unmanaged") exit 0 ; else exit 1; }'
 }
 
 # Sets $alias to the device module if $? != 0
@@ -441,6 +452,9 @@ set_hostname ()
             /bin/rm -f $rsctmp
         fi    
     fi
+    if [ -d /etc/sysconfig/network-scripts/hostname.d -a -x /usr/bin/run-parts ]; then
+	/usr/bin/run-parts --arg $1 /etc/sysconfig/network-scripts/hostname.d
+    fi
 }
 
 check_device_down ()
@@ -455,6 +469,9 @@ check_device_down ()
 
 check_link_down ()
 {
+    if is_true "${MII_NOT_SUPPORTED}"; then
+        return 1
+    fi
     if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then
         ip link set dev $1 up >/dev/null 2>&1
     fi
@@ -645,14 +662,20 @@ change_resolv_conf ()
             fi
             n_args=$(($n_args-1))
         done             
-    elif [ $# -eq 1 ]; then
+    elif [ $# -eq 1 -a -r "$1" ]; then
         if [ "x$s" != "x" ]; then
             s="$s"$'\n'$(/bin/grep -vF "$s" $1)
         else
             s=$(cat $1)
         fi
+    else
+        return
+    fi
+    if [ -e "$RESOLVCONF_FLAGFILE" ]; then
+        echo "$s" | /sbin/resolvconf -a ${DEVICE}
+    else
+        (echo "$s" > /etc/resolv.conf) >/dev/null 2>&1;
     fi
-    (echo "$s" > /etc/resolv.conf) >/dev/null 2>&1;
     r=$?
     if [ $r -eq 0 ]; then
         [ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 # reset the correct context
@@ -663,6 +686,16 @@ change_resolv_conf ()
     return $r
 }
 
+clear_resolv_conf ()
+{
+    if [ -e "$RESOLVCONF_FLAGFILE" ]; then
+	/sbin/resolvconf -d ${DEVICE}
+    elif [ -f /etc/resolv.conf.save ]; then
+	change_resolv_conf /etc/resolv.conf.save
+	rm -f /etc/resolv.conf.save
+    fi
+}
+
 # Logging function
 #
 # Usage: net_log <message> <err|warning|info> <optional file/function name>
diff --git a/usr/libexec/loadmodules b/usr/libexec/loadmodules
index 4fd167c4..5925bdf7 100755
--- a/usr/libexec/loadmodules
+++ b/usr/libexec/loadmodules
@@ -2,7 +2,9 @@
 
 # Load other user-defined modules
 for file in /etc/sysconfig/modules/*.modules ; do
-  [ -x $file ] && $file
+	if [ -x $file ]; then
+		$file
+	fi
 done
 
 # Load modules (for backward compatibility with VARs)
diff --git a/usr/libexec/netconsole b/usr/libexec/netconsole
index 3f2872dd..48f9bbf4 100755
--- a/usr/libexec/netconsole
+++ b/usr/libexec/netconsole
@@ -9,6 +9,7 @@
 ### BEGIN INIT INFO
 # Provides:          netconsole
 # Required-Start:    $network
+# Required-Stop:     $network
 # Short-Description: Initializes network console logging
 # Description:       Initializes network console logging of kernel messages.
 ### END INIT INFO
@@ -40,7 +41,7 @@ kernel=$(uname -r | cut -d. -f1-2)
 
 usage ()
 {
-	echo $"Usage: $0 {start|stop|status|restart|condrestart}" 1>&2
+	gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" $0 1>&2
 	RETVAL=2
 }
 
@@ -97,13 +98,13 @@ start ()
 		fi
 	fi
 	if [ -z "$SYSLOGADDR" ] ; then
-		echo $"Server address not specified in /etc/sysconfig/netconsole" 1>&2
+		gprintf "Server address not specified in /etc/sysconfig/netconsole\n" 1>&2
 		exit 6
 	fi
 	eval $(print_address_info $SYSLOGADDR)
 	
 	if [ -z "$SYSLOGMACADDR" ]; then
-		echo $"netconsole: can't resolve MAC address of $SYSLOGADDR" 1>&2
+		gprintf "netconsole: can't resolve MAC address of %s\n" $SYSLOGADDR 1>&2
 		exit 1
 	fi
 
@@ -112,7 +113,7 @@ start ()
 	/usr/bin/logger -p daemon.info -t netconsole: inserting netconsole module with arguments \
 	$SYSLOGOPTS
 	if [ -n "$SYSLOGOPTS" ]; then
-		action $"Initializing netconsole" modprobe netconsole \
+		action "Initializing netconsole" modprobe netconsole \
 			$SYSLOGOPTS
 		[ "$?" != "0" ] && RETVAL=1
 	fi
@@ -122,7 +123,7 @@ start ()
 stop ()
 {
 	if /sbin/lsmod | grep netconsole >/dev/null 2>&1 ; then
-	    action $"Disabling netconsole" rmmod netconsole;
+	    action "Disabling netconsole" rmmod netconsole;
 	    [ "$?" != "0" ] && RETVAL=1
 	fi
 
@@ -132,10 +133,10 @@ stop ()
 status ()
 {
 	if /sbin/lsmod | grep netconsole >/dev/null 2>&1 ; then
-		echo $"netconsole module loaded"
+		gprintf "netconsole module loaded\n"
 		RETVAL=0
 	else
-		echo $"netconsole module not loaded"
+		gprintf "netconsole module not loaded\n"
 		RETVAL=3
 	fi
 }
diff --git a/usr/sbin/service b/usr/sbin/service
index b178d915..569d5973 100755
--- a/usr/sbin/service
+++ b/usr/sbin/service
@@ -1,100 +1,154 @@
 #!/bin/bash
+# -*- Mode: shell-script -*-
+# Copyright (C) 2001 by Chmouel Boudjnah <chmouel@mandrakesoft.com>
+#			MandrakeSoft.
+# Redistribution of this file is permitted under the terms of the GNU
+# Public License (GPL)
+# Original version writen by RedHat.
+
+debug=
+service=
+opt=
+fullrestart=
+fullrestartall=
+statusall=
+
+servicedir=/etc/init.d
+xinetddir=/etc/xinetd.d
+
+basename=${0##*/}
 
 . /etc/init.d/functions
 
-VERSION="$(basename $0) ver. 1.1"
-USAGE="Usage: $(basename $0) < option > | --status-all | \
-[ service_name [ command | --full-restart ] ]"
-SERVICEDIR="/etc/init.d"
-ACTIONDIR="/usr/libexec/initscripts/legacy-actions"
-SERVICE=
-ACTION=
-OPTIONS=
-
-if [ $# -eq 0 ]; then
-   echo "${USAGE}" >&2
-   exit 1
-fi
+function service_available () {
+	local subsys
+	cd $servicedir
+
+	for subsys in *;do
+		case $subsys in
+			kheader|numlock|sound|usb|netfs|kudzu|local|pcmcia| \
+			network|local|dm|harddrake|xfs) continue;;
+		esac
+		is_ignored_file "$service" && continue
+		grep -q chkconfig $subsys || continue
+		grep -E -q 'restart.*\)' $subsys || continue
+		[[ -x $subsys ]] || continue
+		[[ -e /var/lock/subsys/$subsys ]] || continue
+		echo $(grep -E -a '^#.*chkconfig: ' $subsys|awk '{print $4}') $subsys
+	done | sort -n|cut -d" " -f2
+}
 
-cd /
-while [ $# -gt 0 ]; do
-    case "${1}" in
-    --help | -h | --h* )
-        echo "${USAGE}" >&2
-        exit 0
-        ;;
-    --version | -V )
-        echo "${VERSION}" >&2
-        exit 0
-        ;;
-    --ignore-dependencies)
-        export SYSTEMCTL_IGNORE_DEPENDENCIES=1
-        shift
-        ;;
-    --skip-redirect)
-        export SYSTEMCTL_SKIP_REDIRECT=1
-        shift
-        ;;
-    *)
-        if [ -z "${SERVICE}" ] && [ $# -eq 1 ] && [ "${1}" = "--status-all" ]; then
-            cd ${SERVICEDIR}
-            for SERVICE in * ; do
-                case "${SERVICE}" in
-                functions | halt | killall | single| linuxconf| kudzu)
-                    ;;
-                *)
-                    if ! is_ignored_file "${SERVICE}" \
-                            && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-                        env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status
-                    fi
-                    ;;
-                esac
-            done
-            exit 0
-        elif [ $# -eq 2 ] && [ "${2}" = "--full-restart" ]; then
-            SERVICE="${1}"
-            if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-                env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" stop
-                env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" start
-                exit $?
-            fi
-        elif [ -z "${SERVICE}" ]; then
-            SERVICE="${1}"
-        elif [ -z "${ACTION}" ]; then
-            ACTION="${1}"
-        else
-            OPTIONS="${OPTIONS} ${1}"
-        fi
-        shift
-        ;;
+function usage () {
+	cat <<EOF 1>&2
+Usage: $basename -[Rfshv] SERVICE ARGUMENTS
+	-f|--full-restart:	Do a fullrestart of the service.
+	-R|--full-restart-all:	Do a fullrestart of all running services.
+	-s|--status-all:	Print a status of all services.
+	--ignore-dependencies:  Do not start required systemd services
+	--skip-redirect:	Do not redirect to systemd
+	-d|--debug:		Launch with debug.
+	-h|--help:		This help.
+EOF
+exit 1
+}
+function check_if_inetd() {
+    local serv=$1
+    if [[ ! -f ${servicedir}/${serv} ]];then
+	if [[ -f ${xinetddir}/${serv} ]];then
+	    if grep -E -q ".*disable.*yes.*" ${xinetddir}/${serv};then
+		echo "$serv is a xinetd service and it is disabled"
+		echo "to activate it do the following command:"
+		echo "chkconfig ${serv} on"
+		service=
+		return
+	    fi
+	    service=xinetd
+	    [[ $options = "start" ]] && options=reload
+	    if [[ $options != reload ]] && [[ -z $fullrestart ]];then
+		echo "There is no such option for xinetd services"
+		echo "You can only use the start option to reload a xinetd service"
+		service=
+	    fi
+	    echo "${serv} is a xinetd service"
+	fi
+    fi
+    return
+}
+
+while [[ $1 = --* ]] || [[ $1 = -* ]];do
+    opt=$1
+    shift
+    case $opt in
+	--full-restart|-f) fullrestart=yes;;
+	--full-restart-all|-R) fullrestartall=yes;;
+	--status-all|-s) statusall=yes;;
+	--debug|-d) set -x ; debug="/bin/bash -x";;
+	--help|-h) usage;;
+	--ignore-dependencies) export SYSTEMCTL_IGNORE_DEPENDENCIES=1;;
+	--skip-redirect) export SYSTEMCTL_SKIP_REDIRECT=1;;
+	*) echo "Unknow option $opt"; usage;
     esac
 done
 
-if [ -f "${SERVICEDIR}/${SERVICE}" ]; then
-    # LSB daemons that dies abnormally in systemd looks alive in systemd's eyes due to RemainAfterExit=yes
-    # lets reap them before next start
-    if [ "${ACTION}" = 'start' ] && \
-            [ "$(systemctl show -p ActiveState ${SERVICE}.service --value)" = 'active' ] && \
-            [ "$(systemctl show -p SubState ${SERVICE}.service --value)" = 'exited' ]; then
-        /bin/systemctl stop ${SERVICE}.service
-    fi
+service=${1##*/}; shift;
+options="$@"
 
-    # Workaround to be able to "stop" network.service when it's in inactive state using service instead of systemctl
-    # Useful for manual testing of network 
-    if [ "${SERVICE}" = 'network' ] && [ "${ACTION}" = 'stop' ] && \
-            [ "$(systemctl show -p ActiveState network.service --value)" = 'inactive' ] && \
-            [ "$(systemctl show -p SourcePath network.service --value)" = '/etc/rc.d/init.d/network' ]; then
-        export SYSTEMCTL_SKIP_REDIRECT=1
+#nuts ? (yes)
+while :;do
+    [[ -z $service && -n $statusall ]] && break
+    [[ -z $service && -n $fullrestartall ]] && break
+    [[ -n $service && -n $statusall ]] && { echo "--status-all doesn't need arguments"; usage ;}
+    [[ -n $service && -n $fullrestartall ]] && { echo "--full-restart-all doesn't need arguments"; usage ;}
+    [[ -z $service ]] && usage
+    [[ -n $service ]] && break
+done
+
+if [[ -n $fullrestartall ]];then
+    for subsys in $(service_available);do $0 -f $subsys;done
+    exit 0 #for glibc post upgrades
+fi
+
+if [[ -n $statusall ]];then
+    cd $servicedir
+    for service in *;do
+	case $service in
+	    functions | halt | killall | single| linuxconf| kudzu | \
+		mandrake_firstime | mandrake_everytime)
+		continue ;;
+	esac
+	is_ignored_file "$service" && continue
+	if grep -E -q '^([^#]*)status\)' $service;then
+	    $debug $servicedir/$service status
+	fi
+    done
+    exit 0;
+fi
+
+if [[ -n $fullrestart ]];then
+    check_if_inetd "$service"
+    cd "$servicedir"
+    if [[ -f ./$service ]];then
+	$debug ./$service stop
+	$debug ./$service start
+	exit $?
+    else
+	echo "Cannot find $servicedir/$service"
+	usage
     fi
+    exit 1
+fi
+
+[[ -z $options ]] && { echo -e "I need an action\n" 1>&2; usage;}
+
+check_if_inetd "$service" ; [[ -z $service ]] && exit 1
 
-    env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
-elif [ -n "${ACTION}" ] && [ -x "${ACTIONDIR}/${SERVICE}/${ACTION}" ]; then
-    env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${ACTIONDIR}/${SERVICE}/${ACTION}" ${OPTIONS}
-elif [[ $ACTION =~ start|stop|restart|try-restart|reload|force-reload|status|condrestart ]]; then
-    SERVICE_MANGLED=$(/usr/bin/systemd-escape --mangle ${SERVICE})
-    echo $"Redirecting to /bin/systemctl ${ACTION}${OPTIONS:+ }${OPTIONS} ${SERVICE_MANGLED}" >&2
-    exec /bin/systemctl ${ACTION} ${OPTIONS} ${SERVICE_MANGLED}
+if ! is_ignored_file "$service" && [[ -f $servicedir/$service ]]; then
+    env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} $debug "$servicedir/$service" $options
+    exit $?
+elif [[ -f /lib/systemd/system/"$service".service ]] && [ -d /run/systemd/system/ ]; then
+    [ -c /dev/stderr ] && echo $"Redirecting to /bin/systemctl ${options} ${service}.service" > /dev/stderr
+    exec /bin/systemctl ${options} ${service}.service
 else
-    echo $"The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl." >&2
-    exit 2
+    echo "Cannot find $service service"
+    usage
 fi