User:Joerg rw/tools

This is the most recent version! 2013-01-05

All these hacks are tested on PR1.2(!!), but the cmdlines here are just off top of my head, so maybe typos or sth can be found. Lots of it will work on PR1.3 as well, but I haven't tested anything for PR1.3 yet. "Tested" on CSSU-Tmaemo5.1 Please report on http://wiki.maemo.org/index.php?title=User_talk:Joerg_rw/tools&action=edit . Thanks! Actually recent switching to PR1.3 + Community-SSU resulted in a quite similar set of system properties. So most of the things below are not needed anymore, except of course the gnu sanitizing of busybox crap.

So first install CSSU! http://wiki.maemo.org/Community_SSU -- EDIT: no, first read next paragraph about patching eMMC image prior to flashing, since obviously you should flash before installing anything, not after ;-)

You did that? Fine, let's go on...

DO NOT install speedpatch, batterypatch, or auto-disconnect _ever_!! All three do not uninstall and do not work.

To make the plastic case melt and burn your fingers and your cat, click http://joerg.cloud-7.de/repositories.install (includes the catalogs aka repositories test, devel, and tools. Attention, will create dups, so check your catalog list in HAM anyway. You should keep all three catalogs usually disabled in HAM!)


If you feel like, patch eMMC aka *VANILLA* image file for larger /home partition (/opt is a bindmount to /home/opt, so this is also a way to have more free space to install apps) - much easier than repartitioning the N900 *after* flashing. So if that's not obvious, this part is meant to be done on your linux desktop PC, prior to fresh full flash of N900):

NEW-HOME-SIZE=4096
# Size is in MB, tested up to 8192, changing number of chars known to 
# break things, so for 5digit values you might need more sophisticated edits.
# Theoretical limit ~28GB
sed -e "s/2048/$NEW-HOME-SIZE/" path/to/*VANILLA*.bin >patched-VANILLA.bin

the section in this image file is close to the head of file and looks like:

mmc {
        name = "internal";
        partition {
                fs_type = "vfat";
                prefix = "mydocs";
                no_create = true;
        }
        partition {
                size = 2048;
                fs_type = "ext3";
                prefix = "home";
        }
        partition {
                size = 768;
                fs_type = "swap";
        }
}

as this looks like a format free grammar, it's probably possible to "steal" whitespace from start of line to allow for 5 digit numbers . Something like:

sed -e "s/.size = 2048/size = 16192/" path/to/*VANILLA*.bin >patched-VANILLA.bin


Miniwrapper for apt-get logs. The text below is intended to c&p to N900 xterm, or ssh session to N900 on your PC (all in a root account where not mentioned otherwise - first snippet takes care of this by the first line "root"). You should highlight a whole white box or at least a whole § beginning with ####line and insert the whole text as one chunk to your N900 or ssh remote terminal. I took care about long lines by continuation\ marks\ so don't break up a block that consists of lines ending with \


root
cat >/usr/local/bin/apt-get <<"wikiETX"
#! /bin/sh
## file /usr/local/bin/apt-get
## due to $PATH will override original apt-get cmd and create
## a file installed-aps.sh in ~root/ which can be sourced to redo
## all the apps installed via `apt-get install <app>`

ag=/usr/bin/apt-get
case "$1" in
 "install")
    echo '############ logged install ###########'
    $ag "$@" && echo "$ag $@ ;#`date`" >>$HOME/installed-aps.sh
    ;;
 "dist-upgrade"|"autoremove")
    # autoremove kills rtcom-accounts-voip-support
    # see http://talk.maemo.org/showthread.php?t=70875
    echo "NONONO!! Don't do that!"
    exit 5
    ;;
 *)
    $ag "$@"
esac
wikiETX
chmod a+x /usr/local/bin/apt-get


proper bash and tools

apt-get install bash3

cat <<"wikietx" >/home/user/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.

PATH=/usr/bin/gnu:$PATH
export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
#### for unclear reasons messybox feels obliged to source .bashrc >:-(
#### so this will break the messy ls, and you'll need to use bash
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
#alias rm='rm -i'
#alias cp='cp -i'
#alias mv='mv -i'
wikietx

cp /home/user/.bashrc /root/

chown user /home/user/.bashrc

apt-get install coreutils-gnu

### breaks cssu-t5.1 MP, so it's commented out. Use on own peril: 
### apt-get install procps

apt-get install less
apt-get install findutils
apt-get install locate

###obsolete since repo pkg fixed:
####patch updatedb to avoid borked messybox find:
###sed -i 's@{BINDIR}/find@{BINDIR}/gfind@' /usr/bin/gnu/updatedb

apt-get install man-db-n900

random stuff to config / fix 'things' (c&p to shell)


###########################################
# disable annoying xchat notifications introduced with some more recent update
# goes along with 'undocumented' command /notify_mode -vl - thanks cehteh :-/
mv /usr/lib/xchat/plugins /usr/lib/xchat/plugins_disabled


###########################################
# master device name, replace with iroN900 *your* fav name
echo IroN900 >/etc/hostname


############################################ 
# kill that cherry PITA, before it sends SMS  --  STILL ACTUAL!
# see http://wiki.maemo.org/PR1.2_compulsory_My_Nokia_subscription
touch /home/user/.cherry_state


###########################################
##   OBSOLETE with CSSU, so now commented out #o#   #####
# fix annoying hildon-desktop cpu hog bug
## new: with ctrl-BS for nice taskswitching, see
## http://my.arava.co.il/~matan/repo/Modified_Hildon_Desktop.html
## and http://share.ovi.com/media/joerg900.screenshots/joerg900.10092 video

#o#cd ~user/MyDocs/tmp/

##wget http://mohammadag.xceleo.org/repo/pool/\
##free/h/hildon-desktop/hildon-desktop_2.2.142-1_armel.deb
#o#wget http://my.svgalib.org/770/n900/hd-2.2.141/\
#o#modified-hildon-desktop_3.1_armel.deb

##dpkg -i hildon-desktop_2.2.142-1_armel.deb
#o#dpkg -i modified-hildon-desktop_3.1_armel.deb

#o#killall hildon-desktop

# set ctl-BS to my preferred operation mode, '
##     also for CSSU!!'   ##
#
# As it seems I haven't documented it elsewhere, here are the nifty 
# keypress-sequences.
#      (C=control, B=backspace, Cd=control-press-and-hold, Cu=control-release)
# Cd,Bd = open taskswitcher; Bu,Bd = roll forward; Cu,Cd = roll-backward
# Bu,Cu = select upper leftmost / Cu,Bu = keep taskswitcher open
# with taskswitcher open: 
#  "q"|"w"|"e"\"a"|"s"|"f"... select app at that pos
#  Shift+"q"|"w"... close that app

gconftool-2 -s \
 /apps/osso/hildon-desktop/key-actions/ctrl_backspace_in_tasknav -t int 5

##   OBSOLETE with CSSU   #o# #####
#... and restore apt-get install (it's a metapkg, 
# so nothing bad seems to happen)
# might want to apt-get install it prior to next SSU to PR1.3
#o#apt-get remove mp-fremantle-generic-pr



###########################################
# fix NOPASSWD for root / sudo gainroot
# this will allow your N900 to ask for ROOT password on "root" 
# and "sudo gainroot" as it's supposed to be
# MAKE SURE YOU'VE SET PROPER ROOT PASSWORD PRIOR TO THIS! In expression
# type
#    root
#    passwd
# and enter your root password two times, then (as root) do
sed -e "s/Defaults env_reset/Defaults env_reset\nDefaults targetpw/;\
 s+user ALL = NOPASSWD: /usr/sbin/gainroot+user ALL = PASSWD: /usr/sbin/gainroot+" \
 -i  /etc/sudoers.d/01sudo
update-sudoers
#this is how my 01sudo looks after the edit (excerpt):
# Defaults env_reset
# Defaults targetpw
# user ALL = PASSWD: /usr/sbin/gainroot
# user ALL = NOPASSWD: /usr/sbin/mmc-mount /dev/mmcblk0 /media/mmc1




###########################################
# nice trackerd, doesn't exactly make it bearable, but somewhat less sucking
sed -i -e "s/Throttle=0/Throttle=10/" /home/user/.config/tracker/tracker.cfg

###########################################
# "fix" the hold-key=sym nonsense
# http://wiki.maemo.org/Customizing_Maemo#Keyboard_Sym_on_auto_hold
gconftool-2 -s /apps/osso/inputmethod/ext_kb_repeat_enabled --type boolean true


###########################################
##   OBSOLETE with CSSU   #o######
# NK-Enter bug, putting less +/, htop "search", and many other back to proper
# https://bugs.maemo.org/show_bug.cgi?id=6009
## PR1.3: [2010-10-25 19:05:34] <agi> chem|st: seems to work just fine (re: libvte4)
#o#cd ~user/MyDocs/tmp/
#o#wget --no-check-certificate \
#o# https://bugs.maemo.org/attachment.cgi?id=2705 \
#o# -O libvte4_0.16.14-0mh9.m5_armel.deb
#o#dpkg -i libvte4_0.16.14-0mh9.m5_armel.deb


#!/bin/sh
# execute or source this to fix the missing end-times in eventslogger db
# thanks hcm @ http://talk.maemo.org/showpost.php?p=690253&postcount=20
## find original at http://maemo.cloud-7.de/maemo5/patches_n_tools/eventsdb_calllog_triggers.sh
sqlite3 -batch /home/user/.rtcom-eventlogger/el-v1.db <<ETX
DROP TRIGGER IF EXISTS call_duration_inbound;
CREATE TRIGGER call_duration_inbound AFTER UPDATE OF inbound_gsm ON call_duration FOR EACH ROW WHEN new.inbound_gsm > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.inbound_gsm) - (select old.inbound_gsm))
	where id = (select id from events where event_type_id = 1 and outgoing = 0 and service_id = 1 and local_uid='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_outbound;
CREATE TRIGGER call_duration_outbound AFTER UPDATE OF outbound_gsm ON call_duration FOR EACH ROW WHEN new.outbound_gsm > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.outbound_gsm) - (select old.outbound_gsm))
	where id = (select id from events where event_type_id = 1 and outgoing = 1 and service_id = 1 and local_uid='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_voip_in;
CREATE TRIGGER call_duration_voip_in AFTER UPDATE OF inbound_voip ON call_duration FOR EACH ROW WHEN new.inbound_voip > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.inbound_voip) - (select old.inbound_voip))
	where id = (select id from events where event_type_id = 1 and outgoing = 0 and service_id = 1 and local_uid!='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_voip_out;
CREATE TRIGGER call_duration_voip_out AFTER UPDATE OF outbound_voip ON call_duration FOR EACH ROW WHEN new.outbound_voip > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.outbound_voip) - (select old.outbound_voip))
	where id = (select id from events where event_type_id = 1 and outgoing = 1 and service_id = 1 and local_uid!='ring/tel/ring' order by start_time desc limit 1);
END;
ETX


/etc/X11/Xsession.d/10hildon_welcome = starter for video /opt/usr/share/hildon-welcome/media/Hands-v32-h264.avi = shaking-hands-video

http://maemo.cloud-7.de/maemo5/bootvideo-DONTPANIC/ (the original author please holler - I forgot your name :-/ )

tracker fixing index for .ogg: sudo /var/lib/dpkg/info/decoders-support.postinst

things (not only) for CSSU

I currently updated to 16.5CSSU-Tmaemo5.1.

fix a bug that re-appears with each new CSSU upgrade:

apt-get install rtcom-accounts-voip-support 

To get rid of the ubiquitous autorotating while still allowing dialer to switch to portrait mode (doesn't lock microB, for now I will live with it):

gconftool-2 --set /apps/osso/hildon-desktop/ui_can_rotate -t bool false
reboot
#replace Hands by DONT_PANIC! bootmovie
cd /opt/usr/share/hildon-welcome/media
wget http://maemo.cloud-7.de/maemo5/bootvideo-DONTPANIC/dontpanic.avi
#cp /etc/hildon-welcome.d/default.conf \
# /etc/hildon-welcome.d/default.conf_backup #makes BOTH videos play at boot :)
## to "uninstall" simply edit the file below 
## to read  "filename=Hands-v32-h264.avi"
echo -e "[hildon-welcome]\nfilename=dontpanic.avi" >/etc/hildon-welcome.d/default.conf


A job I start on my PC every day, via cron, like 'N900-rsync IroN900' (IroN900 is resolving to my N900's local IP in WLAN, via /etc/hosts. You as well can use a numerical IP). It automatically creates and keeps up-to-date a backup of N900's / (root) and /home/ (user data and opt). If my N900 is "not at home", the job will sleep until it becomes available again (I probably could handle better the rare case where I'm away for >24h, but it doesn't create too much trouble, just a bit of useless wlan traffic):

#!/bin/sh
## call with parameter <IP of maemo device to sync>
## NB this has a path relative to $HOME of user calling the job

while ! rsync -vaRzx --fake-super root@$1:/ ~/Documents/N900/backup/$1; do 
  echo "$1 not available via ssh, retrying in 30 minutes"; 
  sleep 1800; 
done
echo "########## rootfs synced, now syncing /home"

while ! rsync -vaRzx --fake-super root@$1:/home ~/Documents/N900/backup/$1/home; do 
  echo "$1 not available via ssh, retrying in 30 minutes"; 
  sleep 1800; 
done


changing the drag&drop threshold, here to "100" (makes context menus disappear on stylus-up when too small):

sed -i "s/gtk-dnd-drag-threshold = [0-9]*/gtk-dnd-drag-threshold = 100/" \
/opt/usr/share/themes/*/gtk-2.0/gtkrc && /usr/bin/hildon-theme-recache-all