]> Pileus Git - ~andy/sunrise/blob - sys-devel/scratchbox/scratchbox-0.9.8.7.ebuild
sys-devel/scratchbox: source is not needed here and breaks svn eix
[~andy/sunrise] / sys-devel / scratchbox / scratchbox-0.9.8.7.ebuild
1 # Copyright 1999-2006 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/${MAJOR_VERSION}/tarball/scratchbox-core-${PV}.tar.gz
15          http://scratchbox.org/download/files/sbox-releases/${MAJOR_VERSION}/tarball/scratchbox-libs-${PV}.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}/scratchbox
28
29 src_install() {
30         cd "${S}"
31         dodir ${TARGET_DIR}
32         # doins doesn't work with symlinks, getting "file not found" with doins
33         cp -pRP ./* "${D}/${TARGET_DIR}"
34         dosym opt/scratchbox scratchbox
35
36         # scratchbox service loader
37         newinitd "${FILESDIR}/scratchbox.rc" scratchbox || die "newinitd failed"
38
39         # group already created
40         echo ${SBOX_GROUP} > "${D}/${TARGET_DIR}/.run_me_first_done"
41 }
42
43 pkg_preinst() {
44         einfo "Creating group sbox"
45         enewgroup "${SBOX_GROUP}" || die "adding group '${SBOX_GROUP}' failed"
46 }
47
48 pkg_postinst() {
49         elog
50         elog "You need to run:"
51         elog "\"emerge --config =${CATEGORY}/${PF}\""
52         elog "to set permissions right and setup scratchbox and users"
53         elog
54         elog "For further documentation about how to setup"
55         elog "scratchbox for your development needs have a look at"
56         elog "http://scratchbox.org/documentation/user/scratchbox-${MAJOR_VERSION}/"
57         elog
58         elog "Also note that when you reboot you should run:"
59         elog "/etc/init.d/scratchbox start"
60         elog "before trying to run scratchbox."
61         elog "You can also add it to the default runlevel:"
62         elog "rc-update add scratchbox default"
63         elog
64         elog "Type /opt/scratchbox/login to start scratchbox."
65         elog
66 }
67
68 pkg_postrm() {
69         elog
70         elog "To remove all traces of scratchbox you will need to remove the file"
71         elog "/etc/init.d/scratchbox. Don't forget to delete the sbox group."
72         elog
73 }
74
75 pkg_config() {
76         if [ `id -u` != "0" ]; then
77                 ewarn "Must be root to run this"
78                 die "not root"
79         fi
80
81         einfo "Do you want to configure scratchbox? [Yes/No]"
82         einfo "Note: This will set permissions and copy files from the system into the scratchbox"
83         read choice
84         echo
85         case "$choice" in
86                 y*|Y*|"")
87                         "${TARGET_DIR}/sbin/sbox_configure" "no" ${SBOX_GROUP} || die "sbox_configure failed"
88                         ;;
89                 *)
90                         ;;
91         esac
92
93         mkdir -p "${TARGET_DIR}/scratchbox/users"
94
95         while true; do
96                 einfo "Existing users:"
97                 einfo $(ls "${TARGET_DIR}/users")
98                 echo
99
100                 einfo "Create new user (leaf empty to skip): "
101                 read newuser
102                 case "$newuser" in
103                         "")
104                                 break;
105                                 ;;
106                         *)
107                                 einfo "Note: users have to be in the '${SBOX_GROUP}' to be able to login into the scratchbox"
108                                 "${TARGET_DIR}/sbin/sbox_adduser" ${newuser} || die "sbox_adduser failed"
109                                 ;;
110                 esac
111         done
112
113         einfo "Configuration finished. Make sure you run '/etc/init.d/scratchbox start' before logging in."
114 }