Add profile specific configurations
[scm/bb/meta-tizen.git] / 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
10 do_install() {
11   mkdir -p ${D}${sysconfdir}
12   echo "Tizen on Yocto" > ${D}${sysconfdir}/tizen
13   
14   touch ${D}${sysconfdir}/environment
15   chmod 0644 ${D}${sysconfdir}/environment
16   
17   mkdir -p ${D}${localstatedir}
18   ln -s ${localstatedir}/volatile/log  ${D}${localstatedir}/log
19   
20   mkdir -p ${D}${sysconfdir}/profile.d
21 cat >${D}${sysconfdir}/profile.d/bash_prompt_custom.sh <<'EOF'
22     # set a fancy prompt (overwrite the one in /etc/profile)
23     default="\[\e[0m\]"
24     usercol='\[\e[1;34m\]' # blue
25     hostcol='\[\e[1;32m\]' # green
26     pathcol='\[\e[1;33m\]' # yellow
27     gitcol='\[\e[1;31m\]' # light red
28     termcmd=''
29     _p="$";
30
31     if [ "`id -u`" -eq 0 ]; then
32         usercol='\[\e[1;31m\]'
33         _p="#"
34     fi
35
36     PS1="${usercol}\u${default}@${hostcol}\h${default}:${pathcol}\w${default}${gitcol}${default}${_p} ${termcmd}"
37
38     alias ll="ls -lZ"
39     alias lr="ls -ltrZ"
40     alias la="ls -alZ"
41
42 EOF
43   
44 }
45
46 pkg_postinst_${PN} () {
47   chsmack -t $D${sysconfdir}
48   chsmack -a 'System::Shared' $D${sysconfdir}
49   
50   mkdir -p $D${localstatedir}/volatile/log
51   mkdir -p $D${localstatedir}/volatile/tmp
52   
53   chsmack -t $D${localstatedir}/volatile/log
54   chsmack -a 'System::Log'  $D${localstatedir}/volatile/log
55
56   touch $D${localstatedir}/volatile/log/lastlog
57   touch $D${localstatedir}/volatile/log/faillog
58   touch $D${localstatedir}/volatile/log/wtmp
59   touch $D${localstatedir}/volatile/log/btmp
60   
61   mkdir -p $D${sysconfdir}/profile.d
62   
63   if [ "x$D" != "x" ]; then  
64     cp -fra $D/lib  $D/usr
65     cp -fra $D/sbin $D/usr
66     #cp -fra $D/bin  $D/usr
67   
68     rm -fr $D/lib
69     rm -fr $D/sbin
70     #rm -fr $D/bin
71   
72     ln -s usr/lib  $D/lib
73     ln -s usr/sbin $D/sbin
74     #ln -s usr/bin  $D/bin
75  fi
76 }
77
78 FILES_${PN} = "${sysconfdir}/tizen \
79                ${sysconfdir}/environment \
80                ${localstatedir}/log \
81                ${sysconfdir}/profile.d/bash_prompt_custom.sh \
82                "