Kaynağa Gözat

Gentoo Linux support

Christoph Schug 23 yıl önce
ebeveyn
işleme
f292322909
2 değiştirilmiş dosya ile 133 ekleme ve 82 silme
  1. 7 0
      openpkg/aux.prereq.sh
  2. 126 82
      openpkg/openpkg.spec

+ 7 - 0
openpkg/aux.prereq.sh

@@ -64,6 +64,13 @@ case $platform in
                    support=yes
                    ;;
            esac
+       elif [ -f /etc/gentoo-release ]; then
+           gentoo=`cat /etc/gentoo-release | sed -e 's;^.*version \([0-9]\..*\)$;\1;'`
+           case "$gentoo" in
+               1.4.2.* )
+                   support=maybe
+                   ;;
+           esac
        fi
        ;;
     *-freebsd* )

+ 126 - 82
openpkg/openpkg.spec

@@ -1137,58 +1137,97 @@ Provides:     OpenPKG
                 fi
                 ;;
             Linux/* )
-                #   sroot: script root directory
-                #   lroot: link   root directory
-                if [ -f /etc/debian_version ]; then
-                    sroot=/etc/init.d
-                    lroot=/etc/rc%d.d
-                elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
-                    sroot=/etc/rc.d/init.d
-                    lroot=/etc/rc.d/rc%d.d
+                if [ -f /etc/gentoo-release ]; then
+                    if [ ! -f /etc/init.d/openpkg-${name} ]; then
+                        #   install transfer script
+                        ( echo "#!/sbin/runscript"
+                          echo "##"
+                          echo "##  openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
+                          echo "##"
+                          echo ""
+                          echo "depend() {"
+                          echo "    need net"
+                          echo "}"
+                          echo ""
+                          echo "checkconfig() {"
+                          echo "    [ -f ${prefix}/etc/rc ] || return 1"
+                          echo "    case $1 in"
+                          echo "        start ) exec ${prefix}/etc/rc all start ;;"
+                          echo "        stop  ) exec ${prefix}/etc/rc all stop  ;;"
+                          echo "    esac"
+                          echo "}"
+                          echo ""
+                          echo "start() {"
+                          echo "    checkconfig || return 1"
+                          echo "    ebegin "Starting OpenPKG ${prefix} hierarchy""
+                          echo "    exec ${prefix}/etc/rc all start"
+                          echo "    eend 0"
+                          echo "}"
+                          echo ""
+                          echo "stop() {"
+                          echo "    checkconfig || return 1"
+                          echo "    ebegin "Stopping OpenPKG ${prefix} hierarchy""
+                          echo "    exec ${prefix}/etc/rc all stop"
+                          echo "    eend 0"
+                          echo "}"
+                        ) >/etc/init.d/openpkg-${name}
+                        chmod 755 /etc/init.d/openpkg-${name}
+                        /sbin/rc-update add openpkg-${name} default
+                    fi
                 else
-                    echo "WARNING: you are not running one of the supported standard" 1>&2
-                    echo "WARNING: Linux platforms (Debian, RedHat). We are trying"   1>&2
-                    echo "WARNING: to guess the location of the system init scripts!" 1>&2
-                    sroot=""
-                    lroot=""
-                    for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
-                        if [ -d $sr ]; then
-                            sroot="$sr"
-                            break
-                        fi
-                    done
-                    for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
-                        if [ -d $lr ]; then
-                            lroot="`echo $lr | sed -e 's;2;%d;'`"
-                            break
+                    #   sroot: script root directory
+                    #   lroot: link   root directory
+                    if [ -f /etc/debian_version ]; then
+                        sroot=/etc/init.d
+                        lroot=/etc/rc%d.d
+                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
+                        sroot=/etc/rc.d/init.d
+                        lroot=/etc/rc.d/rc%d.d
+                    else
+                        echo "WARNING: you are not running one of the supported standard" 1>&2
+                        echo "WARNING: Linux platforms (Debian, RedHat). We are trying"   1>&2
+                        echo "WARNING: to guess the location of the system init scripts!" 1>&2
+                        sroot=""
+                        lroot=""
+                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
+                            if [ -d $sr ]; then
+                                sroot="$sr"
+                                break
+                            fi
+                        done
+                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
+                            if [ -d $lr ]; then
+                                lroot="`echo $lr | sed -e 's;2;%d;'`"
+                                break
+                            fi
+                        done
+                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
+                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
+                            exit 1
                         fi
-                    done
-                    if [ ".$sroot" = . -o ".$lroot" = . ]; then
-                        echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
-                        exit 1
                     fi
-                fi
-                if [ ! -f $sroot/${name} ]; then
-                    #   install transfer script
-                    ( echo "#!/bin/sh"
-                      echo "##"
-                      echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
-                      echo "##"
-                      echo ""
-                      echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
-                      echo "case \$1 in"
-                      echo "    start ) exec ${prefix}/etc/rc all start ;;"
-                      echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
-                      echo "esac"
-                    ) >$sroot/${name}
-                    chmod 755 $sroot/${name}
-                    #   create corresponding symbolic links
-                    for i in 2 3 4 5; do
-                        ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
-                    done
-                    for i in 0 1 6; do
-                        ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
-                    done
+                    if [ ! -f $sroot/${name} ]; then
+                        #   install transfer script
+                        ( echo "#!/bin/sh"
+                          echo "##"
+                          echo "##  ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy"
+                          echo "##"
+                          echo ""
+                          echo "[ ! -f ${prefix}/etc/rc ] && exit 0"
+                          echo "case \$1 in"
+                          echo "    start ) exec ${prefix}/etc/rc all start ;;"
+                          echo "    stop  ) exec ${prefix}/etc/rc all stop  ;;"
+                          echo "esac"
+                        ) >$sroot/${name}
+                        chmod 755 $sroot/${name}
+                        #   create corresponding symbolic links
+                        for i in 2 3 4 5; do
+                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name}
+                        done
+                        for i in 0 1 6; do
+                            ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name}
+                        done
+                    fi
                 fi
                 ;;
             SunOS/5.* )
@@ -1502,44 +1541,49 @@ Provides:     OpenPKG
                 rm -f /etc/rc.d/${name} >/dev/null 2>&1
                 ;;
             Linux/* )
-                #   sroot: script root directory
-                #   lroot: link   root directory
-                if [ -f /etc/debian_version ]; then
-                    sroot=/etc/init.d
-                    lroot=/etc/rc%d.d
-                elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
-                    sroot=/etc/rc.d/init.d
-                    lroot=/etc/rc.d/rc%d.d
+                if [ -f /etc/gentoo-release ]; then
+                    /sbin/rc-update del openpkg-${name} >/dev/null 2>&1
+                    rm -f /etc/init.d/openpkg-${name}   >/dev/null 2>&1
                 else
-                    echo "WARNING: you are not running one of the supported standard" 1>&2
-                    echo "WARNING: Linux platforms (Debian, RedHat). We are trying"   1>&2
-                    echo "WARNING: to guess the location of the system init scripts!" 1>&2
-                    sroot=""
-                    lroot=""
-                    for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
-                        if [ -d $sr ]; then
-                            sroot="$sr"
-                            break
+                    #   sroot: script root directory
+                    #   lroot: link   root directory
+                    if [ -f /etc/debian_version ]; then
+                        sroot=/etc/init.d
+                        lroot=/etc/rc%d.d
+                    elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then
+                        sroot=/etc/rc.d/init.d
+                        lroot=/etc/rc.d/rc%d.d
+                    else
+                        echo "WARNING: you are not running one of the supported standard" 1>&2
+                        echo "WARNING: Linux platforms (Debian, RedHat). We are trying"   1>&2
+                        echo "WARNING: to guess the location of the system init scripts!" 1>&2
+                        sroot=""
+                        lroot=""
+                        for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
+                            if [ -d $sr ]; then
+                                sroot="$sr"
+                                break
+                            fi
+                        done
+                        for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
+                            if [ -d $lr ]; then
+                                lroot="`echo $lr | sed -e 's;2;%d;'`"
+                                break
+                            fi
+                        done
+                        if [ ".$sroot" = . -o ".$lroot" = . ]; then
+                            echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
+                            exit 1
                         fi
+                    fi
+                    rm -f ${sroot}/${name} >/dev/null 2>&1
+                    for i in 2 3 4 5; do
+                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
                     done
-                    for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
-                        if [ -d $lr ]; then
-                            lroot="`echo $lr | sed -e 's;2;%d;'`"
-                            break
-                        fi
+                    for i in 0 1 6; do
+                        rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
                     done
-                    if [ ".$sroot" = . -o ".$lroot" = . ]; then
-                        echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2
-                        exit 1
-                    fi
                 fi
-                rm -f ${sroot}/${name} >/dev/null 2>&1
-                for i in 2 3 4 5; do
-                    rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1
-                done
-                for i in 0 1 6; do
-                    rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1
-                done
                 ;;
             SunOS/5.* )
                 rm -f /etc/init.d/${name} >/dev/null 2>&1