User:Kevgor/Mavrothal scripts for XO 1.0
Jump to navigation
Jump to search
Mavrothal make more room script
#!/bin/sh # This script will remove extra localization, dri, firmware and # 256x256 icon files from the F14-based OLPC builds for the XO-1. # Will also prevent installation of additional locales by new rpms # # mavrothal, GPL2, 2011 # # No warranties. # # version 6. Works with jffs2 # Check if it is an XO-1 XOVER=`cat /sys/class/dmi/id/product_version` if [ "$XOVER" != "1" ] ; then echo " This script is for the XO-1 only" exit 0 fi # Check if it is an OLPC build BUILDORG=`cat /etc/issue | grep OLPC` if [ "$BUILDORG" = "" ] ; then echo " This script is for OLPC builds only" exit 0 fi
# Check if it is an F14 build KERNVER=`uname -r | cut -d "." -f 3` if [ "$KERNVER" != "35" ] ; then echo " This is script is for F14 builds only" exit 0 fi
# Make sure we have language set LANGVER=`cat /home/olpc/.i18n | cut -d "\"" -f2 | cut -d "_" -f 1` if [ "$LANGVER" = "" ] ; then echo " There is no language set!" echo " Please set language in the control panel" echo " and then reboot and run this script again" sleep 5 exit 0 fi
# How much space do we have available before deletions AVAILBEF=`df -B M / | awk 'END {print $4}' | tr -d 'M'` # Delete extra locales, dri and firmware files OSVER=`ls /versions/pristine` # Make sure we do not delete needed files # mv /versions/pristine/"$OSVER"/lib/firmware/usb8388.bin . mv /versions/pristine/"$OSVER"/usr/share/locale/"$LANGVER"* . mv /versions/pristine/"$OSVER"/usr/share/locale/locale.alias . # Do delete what we do not need # rm -rf /versions/{pristine,run}/"$OSVER"/lib/firmware/* rm -rf /versions/pristine/"$OSVER"/usr/share/locale/* rm -rf /versions/pristine/"$OSVER"/usr/lib/dri/* rm -rf /versions/pristine/"$OSVER"/usr/share/icons/*/256x256 # Restore needed # mv usb8388.bin /versions/pristine/"$OSVER"/lib/firmware/ mv "$LANGVER"* /versions/pristine/"$OSVER"/usr/share/locale/ mv locale.alias /versions/pristine/"$OSVER"/usr/share/locale/ # mv /versions/run/"$OSVER"/lib/firmware/usb8388.bin mv /versions/run/"$OSVER"/usr/share/locale/"$LANGVER"* . mv /versions/run/"$OSVER"/usr/share/locale/locale.alias . # Do delete what we do not need # rm -rf /versions/run/"$OSVER"/lib/firmware/* rm -rf /versions/run/"$OSVER"/usr/share/locale/* rm -rf /versions/run/"$OSVER"/usr/lib/dri/* rm -rf /versions/run/"$OSVER"/usr/share/icons/*/256x256 # Restore needed # mv usb8388.bin /versions/run/"$OSVER"/lib/firmware/ mv "$LANGVER"* /versions/run/"$OSVER"/usr/share/locale/ mv locale.alias /versions/run/"$OSVER"/usr/share/locale/ # Prevent additional locales being installed by new RPMs LANGVERLONG=`cat /home/olpc/.i18n | cut -d "\"" -f2 | cut -d "." -f 1` echo "%_install_langs "$LANGVER":"$LANGVERLONG"" > /etc/rpm/macros.lang sleep 1 # How much space do we have available after deletions AVAILAFT=`df -B M / | awk 'END {print $4}' | tr -d 'M'` # How much did we delete DELETED=`expr $AVAILAFT - $AVAILBEF` echo " An additional $DELETED MB of disk space is now available" sleep 3 exit 0