recipes: devel/elfutils: Build against cdefs.h header file
[dragora.git] / archive / dragora-installer / parts / InstallPackages
blobfce6aae5420c629de0f74bf978987e9b30ba84cf
1 # This file is part of the 'dragora-installer'.
3 # Purpose: Installation of .tlz packages from series.
5 # Show menu
7 dialog --colors \
8  --backtitle "\ZbPackage installation" \
9  --title "SELECT THE INSTALLATION MODE" \
10  --no-cancel --menu "" 6 58 0 \
11 "All"     "Install all packages from chosen series" \
12 "Expert"  "Select packages individually" \
13  2> ${SUBTMPDIR}/return-InstallPackages
15 # Check menu options
17 case "$(cat -- ${SUBTMPDIR}/return-InstallPackages)" in
18 All )
19     # Clean for subsequent filling
20     : > ${SUBTMPDIR}/return-InstallPackages_All
22     # Read (selected) series
23     IFS= read -r REPLY < ${SUBTMPDIR}/return-ShowSeries
25     for serie in $REPLY
26     do
27         find -- "${MEDIUM_SOURCE}"/@ARCH@ "${MEDIUM_SOURCE}"/noarch \
28          -type f \( -name "*@${serie}.tlz" -a ! -name "*-pass*" \) \
29           -printf '%p\n' >> ${SUBTMPDIR}/return-InstallPackages_All \
30            2> /dev/null || true
31     done
32     unset -v REPLY serie
34     # Proceed to install the packages from selected series
36     if test -s ${SUBTMPDIR}/return-InstallPackages_All
37     then
38        sort ${SUBTMPDIR}/return-InstallPackages_All \
39         > ${SUBTMPDIR}/return-InstallPackages_All.sorted
41         # Set some packages at the top of the list to give priority
42         ed -l -s ${SUBTMPDIR}/return-InstallPackages_All.sorted << EOF
43 /etc_/m0
44 /hierarchyfs_/m1
46 EOF
47         qi install \
48          --rootdir=/media/dragora-root \
49          --packagedir=/usr/pkg \
50          --targetdir=/ \
51          --prune - < ${SUBTMPDIR}/return-InstallPackages_All.sorted
52     else
53         echo "${PROGRAM}: All: Error the package list is empty." 1>&2
54         exit 99;
55     fi
56     ;;
57 Expert )
58     # Clean for subsequent filling
59     : > ${SUBTMPDIR}/search-InstallPackages_Expert
61     # Read (selected) series
62     IFS= read -r REPLY < ${SUBTMPDIR}/return-ShowSeries
64     for serie in $REPLY
65     do
66         find -- "${MEDIUM_SOURCE}"/@ARCH@ "${MEDIUM_SOURCE}"/noarch \
67          -type f \( -name "*@${serie}.tlz" -a ! -name "*-pass*" \) \
68           -printf '%p\n' >> ${SUBTMPDIR}/search-InstallPackages_Expert \
69            2> /dev/null || true
70     done
71     unset -v REPLY serie
73     if test -s ${SUBTMPDIR}/search-InstallPackages_Expert
74     then
75        sort ${SUBTMPDIR}/search-InstallPackages_Expert \
76         > ${SUBTMPDIR}/search-InstallPackages_Expert.sorted
77     else
78         echo "${PROGRAM}: Expert: The package list is empty." 1>&2
79         exit 99;
80     fi
82     # Dialog, package checklist composition
84     cat << EOF > ${SUBTMPDIR}/InstallPackages_Expert
85 dialog --colors --no-shadow \\
86  --backtitle "\ZbPackage selection from chosen series" \\
87  --title "SOFTWARE PACKAGES" \\
88  --no-cancel --item-help --checklist \\
89 "The following packages have been found according to the series.\n\n\\
90 Please use the cursor keys and \\Z3[Space]\\Zn to deselect the packages\n\\
91 you do not want to install.  By default, all packages are selected." \\
92 $(( LINES - 6 )) $COLUMNS 16 \\
93 EOF
95     # Populate checklist item using information from meta files
96     while read -r meta
97     do
98         . "${meta}.txt" || {
99             echo "${PROGRAM}: Error no meta file(s) available." 1>&2
100             exit 99;
101         }
103         echo "\"${full_pkgname%%@*}\" \"@${pkgcategory}\" ON \"${blurb}\" \\" \
104          >> ${SUBTMPDIR}/InstallPackages_Expert
105     done < ${SUBTMPDIR}/search-InstallPackages_Expert.sorted
107     # Add tail to get the answers
108     echo ' 2> ${SUBTMPDIR}/return-InstallPackages_Expert' \
109      >> ${SUBTMPDIR}/InstallPackages_Expert
111     touch ${SUBTMPDIR}/return-InstallPackages_Expert
113     # Show the menu
114     . ${SUBTMPDIR}/InstallPackages_Expert
116     # Proceed to install the chosen packages
118     if test -s ${SUBTMPDIR}/return-InstallPackages_Expert
119     then
120         # Set some packages at the top of the list to give priority
121         ed -l -s ${SUBTMPDIR}/return-InstallPackages_Expert << EOF
122 /etc_/m0
123 /hierarchyfs_/m1
126         # Proceed to install if there is a match in the search list
127         while read -r line
128         do
129             grep -F -s -w -m 1 "$line" \
130              ${SUBTMPDIR}/search-InstallPackages_Expert.sorted | \
131               qi install \
132                --rootdir=/media/dragora-root \
133                --packagedir=/usr/pkg \
134                --targetdir=/ \
135                --prune -
136         done < ${SUBTMPDIR}/return-InstallPackages_Expert
137     else
138         echo "${PROGRAM}: Expert: Error the package list is empty." 1>&2
139         exit 99;
140     fi
141     ;;
142 esac