aboutsummaryrefslogtreecommitdiffstats
path: root/x11/kde4/scripts/configure.kde3
blob: a3cfafc8d9aeab685809da43a44b6d133d90ee94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh

## Create four tempfiles: A tempfile to store the selection from the menu in,
## one to store the same selection after some transformation (for comm), one to
## store the contents of ${ALL_MODULES} (also for comm) and one to store
## the output of pkg_info.

tempselection=`mktemp -t selection`
tempprocessed=`mktemp -t processed`
tempallmodules=`mktemp -t allmodules`
tempinstalled=`mktemp -t installed`

## By default, preselect all modules. 

for i in `${ECHO} "${ALL_MODULES}" | ${TR} '[:upper:]' '[:lower:]'`
    do
        eval status_$i=ON
    done

## If a configfile exists and has actual content, parse it and un-select
## modules accordingly (the configfile is supposed to contain WITHOUT_FOO=yes)
## lines. We don't check what's really in there, it shouldn't do harm when we
## set bogus shell variables.

if [ -s "${CONFIG_FILE}" ]; then
    for i in `${CAT} ${CONFIG_FILE} | ${TR} '[:upper:]' '[:lower:]' \
    | ${SED} -E -e 's/without_//g' -e 's/=yes//g'`
    do
        eval status_$i=OFF
    done

    ## Try to be ubersmart: Check for all installed packages and preselect
    ## them. This catches the case where people have added ports without the
    ## the metaport, run the metaport again and wonder why they have parts
    ## of KDE installed afterwards that were not selected.
    ## 
    ## Bugs: This metaport can check for existing packages, but it cannot
    ##   remove packages the user explicitly unselects, but which are
    ##   already installed.

    if [ -f $tempinstalled ];then
        ${ECHO_MSG}
        ${ECHO_MSG} -n "   Looking for installed modules."

        for i in `${ECHO} "${ALL_MODULES}" | ${TR} '[:upper:]' '[:lower:]'`
        do
            ${PKG_INFO} | ${GREP} $i | ${SED} -e 's/-.*//g' >> $tempinstalled
            ${ECHO_MSG} -n "."
        done

        for i in `${CAT} $tempinstalled`
        do
            eval status_$i=ON
        done
    fi
fi

## Run the menu dialog, except BATCH is defined. We define BATCH automatically
## if people have WITH_FOO* set in their make.conf or on the commandline.
## Actually, we don't even run this whole script at all if BATCH is defined...
## But I'll leave it in just in case, and also as a reference to andreas@
## who came up with this kind of configuration magic first and from whose ports
## I've stolen it all. Save the results in the tempselection tempfile.

if [ -z "${BATCH}" ]; then
    /usr/bin/dialog --title "K Desktop Environment Customized Installation" --clear \
    --checklist "\n\
Please select what additional KDE modules you would like to install.\n\n" \
-1 -1 15 \
"KDEACCESS."    "Accessibility applications for KDE" "$status_kdeaccessibility" \
"KDEADMIN"      "KDE applications related to system administration" "$status_kdeadmin" \
"KDEARTWORK"    "Additional themes, sounds, wallpapers and window styles" "$status_kdeartwork" \
"KDEVELOP"      "Powerful IDE for developing KDE/Qt-based applications" "$status_kdevelop" \
"KDEEDU"        "Collection of entertaining, educational programs" "$status_kdeedu" \
"KDEGAMES"      "Games like kolf, patience, atlantik, etc" "$status_kdegames" \
"KDEGRAPHICS"   "Graphics utilities like kview, kpaint, kghostview, etc" "$status_kdegraphics" \
"KDEMULTIMEDIA" "Multimedia utilities like noatun, kmix, etc" "$status_kdemultimedia" \
"KDENETWORK"    "Network-related programs like kopete, kppp, etc" "$status_kdenetwork" \
"KOFFICE"       "Office Suite including wordprocessor, spreadsheet, etc" "$status_koffice" \
"KDEPIM"        "Personal Information Management: Mail, News, Calendar" "$status_kdepim" \
"KDESDK"        "KDE software development kit" "$status_kdesdk" \
"KDETOYS"       "Miscellaneous small applications" "$status_kdetoys" \
"KDEUTILS"      "Utilities like kcalc, kcharselect, ark, kedit, etc" "$status_kdeutils" \
"KDEWEBDEV"     "Comprehensive website development environment" "$status_kdewebdev" \
2> $tempselection

    ## Save the return value from dialog.

    retval=$?

    ##  Write out all the module names into a newline-delimited list...

    if [ -f $tempallmodules ]; then
        ${ECHO} "$ALL_MODULES" | ${SED} -E -e 's/[[:space:]]+/ /g' | ${TR} '[:space:]' '\n' | sort > $tempallmodules
    fi

    ## ...do the same for the selection made in the dialog, comm -23 the
    ## two files to get the delta and set that as shell variables.

    if [ -s $tempselection ]; then
        ${CAT} $tempselection | ${SED} -E -e 's/KDEACCESS./KDEACCESSIBILITY/g' -e 's/[[:space:]]+/ /g' \
        -e 's/"//g' | ${TR} '[:space:]' '\n' | sort > $tempprocessed
        set `/usr/bin/comm -23 $tempallmodules $tempprocessed`
    fi

    ## Clean out the tempfiles.

    rm -f $tempselection $tempprocessed $tempallmodules $tempinstalled

    ## If the user selected "Cancel" in the dialog, exit.

    if [ $retval = 1 ]; then
        ${ECHO_MSG} "Aborting"
        exit 1
    fi
fi

## Create Makefile.inc

${MKDIR} -p ${WRKDIRPREFIX}${CURDIR}
${TOUCH} ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

## Populate Makefile.inc by writing out the delta we saved above.

while [ $1 ]; do
    ${ECHO} "WITHOUT_$1=yes" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc;
    shift
done