add specific config in postinstall image
[scm/bb/meta-tizen.git] / meta-tizen-common-base / recipes-image / config-image / config-image.bb
1 SUMMARY = "Config image"
2 DESCRIPTION = "This Config image"
3 SECTION = "config"
4 PR = "r1"
5 LICENSE = "MIT"
6 LIC_FILES_CHKSUM ??= "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
7
8 RDEPENDS_${PN} += "weston"
9 RDEPENDS_${PN} += "media-server"
10 RDEPENDS_${PN} += "wrt-widgets"
11 RDEPENDS_${PN} += "avsystem"
12 RDEPENDS_${PN} += "download-provider"
13 RDEPENDS_${PN} += "run-postinsts"
14
15 do_install() {
16   mkdir -p ${D}${sysconfdir}
17   echo "Tizen on Yocto" > ${D}${sysconfdir}/tizen
18   
19   touch ${D}${sysconfdir}/environment
20   chmod 0644 ${D}${sysconfdir}/environment
21   
22   mkdir -p ${D}${sysconfdir}/profile.d
23 cat >${D}${sysconfdir}/profile.d/bash_prompt_custom.sh <<'EOF'
24     # set a fancy prompt (overwrite the one in /etc/profile)
25     default="\[\e[0m\]"
26     usercol='\[\e[1;34m\]' # blue
27     hostcol='\[\e[1;32m\]' # green
28     pathcol='\[\e[1;33m\]' # yellow
29     gitcol='\[\e[1;31m\]' # light red
30     termcmd=''
31     _p="$";
32
33     if [ "`id -u`" -eq 0 ]; then
34         usercol='\[\e[1;31m\]'
35         _p="#"
36     fi
37
38     PS1="${usercol}\u${default}@${hostcol}\h${default}:${pathcol}\w${default}${gitcol}${default}${_p} ${termcmd}"
39
40     alias ll="ls -lZ"
41     alias lr="ls -ltrZ"
42     alias la="ls -alZ"
43
44 EOF
45   
46 }
47
48 pkg_postinst_${PN} () {
49   chsmack -t $D${sysconfdir}
50   chsmack -a 'System::Shared' $D${sysconfdir}
51   
52   mkdir -p $D${localstatedir}/volatile/log
53   mkdir -p $D${localstatedir}/volatile/tmp
54   
55   chsmack -t $D${localstatedir}/volatile/log
56   chsmack -a 'System::Log'  $D${localstatedir}/volatile/log
57
58   touch $D${localstatedir}/volatile/log/lastlog
59   touch $D${localstatedir}/volatile/log/faillog
60   touch $D${localstatedir}/volatile/log/wtmp
61   touch $D${localstatedir}/volatile/log/btmp
62   
63   mkdir -p $D${sysconfdir}/profile.d
64   
65   if [ "x$D" != "x" ]; then  
66     cp -fra $D${localstatedir}/log $D${localstatedir}/volatile
67     #cp -fra $D/sbin $D/usr
68     #cp -fra $D/bin  $D/usr
69   
70     #rm -fr $D/lib
71     #rm -fr $D/sbin
72     #rm -fr $D/bin
73     rm -fr $D${localstatedir}/log
74     
75     #ln -s usr/lib  $D/lib
76     #ln -s usr/sbin $D/sbin
77     #ln -s usr/bin  $D/bin
78     ln -s volatile/log  $D${localstatedir}/log
79     
80  fi
81  
82   [ "x$D" != "x" ] && exit 1
83    mkdir -p $D/etc/profile.d
84    chsmack -a System $D/var/lib/buxton/*.db
85    chown -R buxton:buxton $D/var/lib/buxton
86    buxtonctl set-label base vconf User
87    vconftool set -t string db/ail/ail_info "0" -f -s User
88    vconftool set -t string db/menuscreen/desktop "0" -f -s User
89    vconftool set -t string db/menu_widget/language "en_US.utf8" -f -s User
90    chown -R alice:users $D/home/alice
91    chown -R bob:users $D/home/bob
92    chown -R carol:users $D/home/carol
93    chown -R guest:users $D/home/guest
94    source $D/etc/tizen-platform.conf
95    chsmack -a '*' $D/var/lib/buxton || true
96    chsmack -a '*' /var/lib/buxton/* || true
97    chmod 0777 $D/var/lib/buxton || true
98    chmod 0666 $D/var/lib/buxton/* || true
99    ail_initdb
100    pkg_initdb
101    chmod 0600 $D/var/lib/buxton/* || true
102    chmod 0700 $D/var/lib/buxton || true
103    chsmack -a System $D/var/lib/buxton/* || true
104    chsmack -a System $D/var/lib/buxton || true
105    chsmack -a User $D/home/*/.applications/*/*
106    chsmack -a User $D/home/*/.applications/*/.*
107 }
108
109 FILES_${PN} = "${sysconfdir}/tizen \
110                ${sysconfdir}/environment \
111                ${sysconfdir}/profile.d/bash_prompt_custom.sh \
112                "