Talk:Incremental Update OpenLink 0.5x 0.73b

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 08:35, 20 October 2006 by Mindbender (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/bin/sh
#
echo "*********************************************************************"
echo "*********************************************************************"
echo "*********** Incremental-Update-Script for Openlink (PPC) ************"
echo "***********         update 0.5x -> 0.73b                 ************"
echo "***********                                              ************"
echo "***********               by mindbender                  ************"
echo "***********         from www.linkstationwiki.net         ************"
echo "*********************************************************************"
echo "*********************************************************************"
echo ""
echo "#####################################################################"
echo "#                                                                   #"
echo "# This updates should only be executed on ppc-boxes & OpenLink 0.5x #"
echo "#                                                                   #"
echo "#####################################################################"
echo ""
echo "-- Check for architecture --"
echo "only ppc-based boxes are supported currently"
echo "(get me an LS2 and i will change that)"

uname -m | grep -q ppc || ERROR="1"
if [ "$ERROR" == "1" ] ; then
        echo ""
        echo "[FATAL] currently, only PPC-based Linkstations are supported."
        echo "--> Cannot continue."
        echo ""
        exit 1
else
	echo "[INFO] This is a ppc-box."
	echo ""
fi
[ "$ERROR" == "1" ] && exit 1

echo "-------------------------------------------------------------------"

echo ""
echo "-- check if the OS really is OpenLink --"                                        

dpkg --version | grep -q Debian > /dev/null 2>&1 && OS="fl" || OS="ol"

if [ "$OS" == "fl" ] ; then
	echo ""
	echo "[FATAL] Operating System seems to be FreeLink!"
	echo "--> Cannot continue."
	echo ""
else
        echo ""
        echo "[INFO] This seems to be OpenLink"
        echo "" 
fi
[ "$OS" == "fl" ]&& exit 1

echo "-------------------------------------------------------------------"

echo ""
echo "-- Check for image-version of OpenLink --"
echo "to check the firmware version i use /etc/linkstation_release"
echo "i changed it in all my own releases..the 0.5x versions use the" 
echo "original base firmware revision without the string Openlink inside"
echo "Future scripts will check for the new version string"
echo ""

if (cat /etc/linkstation_release | grep Openlink) then
    echo "[FATAL] This OS seems to be a later version of OpenLink!"
    echo "--> Cannot continue."
    exit 1 
else
    echo "[INFO] This OS seems to be OpenLink 0.5x or former"
fi

echo "-------------------------------------------------------------------"

echo ""
echo "-- Update displayed firmware version & welcome message --"
echo "the PRODUCTID is used to differ between LS1/HG"
echo "HS releases will include all the changes when available"
echo ""

if (cat /etc/linkstation_release | grep 0x00000003) then
    echo "[INFO] Box seems to be a LS1!"
    cp LS1/linkstation_release_LS1 /etc/linkstation_release
    cp LS1/mellib.pl /www/cgi-bin/
    
    echo "" > /etc/issue
    echo "OpenLink 0.73b - PPC - HD-HLAN1 (LS1)" >> /etc/issue
    echo "www.linkstationwiki.net" >> /etc/issue
    echo "" >> /etc/issue

    echo "[INFO] welcome message (/etc/issue) updated"
    
else if (cat /etc/linkstation_release | grep 0x00000004) then
    echo "[INFO] Box seems to be a HG/HS!"
    cp HG/linkstation_release_hg /etc/linkstation_release
    cp HG/mellib.pl /www/cgi-bin/

    echo "" > /etc/issue
    echo "OpenLink 0.73b - PPC - HD-HGLAN"  >> /etc/issue
    echo "www.linkstationwiki.net" >> /etc/issue
    echo "" >> /etc/issue

    echo "[INFO] welcome message (/etc/issue) updated"
    else
        echo "[FATAL] Unknown ProductID in /etc/linkstation_release!"
        exit 1
    fi
fi    

echo ""
echo "#####################################################################"
echo "#                                                                   #"
echo "#                   Bugfixing starts here :-)                       #"
echo "#                                                                   #"
echo "#####################################################################"
echo ""

echo "create additional libssl-symlinks (MANTIS bug 00021)..."
ln -s /usr/lib/libssl.so.0.9.7 /usr/lib/libssl.so.0
ln -s /usr/lib/libssl.so.0 /usr/lib/libssl.so 
echo "...done!"

echo ""

echo "fix a bug with netatalk and missing libssl 0.96 (MANTIS BUG 00011)..."
ln -s /usr/lib/libcrypto.so.0.9.7 /usr/lib/libcrypto.so.0.9.6
echo "...done!"

echo ""

echo "move xterm-terminfo to right directory (MANTIS bug 00055)"
mv /usr/share/terminfo/k/xterm /usr/share/terminfo/x/
echo "...done!"

echo ""

echo "add terminaltype to profile"
echo "export Term=vt100" >> /etc/profile
echo "...done!"

echo ""

echo "change the color of ls to one with colors (MANTIS feature 00060)"
echo "Comment(mindbender): i always use it and i never had problems"
echo "alias ls='ls --color=auto'" >> /etc/profile
echo "...done!"

echo ""

echo "start ppc_uartd earlier (MANTIS bug 00058)"
echo "it will soon be replaced by avr_evtd"
mv /etc/rc.d/rc2.d/S??ppc_uartd /etc/rc.d/rc2.d/S12ppc_uartd
echo "...done!"

echo ""

echo "#####################################################################"
echo "#                                                                   #"
echo "#                     Removing unneeded stuff                       #"
echo "#                                                                   #"
echo "#####################################################################"
echo ""

echo "Dropbear is a lightweight SSH-Server but unfortunately it is slow."
echo "OpenSSH is more than 2 times faster (SCP-Transfers).
echo "Thats why dropbear is removed and OpenSSH is added.
echo ""

echo "Removing dropbear..."
rm -R /etc/dropbear
rm /etc/init.d/dropbear
rm /etc/rc.d/rc2.d/S??dropbear
rm /usr/sbin/dropbear
echo "...done!"

echo "" 
echo "#####################################################################"
echo "#                                                                   #"
echo "#                      Adding new features                          #"
echo "#                                                                   #"
echo "#####################################################################"
echo ""

echo "Untaring tarball..."
tar -C / -xzvf package_update_ppc_OL_0.5x-0.73b.tar.gz

echo "Busybox 1.2.1 is included in the tarball..."
echo "Adding new busybox-links"
cd /bin
ln -s busybox bbconfig
ln -s busybox dos2unix
ln -s busybox ether-wake
ln -s busybox ip
ln -s busybox ipaddr
ln -s busybox iplink
ln -s busybox iproute
ln -s busybox iptunnel
# ln -s busybox more - removed because gnu-version is included
ln -s busybox nice
ln -s busybox ping6
ln -s busybox pipe_progress
ln -s busybox stat
ln -s busybox traceroute
ln -s busybox uncompress
ln -s busybox unix2dos

cd /usr/bin
ln -s ../../bin/busybox arping
ln -s ../../bin/busybox cksum
ln -s ../../bin/busybox comm
ln -s ../../bin/busybox fakeidentd
ln -s ../../bin/busybox ftpget
ln -s ../../bin/busybox ftpput
ln -s ../../bin/busybox fuser
ln -s ../../bin/busybox last
ln -s ../../bin/busybox less
ln -s ../../bin/busybox lzmacat
ln -s ../../bin/busybox mountpoint
ln -s ../../bin/busybox nc
ln -s ../../bin/busybox nohup
ln -s ../../bin/busybox nslookup
ln -s ../../bin/busybox realpath
ln -s ../../bin/busybox renice
ln -s ../../bin/busybox telnet
ln -s ../../bin/busybox tftp
ln -s ../../bin/busybox traceroute
ln -s ../../bin/busybox unlzma
ln -s ../../bin/busybox who

cd /sbin
ln -s ../bin/busybox dnsd
# ln -s ../bin/busybox route - removed, GNU version existing
ln -s ../bin/busybox zcip 

echo ""  
echo "*********************************************************************"  
echo "*********************************************************************"
echo "****** Upgrade finished. Please reboot your box!               ******"
echo "****** Unique SSH-keys will be created then automatically.     ******"
echo "****** After that you should be able to connect via ssh.       ******"
echo "****** root-password: openlink                                 ******"
echo "*********************************************************************"
echo "*********************************************************************"
echo ""

exit 0