81 lines
2.2 KiB
Bash
Executable file
81 lines
2.2 KiB
Bash
Executable file
#!/bin/sh
|
|
set -x
|
|
|
|
CWD=$(pwd)
|
|
|
|
PKGNAM=$(basename $CWD)
|
|
PRGNAM=$(echo $PKGNAM | sed 's|-firmware||')
|
|
VERSION=${VERSION:-$(ls -ut $PRGNAM*.tar.?z*| head -n1 | cut -d_ -f3 | sed 's|.tar.*||')}
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
TAG=cyco
|
|
TMP=${TMP:-/tmp/$TAG}
|
|
PKG=$TMP/pkg-$PKGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
PREFIX=${PREFIX:-/usr}
|
|
|
|
# Cleaning
|
|
rm -fr $TMP/$PKGNAM-$VERSION
|
|
rm -fr $PKG
|
|
|
|
mkdir -p $TMP/
|
|
|
|
tar -C $TMP -xf $CWD/${PRGNAM}_linux_$VERSION.tar.gz
|
|
mv $TMP/${PRGNAM}_linux_$VERSION $TMP/$PKGNAM-$VERSION
|
|
|
|
cd $TMP/$PKGNAM-$VERSION
|
|
# Preparation
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
mkdir -p $PKG/lib/firmware
|
|
cp -R firmware/RTL8192SE/*.bin $PKG/lib/firmware
|
|
( cd $PKG/lib/firmware
|
|
ln -s rtl8192sfw.bin rtl8192sefw.bin
|
|
)
|
|
|
|
mkdir -p $PKG/usr/doc/$PKGNAM
|
|
cp readme.txt release_note $PKG/usr/doc/$PKGNAM
|
|
mv $PKG/lib/firmware/RTL8192SE/Realtek-Firmware-License.txt $PKG/usr/doc/$PKGNAM
|
|
|
|
cd $PKG
|
|
# Cleaning
|
|
chown -R root:root .
|
|
find . -type d -exec chmod 755 {} \;
|
|
find . -type f -exec chmod 644 {} \;
|
|
|
|
# Packaging
|
|
mkdir install
|
|
cat <<EOF > install/doinst.sh
|
|
#!/bin/sh
|
|
|
|
grep r8192_pci.ko /lib/modules/\$(uname -r)/modules.dep && rm -fr /lib/modules/\$(uname -r)/kernel/drivers/staging/rtl8192e/ || echo > /dev/null
|
|
grep r8192se_pci.ko /lib/modules/\$(uname -r)/modules.dep && rm -fr /lib/modules/\$(uname -r)/kernel/ubuntu/rtl8192se/* || echo > /dev/null
|
|
rm -f /etc/acpi/wireless-rtl-ac-dc-power.sh
|
|
rm -f /etc/acpi/events/RadioPower.sh
|
|
|
|
depmod -a
|
|
EOF
|
|
cat <<EOF > install/slack-desc
|
|
$PKGNAM: $PKGNAM (RTL8192SE firmware)
|
|
$PKGNAM:
|
|
$PKGNAM: This firmware supports RealTek rtl8192SE PCI Wireless LAN NIC
|
|
$PKGNAM:
|
|
$PKGNAM: http://realtek.com
|
|
$PKGNAM: http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true
|
|
$PKGNAM:
|
|
$PKGNAM: the 3 "official" mirrors:
|
|
$PKGNAM: ftp://WebUser:pGL7E6v@202.134.71.21/cn/wlan/
|
|
$PKGNAM: ftp://WebUser:pGL7E6v@208.70.202.219/cn/wlan/
|
|
$PKGNAM: ftp://WebUser:pGL7E6v@218.210.127.132/cn/wlan/
|
|
EOF
|
|
|
|
makepkg -l y -c n $OUTPUT/$PKGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz
|