User:Kevgor/Mavrothal scripts for XO 1.0: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Created page with '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. #…')
 
No edit summary
Line 11: Line 11:
#
#
# version 6. Works with jffs2
# version 6. Works with jffs2

# Check if it is an XO-1
# Check if it is an XO-1
XOVER=`cat /sys/class/dmi/id/product_version`
XOVER=`cat /sys/class/dmi/id/product_version`
if [ "$XOVER" != "1" ] ; then
if [ "$XOVER" != "1" ] ; then
echo " This script is for the XO-1 only"
echo " This script is for the XO-1 only"
exit 0
exit 0
fi
fi

# Check if it is an OLPC build
# Check if it is an OLPC build
BUILDORG=`cat /etc/issue | grep OLPC`
BUILDORG=`cat /etc/issue | grep OLPC`
if [ "$BUILDORG" = "" ] ; then
if [ "$BUILDORG" = "" ] ; then
echo " This script is for OLPC builds only"
echo " This script is for OLPC builds only"
exit 0
exit 0
fi
fi


Line 30: Line 30:
if [ "$KERNVER" != "35" ] ; then
if [ "$KERNVER" != "35" ] ; then
echo " This is script is for F14 builds only"
echo " This is script is for F14 builds only"
exit 0
exit 0
fi
fi


Line 45: Line 45:
# How much space do we have available before deletions
# How much space do we have available before deletions
AVAILBEF=`df -B M / | awk 'END {print $4}' | tr -d 'M'`
AVAILBEF=`df -B M / | awk 'END {print $4}' | tr -d 'M'`

# Delete extra locales, dri and firmware files
# Delete extra locales, dri and firmware files
OSVER=`ls /versions/pristine`
OSVER=`ls /versions/pristine`
# Make sure we do not delete needed files
# Make sure we do not delete needed files
# mv /versions/pristine/"$OSVER"/lib/firmware/usb8388.bin .
# mv /versions/pristine/"$OSVER"/lib/firmware/usb8388.bin .
mv /versions/pristine/"$OSVER"/usr/share/locale/"$LANGVER"* .
mv /versions/pristine/"$OSVER"/usr/share/locale/"$LANGVER"* .
Line 62: Line 62:
mv "$LANGVER"* /versions/pristine/"$OSVER"/usr/share/locale/
mv "$LANGVER"* /versions/pristine/"$OSVER"/usr/share/locale/
mv locale.alias /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"/lib/firmware/usb8388.bin
mv /versions/run/"$OSVER"/usr/share/locale/"$LANGVER"* .
mv /versions/run/"$OSVER"/usr/share/locale/"$LANGVER"* .
Line 75: Line 75:
mv "$LANGVER"* /versions/run/"$OSVER"/usr/share/locale/
mv "$LANGVER"* /versions/run/"$OSVER"/usr/share/locale/
mv locale.alias /versions/run/"$OSVER"/usr/share/locale/
mv locale.alias /versions/run/"$OSVER"/usr/share/locale/

# Prevent additional locales being installed by new RPMs
# Prevent additional locales being installed by new RPMs
LANGVERLONG=`cat /home/olpc/.i18n | cut -d "\"" -f2 | cut -d "." -f 1`
LANGVERLONG=`cat /home/olpc/.i18n | cut -d "\"" -f2 | cut -d "." -f 1`
echo "%_install_langs "$LANGVER":"$LANGVERLONG"" > /etc/rpm/macros.lang
echo "%_install_langs "$LANGVER":"$LANGVERLONG"" > /etc/rpm/macros.lang
sleep 1
sleep 1
# How much space do we have available after deletions
# How much space do we have available after deletions
AVAILAFT=`df -B M / | awk 'END {print $4}' | tr -d 'M'`
AVAILAFT=`df -B M / | awk 'END {print $4}' | tr -d 'M'`

# How much did we delete
# How much did we delete
DELETED=`expr $AVAILAFT - $AVAILBEF`
DELETED=`expr $AVAILAFT - $AVAILBEF`

Revision as of 13:11, 2 October 2011

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