Contents of /trunk/mlivecdbuild/profiles/samsung-nc10-i686-svn/prepare_custom
Parent Directory | Revision Log
Revision 963 -
(show annotations)
(download)
Wed Jan 27 16:14:08 2010 UTC (14 years, 8 months ago) by niro
File size: 4544 byte(s)
Wed Jan 27 16:14:08 2010 UTC (14 years, 8 months ago) by niro
File size: 4544 byte(s)
-nc10 profile
1 | #!/bin/bash |
2 | |
3 | # set an empty root password |
4 | chroot ${CDCHROOTDIR} passwd -d root |
5 | |
6 | # stop here if the user don't want to create the install tarball |
7 | [[ ! -z ${SKIP_CREATE_INSTALL_TARBALL} ]] && exit 0 |
8 | |
9 | INSTALLCHROOT="${LIVECDROOT}/install-temp" |
10 | INSTALLTARBALL="samsung-nc10.tar.bz2" |
11 | |
12 | ## |
13 | # create the install tarball |
14 | ## |
15 | |
16 | install -d ${INSTALLCHROOT} |
17 | install -d ${CDISOROOT}/system |
18 | |
19 | # use all settings from the global config, but the basesystem |
20 | mage-bootstrap \ |
21 | --root ${INSTALLCHROOT} \ |
22 | --profile ${MAGE_PROFILE} \ |
23 | --magerc ${MAGERC} #\ |
24 | #--toolchain ${TOOLCHAIN} \ |
25 | #--basesystem basesystem26 |
26 | |
27 | install_custom_services() |
28 | { |
29 | local cmd="$1" |
30 | local services="$2" |
31 | |
32 | case ${cmd} in |
33 | add|del|default) |
34 | # add given services from profile |
35 | if [[ -n ${services} ]] |
36 | then |
37 | local i |
38 | for i in ${services} |
39 | do |
40 | MROOT="${INSTALLCHROOT}" rc-config ${cmd} ${i} || die "rc ${cmd} ${i}" |
41 | done |
42 | fi |
43 | ;; |
44 | *) die "install_custom_services: unkown command ${cmd}";; |
45 | esac |
46 | } |
47 | |
48 | install_add_initrc() |
49 | { |
50 | local var="$1" |
51 | |
52 | # sanity checks |
53 | [[ -z ${INSTALLCHROOT} ]] && die "\${INSTALLCHROOT} not given." |
54 | echo "${var}" >> ${INSTALLCHROOT}/.installrc || die "install_add_initrc() adding \$var" |
55 | } |
56 | |
57 | install_custom_packages() |
58 | { |
59 | local cmd="$1" |
60 | local packages="$2" |
61 | |
62 | case ${cmd} in |
63 | install|uninstall) |
64 | if [[ -n ${packages} ]] |
65 | then |
66 | :> ${INSTALLCHROOT}/.installrc |
67 | |
68 | # respect proxies |
69 | [[ -n ${http_proxy} ]] && install_add_initrc "export http_proxy=${http_proxy}" |
70 | [[ -n ${ftp_proxy} ]] && install_add_initrc "export ftp_proxy=${ftp_proxy}" |
71 | [[ -n ${no_proxy} ]] && install_add_initrc "export no_proxy=${no_proxy}" |
72 | |
73 | # do not auto-start any services! |
74 | install_add_initrc "export MAGE_BOOTSTRAP=true" |
75 | install_add_initrc 'die() { if [ $? -eq 1 ]; then echo "ERROR: $@"; exit 1; fi; }' |
76 | |
77 | local i |
78 | for i in ${packages} |
79 | do |
80 | install_add_initrc "mage ${cmd} ${i} || die ${i}" |
81 | done |
82 | install_add_initrc "mage clean" |
83 | |
84 | # now run the .installrc script |
85 | mount -t proc proc ${INSTALLCHROOT}/proc || die "mount proc" |
86 | mount -t sysfs sysfs ${INSTALLCHROOT}/sys || die "mount sys" |
87 | mount -o bind /dev ${INSTALLCHROOT}/dev || die "mount dev" |
88 | chroot ${INSTALLCHROOT} /bin/bash -i /.installrc || die "chr00ting" |
89 | umount ${INSTALLCHROOT}/dev || die "umount dev" |
90 | umount ${INSTALLCHROOT}/proc || die "umount proc" |
91 | umount ${INSTALLCHROOT}/sys || die "umount sys" |
92 | [ -f ${INSTALLCHROOT}/.installrc ] && rm ${INSTALLCHROOT}/.installrc |
93 | fi |
94 | ;; |
95 | *) die "install_custom_packages: unkown command ${cmd}";; |
96 | esac |
97 | } |
98 | |
99 | # add custom packages |
100 | [ -f $(get_profile install_add_packages) ] && install_custom_packages install "$(read_config $(get_profile install_add_packages))" |
101 | |
102 | # del custom packages |
103 | [ -f $(get_profile install_del_packages) ] && install_custom_packages uninstall "$(read_config $(get_profile install_del_packages))" |
104 | |
105 | # add given services from profile |
106 | [ -f $(get_profile install_add_services) ] && install_custom_services add "$(read_config $(get_profile install_add_services))" |
107 | |
108 | # del given services from profile |
109 | [ -f $(get_profile install_del_services) ] && install_custom_services del "$(read_config $(get_profile install_del_services))" |
110 | |
111 | # add custom config files |
112 | # x11 |
113 | install -m0644 $(get_profile custom-files/x11/xorg.conf) ${INSTALLCHROOT}/etc/X11 || die |
114 | install -m0644 $(get_profile custom-files/hal/use-german-layout-with-kbd.fdi) ${INSTALLCHROOT}/etc/hal/fdi/policy || die |
115 | # umts |
116 | install -m0644 $(get_profile custom-files/ppp/vodafone.chat) ${INSTALLCHROOT}/etc/ppp/ || die |
117 | install -m0644 $(get_profile custom-files/ppp/peers/umts) ${INSTALLCHROOT}/etc/ppp/peers/ || die |
118 | # confd |
119 | install -m0644 $(get_profile custom-files/confd/mkinitrd) ${INSTALLCHROOT}/etc/conf.d/ || die |
120 | install -m0644 $(get_profile custom-files/confd/net.eth0) ${INSTALLCHROOT}/etc/conf.d/ || die |
121 | install -m0644 $(get_profile custom-files/confd/net.wlan0) ${INSTALLCHROOT}/etc/conf.d/ || die |
122 | # hackish quirk for wpa2 |
123 | install -m0644 $(get_profile custom-files/confd/wpa_supplicant.skel) ${INSTALLCHROOT}/etc/conf.d/ || die |
124 | |
125 | # create tarball |
126 | ( cd ${INSTALLCHROOT}; tar cvjpf ${CDISOROOT}/system/${INSTALLTARBALL} ./ | tee log) |
127 | |
128 | # create images.conf |
129 | echo "CDIMAGENAME=${INSTALLTARBALL}" > ${CDISOROOT}/system/images.conf |
130 | echo "TOTALLINES=$(wc -l ${INSTALLCHROOT}/log | cut -d' ' -f1)" >> ${CDISOROOT}/system/images.conf |
131 | |
132 | # stop here if the user don't want to delete the install chroot |
133 | [[ ! -z ${SKIP_DELETE_INSTALL_CHROOT} ]] && exit 0 |
134 | |
135 | # clean up |
136 | if [[ -d ${INSTALLCHROOT} ]] |
137 | then |
138 | rm -rf ${INSTALLCHROOT} |
139 | fi |