This file is indexed.

/usr/share/tcos/hooks-addons/03wireless is in initramfs-tools-tcos 0.89.86.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# hook addon for wireless
# need wireless-tools (firmware....)


if [ ! $TCOS_WIRELESS ]; then
  _verbose "(03wireless) TCOS_WIRELESS disabled"
else
  stat_before

  # copy wireless utils (some aren't necesary)
  cpifexists /sbin/iwconfig  /sbin/
  cpifexists /sbin/iwevent   /sbin/
  cpifexists /sbin/iwgetid   /sbin/
  cpifexists /sbin/iwlist    /sbin/
  cpifexists /sbin/iwpriv    /sbin/
  cpifexists /sbin/iwspy     /sbin/

  # copy udev firmware agent
  mkdir -p $DESTDIR/lib/udev
  cp -ra /lib/udev/firmware* $DESTDIR/lib/udev/ >/dev/null 2>&1

  if [ -d /lib/firmware/${TCOS_KERNEL} ];then
    firmwaredir="/lib/firmware/${TCOS_KERNEL}"
    mkdir -p "${DESTDIR}${firmwaredir}"
  else
    firmwaredir="/lib/firmware"
    mkdir -p "${DESTDIR}${firmwaredir}"
  fi

  # generic modules

  manual_add_modules arc4
  manual_add_modules ecb
  manual_add_modules michael_mic
  manual_add_modules ieee80211
  #manual_add_modules rc80211_simple
  manual_add_modules mac80211
  manual_add_modules ieee80211_crypt
  manual_add_modules ieee80211softmac
  manual_add_modules ieee80211_crypt_tkip
  manual_add_modules ieee80211_crypt_wep
  manual_add_modules ieee80211_crypt_ccmp

  # copy kernel modules
  for mod in $TCOS_WIRELESS_MODS; do

    manual_add_modules $mod
    if [ "$mod" = "ipw2200" ]; then
      _echo "   WIFI: Copying firmware of ipw2200"
      cp -ra ${firmwaredir}/ipw2200* ${DESTDIR}${firmwaredir}
    
    elif [ "$mod" = "ipw2100" ]; then
      _echo "   WIFI: Copying firmware of ipw2100"
      cp -ra ${firmwaredir}/ipw2100* ${DESTDIR}${firmwaredir}
    
    elif [ "$mod" = "madwifi" ]; then
      _echo "   WIFI: Copying madwifi modules"
      #ath-pci ath-hal wlan_tkip wlan_scan_sta ath-hal
      manual_add_modules ath-pci
      manual_add_modules ath-hal
      manual_add_modules wlan-tkip
      manual_add_modules wlan-scan-sta
    
    elif [ "$mod" = "ndiswrapper" ]; then
      _echo "   WIFI: ndiswrapper not supported (perl based)"
    

    elif [ "$mod" = "zd1211" ]; then
      _echo "   WIFI: Copying Zydas modules and firmware"
       manual_add_modules zd1211rw
       # firmware
       #mkdir -p $DESTDIR/lib/firmware/
       cp -ra ${firmwaredir}/zd1211/ ${DESTDIR}${firmwaredir}
       cat << EOF > $DESTDIR/scripts/tcos-top/02zydas_firmware
#!/bin/sh
if [ "\$1" = "prereqs" ]; then
  exit 0
fi

mkdir -p /usr/lib/hotplug/firmware/
ln -s ${firmwaredir}/zd1211/zd1211_ub /usr/lib/hotplug/firmware/zd1211-WS11Ub.fw
ln -s ${firmwaredir}/zd1211/zd1211_uph /usr/lib/hotplug/firmware/zd1211-WS11UPh.fw
ln -s ${firmwaredir}/zd1211/zd1211_uphm /usr/lib/hotplug/firmware/zd1211-WS11UPhm.fw
ln -s ${firmwaredir}/zd1211/zd1211_uphr /usr/lib/hotplug/firmware/zd1211-WS11UPhR.fw
ln -s ${firmwaredir}/zd1211/zd1211_ur /usr/lib/hotplug/firmware/zd1211-WS11Ur.fw

EOF
       chmod +x $DESTDIR/scripts/tcos-top/02zydas_firmware

    elif [ "$mod" = "rt61" -o "$mod" = "rt2561" -o "$mod" = "rt61pci" ]; then
      _echo "   WIFI: Copying firmware of rt61/2561"
      cp -ra ${firmwaredir}/rt2* ${DESTDIR}${firmwaredir}

    elif [ "$mod" = "rt73" -o "$mod" = "rt73usb" ]; then
      _echo "   WIFI: Copying firmware of rt73"
      cp -ra ${firmwaredir}/rt7* ${DESTDIR}${firmwaredir}

    elif [ "$mod" = "bcm43xx" -o "$mod" = "broadcom" ]; then
      _echo "   WIFI: Copying firmware of bcm43xx"
      [ -e /lib/firmware/bcm43* ] && cp -ra /lib/firmware/bcm43* ${DESTDIR}/lib/firmware
      cp -ra ${firmwaredir}/bcm43* ${DESTDIR}${firmwaredir}

    else
      _echo "   WIFI: Trying to copy unknow firmware"
      cp -ra ${firmwaredir}/$mod* ${DESTDIR}${firmwaredir} 2>/dev/null
    fi # end of if module    
    
  done # end of modules for loop

   if [ "$TCOS_WIRELESS_ENC" = "WEP" ]; then
      _echo "  DEBUG: using WEP..."
      if [ ! $TCOS_WIRELESS_KEY ]; then
          _echo ""
          _echo "    WARNING:"
          _echo "      Configured Wireless with WEP encription, but TCOS_WIRELESS_KEY is empty"
          _echo "      Put your wireless key into this var in a supported format (HEX or ASCII)."
          _echo "      See: man iwconfig (section key)"
          _echo ""
      fi
   fi

   if [ "$TCOS_WIRELESS_ENC" = "WPA" ]; then
      cpifexists /sbin/wpa_action      /sbin/
      cpifexists /sbin/wpa_cli         /sbin/
      cpifexists /sbin/wpa_supplicant  /sbin/
      cpifexists /usr/bin/wpa_passphrase   /sbin/
      # need linked libs in /lib not /usr/lib
      for lib in $(_ldd /sbin/wpa_supplicant /sbin/wpa_action /sbin/wpa_cli /usr/bin/wpa_passphrase | awk '{print $3}' |grep ^/); do
        newlib=$(echo $lib | sed s/"\/i686\/cmov"//g | sed s/"\/tls"//g )
        #_echo "   DEBUG: WPA: copying lib=$lib newlib=$newlib"
        if [ -e $newlib ]; then
          if [ ! -e $DESTDIR/lib/$(basename $lib) ]; then
            cp $newlib $DESTDIR/lib/
          #else
          #  _echo "  DEBUG: WPA: $newlib is in image, not copy."
          fi
        else
          _echo "  DEBUG: WPA: ### ERROR ### $newlib or $lib not found !!!!"
        fi
      done


      copydir /etc/wpa_supplicant      /etc/
cat << EOF > $DESTDIR/sbin/start-wpa.sh
#!/bin/sh

. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions

TCOS_NET_WIFI_ESSID=\$(read_cmdline_var "essid" "")

TCOS_WIRELESS_DEV=\$1
if [ "\$TCOS_WIRELESS_DEV" = "" ]; then
   echo "Error, need a wireless network device name"
   echo " example: \$0 ath0"
   echo " example: \$0 wlan0"
fi

WPA_CONF=\$(ls /etc/wpa_supplicant/*conf 2>/dev/null)
if [ "\$WPA_CONF" = "" ]; then
   psk=\$(wpa_passphrase "\${TCOS_NET_WIFI_ESSID}" "\${TCOS_WIRELESS_KEY}" | sed 's/[[:blank:]]//g' | awk -F"=" '/^psk=/ {print \$2}')

   WPA_CONF=/etc/wpa_supplicant/wpa_supplicant.conf
   cat << EOC > \$WPA_CONF
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="\${TCOS_NET_WIFI_ESSID}"
proto=\${TCOS_WIRELESS_ENC}
key_mgmt=WPA-PSK
psk=\$psk
}
EOC

fi

PID=/var/run/wpa_supplicant.\${TCOS_WIRELESS_DEV}.pid
#WPA_RUN=/var/run/wpa_supplicant

wpa_supplicant -B -P\$PID -i\${TCOS_WIRELESS_DEV} -c\${WPA_CONF}

EOF
     chmod +x $DESTDIR/sbin/start-wpa.sh
   fi

 stat_after "Wireless support"
fi