#!/bin/sh

mv /usr/share/policy/etc/rx51/syspart.speedpatch /usr/share/policy/etc/rx51/syspart.conf

if [ -f /home/user/.profile ];then sed '/speedpatch/d' /home/user/.profile > /home/user/.profile.clean;mv /home/user/.profile.clean /home/user/.profile;fi
cat <<_EOF >> /home/user/.profile
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi # speedpatch
_EOF

if [ -f /home/user/.bashrc ];then sed '/speedpatch/d' /home/user/.bashrc > /home/user/.bashrc.clean;mv /home/user/.bashrc.clean /home/user/.bashrc;fi
cat <<_EOF >> /home/user/.bashrc
if [ "\$PS1" ] ; then mkdir -p -m 0700 /dev/cgroup/cpu/user/\$\$;echo \$\$ > /dev/cgroup/cpu/user/\$\$/tasks;echo "1" > /dev/cgroup/cpu/user/\$\$/notify_on_release;fi # speedpatch
_EOF

chmod +x /usr/sbin/cgroup_clean

exit 0
