Jerrik skrev:Er scriptet til 64 bit ?
Det kan
file kommandoen fortælle dig:
cgroup_patch: Bourne-Again shell script text executable
Du kan også bare læse første linie af scriptet for at se det. hvis du læser hele scriptet opdager du en ting mere
Kode: Vælg alt
#!/bin/bash
#credits: superpiwi
#http://ubuntulife.wordpress.com/2010/11/22/el-parche-milagro-de-linux-ahora-con-script-de-instalacion/
#in English and with 3 small fixes by Andrew @ http://www.webupd8.org
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# PARCHEAR
#
# Aplica las mejoras del kernel (parche de 200 lineas)
# pero en 4 lineas de bash.
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function PARCHEAR ()
{
FICHERO="$HOME/.bashrc"
echo ""
echo -e $YELLOW"Patching [${FICHERO}]..."$ENDCOLOR
echo ""
# Añadiendo cadenas a .bashrc
# Primero buscamos una cadena "base" para ver si esta o no ya añadido
LINEAS=`cat $FICHERO | grep "/dev/cgroup/cpu/user" | wc -l`
if [ "$LINEAS" == "0" ];
then
echo "Adding the patch..."
echo "if [ \"\$PS1\" ] ; then" | tee -a $FICHERO
echo "mkdir -p -m 0700 /dev/cgroup/cpu/user/\$\$ > /dev/null 2>&1" | tee -a $FICHERO
echo "echo \$\$ > /dev/cgroup/cpu/user/\$\$/tasks" | tee -a $FICHERO
echo "echo \"1\" > /dev/cgroup/cpu/user/\$\$/notify_on_release" | tee -a $FICHERO
echo "fi" | tee -a $FICHERO
else
echo "It seems the patch is already included in $FICHERO"
fi
FICHERO="/etc/rc.local"
echo ""
echo -e $YELLOW"Patching [${FICHERO}]..."$ENDCOLOR
echo ""
# Añadiendo cadenas a /etc/rc.local
# Primero buscamos una cadena "base" para ver si esta o no ya añadido
LINEAS=`cat $FICHERO | grep "/dev/cgroup/cpu/release_agent" | wc -l`
if [ "$LINEAS" == "0" ];
then
echo "Adding the patch..."
POSI=`cat $FICHERO | grep -n "exit 0" | sort -nr | head -n 1 | awk -F: '{print $1}'`
#echo "Posi es [$POSI]"
echo "Making backup of $FICHERO in /etc/rc.local.backup.txt"
cp /etc/rc.local /etc/rc.local.backup.txt
sed "${POSI}imkdir -p /dev/cgroup/cpu\nmount -t cgroup cgroup /dev/cgroup/cpu -o cpu\nmkdir -m 0777 /dev/cgroup/cpu/user\necho \"/usr/local/sbin/cgroup_clean\" > /dev/cgroup/cpu/release_agent" /etc/rc.local | tee /etc/rc.new.local
mv /etc/rc.new.local /etc/rc.local
#echo "#========== 200 lines kernel patch alternative ============" | tee -a $FICHERO
#echo "mkdir -p /dev/cgroup/cpu" | tee -a $FICHERO
#echo "mount -t cgroup cgroup /dev/cgroup/cpu -o cpu" | tee -a $FICHERO
#echo "mkdir -m 0777 /dev/cgroup/cpu/user" | tee -a $FICHERO
#echo "echo \"/usr/local/sbin/cgroup_clean\" > /dev/cgroup/cpu/release_agent" | tee -a $FICHERO
#echo "#====================================" | tee -a $FICHERO
else
echo "It seems the patch is already included in $FICHERO"
fi
echo ""
echo -e $YELLOW"Making [${FICHERO}] executable"$ENDCOLOR
echo ""
sudo chmod +x $FICHERO
FICHERO="/usr/local/sbin/cgroup_clean"
echo ""
echo -e $YELLOW"Creating [${FICHERO}]..."$ENDCOLOR
echo ""
if [ ! -e $FICHERO ];
then
echo "#!/bin/sh" | tee $FICHERO
echo "if [ \"\$*\" != \"/user\" ]; then" | tee -a $FICHERO
echo "rmdir /dev/cgroup/cpu/\$*" | tee -a $FICHERO
echo "fi" | tee -a $FICHERO
else
echo "File $FICHERO already exists."
fi;
echo ""
echo -e $YELLOW"Making [${FICHERO}] executable"$ENDCOLOR
echo ""
sudo chmod +x $FICHERO
echo "DONE. The patch has been applied. Restart your computer..."
}
#-----------------------------------------------------------------------------
# Comprobar que eres usuario root
if [ $USER != root ]; then
echo -e $RED"Error: you need to run this script as root."
echo -e $YELLOW"Exiting..."$ENDCOLOR
exit 0
fi
# Parchear el Sistema
PARCHEAR
# end of parche.sh
Som du kan se i kildekoden , altså Ja: Scriptet erstatter fuldstændigt den kerne
patch. Den gør faktisk det samme som kerne patchen ved at bruge /dev filsystemet, som er et vindue ind til kernen - det gøres ved hjælp af et bash shell script
... og det virker
Du installerer det sådan her:
Kode: Vælg alt
cd;wget http://launchpadlibrarian.net/59511828/cgroup_patch;chmod +x cgroup_patch;sudo ./cgroup_patch
For at få det til at virke, så genstarter du, eller kører:
uden at skulle genstarte
/Lars
Credits:
The shell code is from
http://launchpadlibrarian.net/59511828/cgroup_patch, and the install and start scripts are from
http://www.webupd8.org/2010/11/script-to-automatically-apply-200-lines.html
Jeg er Software ingeniør (Diplomingeniør) i Informationsteknologi og
indlejede systemer, hvor indlejrede systemer
er computer (microcontroller) + elektronik i for eksempel et TV, en router, en vaskemaskine og den slags