[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ifupdown's changelog: Try to remove old /etc/network/run even if it's a symlink



    $ zgrep 'Try to remove' /usr/share/doc/ifupdown/changelog.gz
        - Try to remove old /etc/network/run even if it's a symlink.
    $ ls -l /etc/network/run
    lrwxrwxrwx 1 root root 12 May 20 20:59 /etc/network/run -> /run/network

  Can I remove /etc/network/run manually?  Just /etc/network/run.  Not
/run/network.
My understanding is that the removal attempt is here:

    $ grep -A23 Migrate /var/lib/dpkg/info/ifupdown.postinst
    # Migrate /etc/network/run to /run/network
    if [ "$1" = configure -a "$2" != "" -a -e /etc/network/run -a "$l" != "/run/network" ]
    then
      echo "Migrating network state directory from $l to /run/network..."
      [ -d /run/network ] || mkdir /run/network
      if [ -e /etc/network/run/ifstate ]
      then
        echo "Moving /etc/network/run/ifstate to /run/network/ifstate"
        if [ ! -L /etc/network/run/ifstate ]; then
          mv -f /etc/network/run/ifstate /run/network/ifstate
        else
          # we do this thing with .dpkg-new just so we don't truncate the
          # state file in the case of crazy symlinked or mount-bound setup
          cat /etc/network/run/ifstate >/run/network/ifstate.dpkg-new
          mv -f /etc/network/run/ifstate /run/network/ifstate.dpkg-old
          mv -f /run/network/ifstate.dpkg-new /run/network/ifstate
        fi
      fi
      mv -f /etc/network/run /etc/network/run.dpkg-old || true
      ln -s /run/network /etc/network/run
      [ -L /etc/network/run.dpkg-old ] && rm -f /etc/network/run.dpkg-old || true
      [ -d /etc/network/run.dpkg-old ] && rmdir /etc/network/run.dpkg-old 2>/dev/null || report_warn "Not removing the old contents of /etc/network/run: directory not empty; renamed into /etc/network/run.dpkg-old."
    fi
    
  I don't have /etc/network/run.dpkg-old.  I understand that the writer
of that code fragment was cautious about various linkage methods.  I
tried to follow the logic of the code, but failed.  For example,
why is there an explicit 

  ln -s /run/network /etc/network/run

?


Reply to: