Ignore:
Timestamp:
Nov 4, 2009 10:27:02 AM (11 years ago)
Author:
sponge <sponge@…>
Branches:
master
Children:
a3b1c790
Parents:
b65865b8
Message:

Fixups to Slackware scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Slackware/i2p-base/doinst.sh

    rb65865b8 r5190b2d  
    11#!/bin/sh
     2#
     3#
     4# Now in the future we only need to look for '#I2P' and '#/I2P'
     5# for modifications to rc.local and rc.local_shutdown.
     6# I was a moron for not doing it this way in the first place :-) -- Sponge
     7#
     8#
     9
    210touch /etc/rc.d/rc.local
    311touch /etc/rc.d/rc.local_shutdown
    412
    5 I2PRCA=`grep -c /etc/rc.d/rc.local -e i2p`
    6 I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e i2p`
    7 
    813echo
     14echo -n "Check 1: /etc/rc.d/rc.local "
     15I2PRCA=`grep -c /etc/rc.d/rc.local -e '/etc/rc.d/rc.i2p'`
    916
    1017if [ $I2PRCA -eq 0 ] ; then
     18        echo '#I2P' >> /etc/rc.d/rc.local
     19        echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
    1120        echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
    1221        echo "        sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
    1322        echo "fi" >> /etc/rc.d/rc.local
    14         echo "/etc/rc.d/rc.local modified."
     23        echo '#/I2P' >> /etc/rc.d/rc.local
     24        echo "modified."
    1525else
    16         echo "/etc/rc.d/rc.local looks OK"
     26        echo -n "looks OK so far,"
     27        # Fix old installs, or where people have modified.
     28
     29        echo -n " Check 1A: "
     30        I2PRCC=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
     31
     32        if [ $I2PRCC -eq 0 ] ; then
     33                DATA=$(cat /etc/rc.d/rc.local | sed -re 's/if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/#I2P\n\( cd \/tmp ; rm -Rf i2p-*.tmp \)\nif \[ -x \/etc\/rc.d\/rc.i2p \] ; then/')
     34                echo "${DATA}" > /etc/rc.d/rc.local
     35                echo -n "additional modifications applied,"
     36        else
     37                echo -n "looks OK so far,"
     38        fi
     39
     40        echo -n " Check 1B: "
     41        I2PRCE=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
     42        if [ $I2PRCE -eq 0 ] ; then
     43                DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/i2p-\*\.tmp/p' | sed '$d' )
     44                DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/i2p-\*\.tmp/,$p' | sed -n '/^fi/,$p' | sed "1d")
     45                echo "${DATATOP}" > /etc/rc.d/rc.local
     46                echo '#I2P' >> /etc/rc.d/rc.local
     47                echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
     48                echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
     49                echo "        sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
     50                echo "fi" >> /etc/rc.d/rc.local
     51                echo '#/I2P' >> /etc/rc.d/rc.local
     52                echo "${DATABOT}" >> /etc/rc.d/rc.local
     53               
     54                echo -n "additional modifications applied,"
     55        else
     56                echo -n "looks ok so far,"
     57        fi
     58        echo -n " Check 1C: "
     59        I2PRCF=`grep -c /etc/rc.d/rc.local -e '#/I2P'`
     60        if [ $I2PRCF -eq 0 ] ; then
     61                DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/^#I2P/p' | sed '$d' )
     62                DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
     63                echo "${DATATOP}" > /etc/rc.d/rc.local
     64                echo '#I2P' >> /etc/rc.d/rc.local
     65                echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
     66                echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
     67                echo "        sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
     68                echo "fi" >> /etc/rc.d/rc.local
     69                echo '#/I2P' >> /etc/rc.d/rc.local
     70                echo "${DATABOT}" >> /etc/rc.d/rc.local
     71
     72                echo -n "additional modifications applied,"
     73        else
     74                echo -n "looks ok so far,"
     75        fi
     76        echo " Done."
    1777fi
    1878
     79echo -n "Check 2: /etc/rc.d/rc.local_shutdown "
     80I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e '/etc/rc.d/rc.i2p'`
    1981if [ $I2PRCB -eq 0 ] ; then
     82        echo "#I2P" >> /etc/rc.d/rc.local_shutdown
    2083        echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
    2184        echo "        sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
    2285        echo "fi" >> /etc/rc.d/rc.local_shutdown
    23         echo "/etc/rc.d/rc.local_shutdown modified."
     86        echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
     87        echo "modified."
    2488else
    25         echo "/etc/rc.d/rc.local_shutdown looks OK"
     89        echo -n "looks OK so far,"
     90        # Fix old installs
     91
     92        echo -n " Check 1A: "
     93        I2PRCG=`grep -c /etc/rc.d/rc.local_shutdown -e '#I2P'`
     94        if [ $I2PRCG -eq 0 ] ; then
     95                DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/p' | sed '$d' )
     96                DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/,$p' | sed -n '/^fi/,$p' | sed "1d")
     97                echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
     98                echo '#I2P' >> /etc/rc.d/rc.local_shutdown
     99                echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
     100                echo "        sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
     101                echo "fi" >> /etc/rc.d/rc.local_shutdown
     102                echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
     103                echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
     104                echo -n "additional modifications applied,"
     105        else
     106                echo -n "looks OK so far,"
     107        fi
     108        echo -n " Check 1B: "
     109        I2PRCH=`grep -c /etc/rc.d/rc.local_shutdown -e '#/I2P'`
     110        if [ $I2PRCH -eq 0 ] ; then
     111                DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^#I2P/p' | sed '$d' )
     112                DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
     113                echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
     114                echo '#I2P' >> /etc/rc.d/rc.local_shutdown
     115                echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
     116                echo "        sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
     117                echo "fi" >> /etc/rc.d/rc.local_shutdown
     118                echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
     119                echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
     120                echo -n "additional modifications applied,"
     121        else
     122                echo -n "looks OK so far,"
     123        fi
     124        echo " Done."
    26125fi
    27126
     
    30129                chmod +x /etc/rc.d/rc.i2p.new
    31130        fi
    32         echo
     131        # Hopefully get admin's attention.
     132        echo -ne "\007" ; sleep 0.3
     133        echo -ne "\007" ; sleep 0.3
     134        echo -ne "\007" ; sleep 0.3
     135        echo -ne "\007" ; sleep 0.3
     136        echo -ne "\007" ; sleep 0.3
     137        echo -ne "\007" ; sleep 0.3
     138        echo -e "\007" ; sleep 0.3
    33139        echo "It apears that you already have /etc/rc.d/rc.i2p"
    34         echo "You may wish to replace it with /etc/rc.d/rc.i2p.new"
    35         echo
     140        echo "You should replace it with /etc/rc.d/rc.i2p.new as soon as possible"
     141        echo -ne "\007" ; sleep 0.3
     142        echo -ne "\007" ; sleep 0.3
     143        echo -ne "\007" ; sleep 0.3
     144        echo -ne "\007" ; sleep 0.3
     145        echo -ne "\007" ; sleep 0.3
     146        echo -ne "\007" ; sleep 0.3
     147        echo -e "\007" ; sleep 0.3
    36148else
    37149        mv /etc/rc.d/rc.i2p.new /etc/rc.d/rc.i2p
    38150        echo
    39151        echo "Installation finished. The i2p start/stop script has been"
    40         echo "installed on /etc/rc.d directory. You should chmod +x"
     152        echo "installed in /etc/rc.d . You should chmod +x"
    41153        echo '/etc/rc.d/rc.i2p to start it on boot.'
    42154        echo
Note: See TracChangeset for help on using the changeset viewer.