genHardFlags revision 1.1.1.1
1#! /bin/sh 2 3args=`getopt d:f:v $*` 4set -- $args 5 6HF= 7V=": " 8 9for i 10do 11 case "$i" in 12 -d) sdir="$2" ; shift 2 ;; 13 -f) hardenfile="$2" ; shift 2 ;; 14 -v) V= ; shift ;; 15 --) shift ; break ;; 16 esac 17done 18 19case "$sdir" in 20 '') 21 sdir=. 22esac 23 24case "$hardenfile" in 25 */*) 26 HF=$hardenfile 27 ;; 28 '') 29 ;; 30 *) 31 hf=harden/$hardenfile 32 if test -f $hf 33 then 34 HF=$hf 35 fi 36 ;; 37esac 38 39# If we have a file to use (ie, HF is not empty) then look for one. 40case "$HF" in 41 '') 42 PATH=$PATH:libevent/build-aux 43 export PATH 44 set `scripts/cvo.sh @osname@ @osver@` || exit 1 45 46 CVO_OSNAME=$1 47 CVO_OSVER=$2 48 49 x=$CVO_OSVER 50 51 while true 52 do 53 case "$x" in 54 '') break ;; 55 esac 56hf=harden/$CVO_OSNAME$x 57${V}echo "Looking for <$hf>" >&2 58 if test -f $hf 59 then 60 HF=$hf 61 break 62 fi 63 case "$x" in 64 *.*) x=`echo $x | sed -e 's/\.[^.]*$//'` ;; 65 *) x= ;; 66 esac 67 done 68 case "$HF" in 69 '') 70 hf=harden/$CVO_OSNAME 71${V}echo "Looking for <$hf>" >&2 72 if test -f $hf 73 then 74 HF=$hf 75 fi 76 ;; 77 esac 78 # Handle some "aliases" 79 case "$HF" in 80 '') 81 case "$CVO_OSNAME" in 82 raspbian*) 83 hf=harden/debian 84${V}echo "Looking for <$hf>" >&2 85 if test -f $hf 86 then 87 HF=$hf 88 fi 89 ;; 90 redhat* | fedora*) 91 hf=harden/redhat 92${V}echo "Looking for <$hf>" >&2 93 if test -f $hf 94 then 95 HF=$hf 96 fi 97 ;; 98 esac 99 ;; 100 esac 101 102 # This might be a good place to see if uname returns "Linux", 103 # and if so, use a generic file for that. 104 case "$HF" in 105 '') 106 case "`uname`" in 107 Linux) 108 hf=harden/linux 109${V}echo "Looking for <$hf>" >&2 110 if test -f $hf 111 then 112 HF=$hf 113 fi 114 ;; 115 esac 116 ;; 117 esac 118 119 # Finally, 'default' 120 case "$HF" in 121 '') 122 hf=harden/default 123${V}echo "Looking for <$hf>" >&2 124 if test -f $hf 125 then 126 HF=$hf 127 fi 128 ;; 129 esac 130 131 case "$HF" in 132 '') 133 echo "No harden/XXX file found!" >&2 134 exit 1 135 ;; 136 esac 137 ;; 138esac 139 140${V}echo "Using <$HF>" >&2 141echo "GENHARDFLAGFILE=$HF" 142 143### 144 145. $HF 146 147echo "NTP_HARD_CFLAGS='$NTP_HARD_CFLAGS'" 148echo "NTP_HARD_CPPFLAGS='$NTP_HARD_CPPFLAGS'" 149echo "NTP_HARD_LDFLAGS='$NTP_HARD_LDFLAGS'" 150echo GENHARDFLAG=OK 151 152exit 0 153