]> Pileus Git - ~andy/sunrise/blob - sys-devel/scratchbox/scratchbox-1.0.7.ebuild
sunrise/app-portage/elog-list/elog-list-0.0.6.ebuild: change headers to make repoman...
[~andy/sunrise] / sys-devel / scratchbox / scratchbox-1.0.7.ebuild
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit eutils
6
7 MAJOR_VERSION=${PV%\.[0-9]}
8
9 SBOX_GROUP="sbox"
10 RESTRICT="strip"
11
12 DESCRIPTION="Scratchbox is a cross-compilation toolkit designed to make embedded Linux application development easier."
13 HOMEPAGE="http://www.scratchbox.org/"
14 SRC_URI="http://scratchbox.org/download/files/sbox-releases/stable/tarball/scratchbox-core-${PV}-i386.tar.gz
15         http://scratchbox.org/download/files/sbox-releases/stable/tarball/scratchbox-libs-${PV}-i386.tar.gz"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~x86"
20 IUSE=""
21
22 DEPEND=""
23 RDEPEND=""
24
25 TARGET_DIR="/opt/scratchbox"
26
27 S=${WORKDIR}/${PN}
28
29 src_install() {
30         dodir ${TARGET_DIR}
31         # doins doesn't work with symlinks, getting "file not found" with doins
32         cp -pRP ./* "${D}/${TARGET_DIR}"
33         dosym opt/scratchbox scratchbox
34
35         # scratchbox service loader
36         newinitd "${FILESDIR}/scratchbox.rc" scratchbox || die "newinitd failed"
37
38         # group already created
39         echo ${SBOX_GROUP} > "${D}/${TARGET_DIR}/.run_me_first_done"
40 }
41
42 pkg_preinst() {
43         einfo "Creating group sbox"
44         enewgroup "${SBOX_GROUP}"
45 }
46
47 pkg_postinst() {
48         elog
49         elog "You need to run:"
50         elog "\"emerge --config =${CATEGORY}/${PF}\""
51         elog "to set permissions right and setup scratchbox and users"
52         elog
53         elog "For further documentation about how to setup"
54         elog "scratchbox for your development needs have a look at"
55         elog "http://scratchbox.org/documentation/user/scratchbox-${MAJOR_VERSION}/"
56         elog
57         elog "Also note that when you reboot you should run:"
58         elog "/etc/init.d/scratchbox start"
59         elog "before trying to run scratchbox."
60         elog "You can also add it to the default runlevel:"
61         elog "rc-update add scratchbox default"
62         elog
63         elog "Type /opt/scratchbox/login to start scratchbox."
64         elog
65 }
66
67 pkg_postrm() {
68         elog
69         elog "To remove all traces of scratchbox you will need to remove the file"
70         elog "/etc/init.d/scratchbox. Don't forget to delete the sbox group."
71         elog
72 }
73
74 pkg_config() {
75         if [ `id -u` != "0" ]; then
76                 ewarn "Must be root to run this"
77                 die "not root"
78         fi
79
80         einfo "Do you want to configure scratchbox? [Yes/No]"
81         einfo "Note: This will set permissions and copy files from the system into the scratchbox"
82         read choice
83         echo
84         case "$choice" in
85                 y*|Y*|"")
86                         "${TARGET_DIR}/sbin/sbox_configure" "no" ${SBOX_GROUP} || die "sbox_configure failed"
87                         ;;
88                 *)
89                         ;;
90         esac
91
92         mkdir -p "${TARGET_DIR}/scratchbox/users"
93
94         while true; do
95                 einfo "Existing users:"
96                 einfo $(ls "${TARGET_DIR}/users")
97                 echo
98
99                 einfo "Create new user (leaf empty to skip): "
100                 read newuser
101                 case "$newuser" in
102                         "")
103                                 break;
104                                 ;;
105                         *)
106                                 einfo "Note: users have to be in the '${SBOX_GROUP}' to be able to login into the scratchbox"
107                                 "${TARGET_DIR}/sbin/sbox_adduser" ${newuser} || die "sbox_adduser failed"
108                                 ;;
109                 esac
110         done
111
112         einfo "Configuration finished. Make sure you run '/etc/init.d/scratchbox start' before logging in."
113 }