| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # Copyright (C) 2002-2012 by NCHC, Steven Shiau, K. L. Huang, and Ceasar Sun |
| 4 | # (steven _at nchc org tw, klhaung _at_ gmail com, ceasar _at_ nchc org tw) |
| 5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 2, or (at your option) |
| 9 | # any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program; if not, write to the Free Software |
| 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | # |
| 20 | # Those programs doing real jobs: |
| 21 | # drblsrv -> drblsrv-offline -> prepare-files-for-PXE-client -> generate-pxe-menu |
| 22 | |
| 23 | # Load DRBL setting and functions |
| 24 | # Setting |
| 25 | # Source function library. |
| 26 | [scip-shell system . . `[`. -f /etc/rc.d/init.d/functionsscip-shell filesystem . . `/etc/rc.d/init.d/functions`. ] && . /etc/rc.d/init.d/functionsscip-shell source . . `/etc/rc.d/init.d/functions`. |
| 27 | |
| 28 | # Load DRBL setting and functions |
| 29 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 30 | |
| 31 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 32 | |
| 33 | # functions |
| 34 | check_if_repository_in_blacklistscip-shell shell shell-project 0.0.0 check_if_repository_in_blacklist().() { |
| 35 | # yum_repo_blacklists is read from drbl.conf |
| 36 | local url_tmp="$1" |
| 37 | for iu in $url_tmp; do |
| 38 | # If the url is in blacklist (like: http://ftp.isu.edu.tw), some problems! Terminated! |
| 39 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. "$yum_repo_blacklists" | grepscip-shell system . . grep. -E "\<$iu")" ]; then |
| 40 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 41 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. "$iu" | grepscip-shell system . . grep. -E "http://ftp.isu.edu.tw")" ]; then |
| 42 | # For some known site, output the reason |
| 43 | echoscip-shell system . . echo. "$msg_http_isu_edu_tw_not_compatible" |
| 44 | fi |
| 45 | echoscip-shell system . . echo. "$iu: $msg_http_isu_edu_tw_not_compatible" |
| 46 | echoscip-shell system . . echo. "$msg_prompt_chang_yum_config" |
| 47 | echoscip-shell system . . echo. "$msg_program_stop" |
| 48 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 49 | exit 1 |
| 50 | fi |
| 51 | done |
| 52 | } |
| 53 | # |
| 54 | find_yum_repos_dir_path_for_opensusescip-shell shell shell-project 0.0.0 find_yum_repos_dir_path_for_opensuse().() { |
| 55 | # yum_conf_dir_path is global variable |
| 56 | # Before OpenSuSE 10.3, the yum repository conf dir is /etc/yum.repos.d, while from OpenSuSE 11.0, it's /etc/yum/repos.d/ |
| 57 | if [scip-shell system . . `[`. -d /etc/yum.repos.d/scip-shell filesystem . . `/etc/yum.repos.d/`. ]; then |
| 58 | yum_conf_dir_path=/etc/yum.repos.dscip-shell filesystem . . `/etc/yum.repos.d`. |
| 59 | elif [scip-shell system . . `[`. -d /etc/yum/repos.d/scip-shell filesystem . . `/etc/yum/repos.d/`. ]; then |
| 60 | yum_conf_dir_path=/etc/yum/repos.dscip-shell filesystem . . `/etc/yum/repos.d`. |
| 61 | else |
| 62 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 63 | echoscip-shell system . . echo. "Yum repository conf dir NOT found!!!" |
| 64 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 65 | echoscip-shell system . . echo. "$msg_program_stop" |
| 66 | exit 1 |
| 67 | fi |
| 68 | } # end of find_yum_repos_dir_path_for_opensuse |
| 69 | # |
| 70 | do_some_cleanup_before_uninstallscip-shell shell shell-project 0.0.0 do_some_cleanup_before_uninstall().() { |
| 71 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 72 | # stop clonezilla so that no daemon (ocsmgrd, udpcast) is running |
| 73 | echoscip-shell system . . echo. "Stopping clonezilla if it is running..." |
| 74 | drbl-ocs -l 0 stop |
| 75 | |
| 76 | if [scip-shell system . . `[`. -n "$(unalias ls &>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. $sanboot_img_dump_dir/*aoe-*-for* 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 77 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 78 | echoscip-shell system . . echo. "Stop vblade (for AoE) service ?" |
| 79 | echoscip-shell system . . echo. -n "[Y/n] " |
| 80 | read stop_vblade_answer |
| 81 | case "$SL_remove_answer" in |
| 82 | n|N|[nN][oO]) continue ;; |
| 83 | *) drbl-aoe-serv stop ;; |
| 84 | esac |
| 85 | fi |
| 86 | |
| 87 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 88 | # rm the YP securenets |
| 89 | drbl-yp-securenets clean |
| 90 | |
| 91 | if is_systemd_init; then |
| 92 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 93 | # rm the drbl-clients-nat systemd service for server |
| 94 | echoscip-shell system . . echo. "Disabling drbl-clients-nat service..." |
| 95 | systemctl disable drbl-clients-nat.service |
| 96 | rmscip-shell system . . rm. -f /lib/systemd/system/drbl-clients-nat.servicescip-shell filesystem . . `/lib/systemd/system/drbl-clients-nat.service`. |
| 97 | if [scip-shell system . . `[`. -e "$dnsmasq_cfg" ]; then |
| 98 | # Stop dnsmasq |
| 99 | echoscip-shell system . . echo. $msg_delimiter_star_line |
| 100 | echoscip-shell system . . echo. "Stop and disable service dnsmasq..." |
| 101 | servicescip-shell system . . service. dnsmasq stop |
| 102 | systemctl disable dnsmasq |
| 103 | mvscip-shell system . . mv. ${dnsmasq_cfg} ${dnsmasq_cfg}.drblsave |
| 104 | fi |
| 105 | fi |
| 106 | |
| 107 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 108 | echoscip-shell system . . echo. "$msg_remove_SmallLinuxs_question" |
| 109 | echoscip-shell system . . echo. -n "[Y/n] " |
| 110 | read SL_remove_answer |
| 111 | case "$SL_remove_answer" in |
| 112 | n|N|[nN][oO]) continue ;; |
| 113 | *) drbl-sl -l $lang_answer -u all ;; |
| 114 | esac |
| 115 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 116 | } # end of do_some_cleanup_before_uninstall |
| 117 | # |
| 118 | run_drblsrv_offlinescip-shell shell shell-project 0.0.0 run_drblsrv_offline().() { |
| 119 | # Create the necessary dirctories, UGLY... |
| 120 | # the /tftpboot/node_root/tmp/boot is for link only, refer to the /tftpboot/node_root/etc/rc.d/rc.sysinit, the code "# For DRBL, create the directory /tmp/boot, so that the link /tmp/boot /boot... |
| 121 | # /var/lib/rpm is necessary when try to install kernel for client with rpm --force ... in MDK. It need to create the lock file /tftpboot/node_root//var/lib/rpm/RPMLOCK |
| 122 | mkdirscip-shell system . . mkdir. -p $drbl_common_root/tmp/boot/ $drbl_common_root/var/{lib,tmp} $drbl_common_root/var/lib/rpm |
| 123 | # Process the linking dirs, based on the host machine |
| 124 | for id in lib lib64 bin sbin; do |
| 125 | mkdirscip-shell system . . mkdir. -p $drbl_common_root/usr/$id |
| 126 | if [scip-shell system . . `[`. -L "/$id" ]; then |
| 127 | rmscip-shell system . . rm. -f $drbl_common_root/$id |
| 128 | (cd $drbl_common_root; lnscip-shell system . . ln. -fs usr/$id $id) |
| 129 | else |
| 130 | mkdirscip-shell system . . mkdir. -p drbl_common_root/$id |
| 131 | fi |
| 132 | done |
| 133 | (cd $drbl_common_root; lnscip-shell system . . ln. -fs tmp/boot boot) |
| 134 | |
| 135 | # To run drblsrv_offline, these depends on distributions |
| 136 | if [scip-shell system . . `[`. -n "$CONSOLE_OUTPUT" ]; then |
| 137 | # since there is space in $CONSOLE_OUTPUT, we have to use two params so that we can pass the varialbe with "" |
| 138 | console_opt1="--console-output" |
| 139 | console_opt2="$CONSOLE_OUTPUT" |
| 140 | fi |
| 141 | if [scip-shell system . . `[`. -n "$PXE_SERIAL_OUTPUT" ]; then |
| 142 | # since there is space in $PXE_SERIAL_OUTPUT, we have to use two params so that we can pass the varialbe with "" |
| 143 | pxe_serial_opt1="--pxe-serial-output" |
| 144 | pxe_serial_opt2="$PXE_SERIAL_OUTPUT" |
| 145 | fi |
| 146 | case "$client_kernel_install_mode" in |
| 147 | "from_server") |
| 148 | echoscip-shell system . . echo. Now run: drblsrv-offline $verbose_opt -c -d -a -l $lang -s $client_kernel_ver $console_opt1 \"$console_opt2\" $pxe_serial_opt1 \"$pxe_serial_opt2\" |
| 149 | drblsrv-offline $verbose_opt -c -d -a -l $lang -s $client_kernel_ver $console_opt1 "$console_opt2" $pxe_serial_opt1 "$pxe_serial_opt2" |
| 150 | ;; |
| 151 | "from_downloaded_pkg") |
| 152 | case "$OS_type" in |
| 153 | RH|MDK) |
| 154 | #client_kernel_pkg="$(unalias ls 2>/dev/null; ls $client_kernel_tmp_dir/*.rpm)" |
| 155 | client_kernel_pkg=$client_kernel_tmp_dir/$chosen_kernel_for_client |
| 156 | |
| 157 | ;; |
| 158 | DBN) |
| 159 | # ${latest_drbl_kernel_in_rep} is global variable when downloading kernel from apt repository |
| 160 | # How about there are 2 kernel debs in /var/cache/apt/archives like: |
| 161 | # linux-image-2.6.18-5-486_2.6.18.dfsg.1-13etch4_i386.deb |
| 162 | # linux-image-2.6.18-5-486_2.6.18.dfsg.1-13etch5_i386.deb |
| 163 | # and $latest_drbl_kernel_in_rep=linux-image-2.6.18-5-486 |
| 164 | # Sol: use pkg-ver-latest to parse the latest one, since it's the same version no, just minor changes. It shouldn't cause any problem. |
| 165 | client_kernel_pkg="$(unalias ls 2>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. $client_kernel_tmp_dir/${latest_drbl_kernel_in_rep}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`. | pkg-ver-latest)" |
| 166 | ;; |
| 167 | SUSE) |
| 168 | # ${latest_drbl_kernel_in_rep} is global variable when downloading kernel from apt/yum repository |
| 169 | client_kernel_pkg="$(unalias ls 2>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. $client_kernel_tmp_dir/${latest_drbl_kernel_in_rep}* 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 170 | ;; |
| 171 | esac |
| 172 | # $drblsrv_offline_extra_opt is especially for Ubuntu restricted kernel (linux-restricted-modules) and linux-ubuntu-modules |
| 173 | echoscip-shell system . . echo. Now run: drblsrv-offline $verbose_opt -c -d -a -l $lang -k $client_kernel_pkg $drblsrv_offline_extra_opt $console_opt1 \"$console_opt2\" $pxe_serial_opt1 \"$pxe_serial_opt2\" |
| 174 | drblsrv-offline $verbose_opt -c -d -a -l $lang -k $client_kernel_pkg $drblsrv_offline_extra_opt $console_opt1 "$console_opt2" $pxe_serial_opt1 "$pxe_serial_opt2" |
| 175 | |
| 176 | # Clean the kernel temp dir to release used disk space |
| 177 | # RH/MDK: we do not use apt to download the kernel, so client_kernel_tmp_dir won't be /var/cache/apt/archives. We can remove it. |
| 178 | # DBN: we USE apt to download the kernel in debian, so client_kernel_tmp_dir is /var/cache/apt/archives. We can NOT remove it. |
| 179 | # SuSE: we use apt or yum to download the kernel, if the $client_kernel_tmp_dir is /var/cache/apt/archives, do not remove it |
| 180 | if [scip-shell system . . `[`. -n "$client_kernel_tmp_dir" -a \ |
| 181 | -d "$client_kernel_tmp_dir/" -a \ |
| 182 | -z "$(echoscip-shell system . . echo. "$client_kernel_tmp_dir" | grepscip-shell system . . grep. -Ew "^/var/cache/apt/archives")" ]; then |
| 183 | rmscip-shell system . . rm. -rf $client_kernel_tmp_dir/ |
| 184 | fi |
| 185 | ;; |
| 186 | "already_exist") |
| 187 | echoscip-shell system . . echo. "$msg_latest_kernel_is_already_installed" |
| 188 | echoscip-shell system . . echo. Now run: drblsrv-offline $verbose_opt -c -d -a -l $lang -p $console_opt1 \"$console_opt2\" $pxe_serial_opt1 \"$pxe_serial_opt2\" |
| 189 | drblsrv-offline $verbose_opt -c -d -a -l $lang -p $console_opt1 "$console_opt2" $pxe_serial_opt1 "$pxe_serial_opt2" |
| 190 | ;; |
| 191 | esac |
| 192 | } # end of run_drblsrv_offline |
| 193 | # |
| 194 | setup_RH_yumscip-shell shell shell-project 0.0.0 setup_RH_yum().() { |
| 195 | # 1. |
| 196 | # OS AYO repository |
| 197 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 198 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 199 | echoscip-shell system . . echo. "$msg_which_os_ayo_repository" |
| 200 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 201 | echoscip-shell system . . echo. "$msg_os_ayo_repository_0" |
| 202 | echoscip-shell system . . echo. "$msg_os_ayo_repository_download_fedora_redhat_com" |
| 203 | echoscip-shell system . . echo. "$msg_os_ayo_repository_use_existing_yum_config" |
| 204 | echoscip-shell system . . echo. "$msg_os_ayo_repository_enter_by_yourself" |
| 205 | echoscip-shell system . . echo. -n "[0] " |
| 206 | read os_ayo_repo_answer |
| 207 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 208 | parse_RH_os_yum_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_os_yum_repo_answer(). $OS_Version $os_ayo_repo_answer |
| 209 | |
| 210 | # drbl AYO repository |
| 211 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 212 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 213 | echoscip-shell system . . echo. "$msg_which_drbl_ayo_repository" |
| 214 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 215 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_0" |
| 216 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_1" |
| 217 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_2" |
| 218 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_enter_by_yourself" |
| 219 | echoscip-shell system . . echo. -n "[0] " |
| 220 | read drbl_ayo_repo_answer |
| 221 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 222 | parse_RH_drbl_yum_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_drbl_yum_repo_answer(). $drbl_ayo_repo_answer |
| 223 | |
| 224 | # ask some RPM and apt repository options, such as drbl-testing, drbl-unstable |
| 225 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 226 | |
| 227 | generate_fedora_yum_confscip-shell shell shell-project 0.0.0 generate_fedora_yum_conf(). |
| 228 | |
| 229 | generate_drbl_yum_confscip-shell shell shell-project 0.0.0 generate_drbl_yum_conf(). |
| 230 | |
| 231 | } # end of setup_RH_yum |
| 232 | |
| 233 | setup_RH_aptscip-shell shell shell-project 0.0.0 setup_RH_apt().() { |
| 234 | # 1. |
| 235 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 236 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 237 | echoscip-shell system . . echo. "$msg_which_os_ayo_repository" |
| 238 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 239 | echoscip-shell system . . echo. "$msg_os_ayo_repository_0" |
| 240 | echoscip-shell system . . echo. "$msg_os_ayo_repository_1" |
| 241 | #echo "$msg_ayo_repository_2" |
| 242 | echoscip-shell system . . echo. "$msg_os_ayo_repository_3" |
| 243 | #echo "$msg_ayo_repository_4" |
| 244 | echoscip-shell system . . echo. "$msg_os_ayo_repository_5" |
| 245 | echoscip-shell system . . echo. -n "[0] " |
| 246 | read os_ayo_repo_answer |
| 247 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 248 | parse_RH_os_apt_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_os_apt_repo_answer(). $OS_Version $os_ayo_repo_answer |
| 249 | |
| 250 | # |
| 251 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 252 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 253 | echoscip-shell system . . echo. "$msg_which_drbl_ayo_repository" |
| 254 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 255 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_0" |
| 256 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_1" |
| 257 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_2" |
| 258 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_3" |
| 259 | #echo "$msg_ayo_repository_4" |
| 260 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_5" |
| 261 | echoscip-shell system . . echo. -n "[0] " |
| 262 | read drbl_ayo_repo_answer |
| 263 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 264 | parse_RH_drbl_apt_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_drbl_apt_repo_answer(). $drbl_ayo_repo_answer |
| 265 | |
| 266 | # ask some RPM and apt repository options, such as drbl-testing, drbl-unstable |
| 267 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 268 | |
| 269 | # install wget if not installed, which is always necessary |
| 270 | rpm -q wget &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 271 | if [scip-shell system . . `[`. "$?" -gt 0 ]; then |
| 272 | echoscip-shell system . . echo. "$msg_no_wget_get_it" |
| 273 | WGET_idx=$(echoscip-shell system . . echo. $OS_Version | trscip-shell system . . tr. "\." "_") |
| 274 | # we will get the variables like wget_rpm_RH8_0, wget_rpm_FC1, wget_rpm_MDK9_2 |
| 275 | eval WGET_RPM=\$wget_rpm_$WGET_idx |
| 276 | for irpm in $RH_RPMS_os_update_dir; do |
| 277 | echoscip-shell system . . echo. "Try to install wget from $url_os_coreroot/$irpm/$WGET_RPM..." |
| 278 | # TODO: make it work with file://... |
| 279 | rpm -ivh --quiet $url_os_coreroot/$irpm/$WGET_RPM &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 280 | RETVAL=$? |
| 281 | [scip-shell system . . `[`. $RETVAL -eq 0 ] && break |
| 282 | done |
| 283 | # check if wget installed |
| 284 | rpm -q wget &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 285 | if [scip-shell system . . `[`. "$?" -gt 0 ]; then |
| 286 | echoscip-shell system . . echo. "$msg_wget_installed_failure" |
| 287 | else |
| 288 | echoscip-shell system . . echo. "$msg_wget_installed_successful" |
| 289 | fi |
| 290 | fi |
| 291 | # check if apt is installed or not |
| 292 | rpm -q apt &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 293 | if [scip-shell system . . `[`. "$?" -gt 0 ]; then |
| 294 | echoscip-shell system . . echo. "$msg_install_apt" |
| 295 | # install apt |
| 296 | echoscip-shell system . . echo. "$msg_no_apt_get_it" |
| 297 | case "$ayo_repo_answer" in |
| 298 | # if local apt repository, do not use url in the network |
| 299 | 3) |
| 300 | # local apt repository |
| 301 | rpm -Uvh $url_drbl_collect_root/RPMS.drbl-collect/apt-[0-9]*.i386.rpm |
| 302 | RETVAL=$? |
| 303 | if [scip-shell system . . `[`. "$RETVAL" -gt 0 ]; then |
| 304 | echoscip-shell system . . echo. "$msg_Failed_to_install $pkg_file..." |
| 305 | return $RETVAL |
| 306 | fi |
| 307 | ;; |
| 308 | *) |
| 309 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -u $url_drbl_collect_root/RPMS.drbl-collect/ -p apt -a i386 -r "rpm -Uvh" |
| 310 | rc=$? |
| 311 | check_rpm_installscip-shell shell shell-project 0.0.0 check_rpm_install(). $rc apt |
| 312 | esac |
| 313 | else |
| 314 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 315 | echoscip-shell system . . echo. "$msg_apt_already_installed" |
| 316 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 317 | fi |
| 318 | # Clean the "Architecture "i[356]86"; "in apt.conf first, |
| 319 | # later we will insert Architecture "i386" to /etc/apt/apt.conf here, |
| 320 | perlscip-shell system . . perl. -p -i -e "s/Architecture *\"i[356]86\".*;//g" /etc/apt/apt.confscip-shell filesystem . . `/etc/apt/apt.conf`. |
| 321 | |
| 322 | # backup apt sources.list if it's found. |
| 323 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 324 | backup_apt_sources_listscip-shell shell shell-project 0.0.0 backup_apt_sources_list(). |
| 325 | |
| 326 | # set the apt sources.list |
| 327 | # OS |
| 328 | case "$os_ayo_repo_answer" in |
| 329 | 3) |
| 330 | #local harddisk dir |
| 331 | catscip-shell system . . cat. <<-APT_END > /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. |
| 332 | rpm copy:$url_os/$os_ayo_path . $core_dir updates $FRESHRPMS |
| 333 | #rpm-src copy:$url_os/$os_ayo_path . $core_dir updates $FRESHRPMS |
| 334 | APT_END |
| 335 | ;; |
| 336 | *) |
| 337 | catscip-shell system . . cat. <<-APT_END > /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. |
| 338 | rpm $url_os/$os_ayo_path . $core_dir updates $FRESHRPMS |
| 339 | #rpm-src $url_os/$os_ayo_path . $core_dir updates $FRESHRPMS |
| 340 | APT_END |
| 341 | esac |
| 342 | |
| 343 | # DRBL |
| 344 | case "$drbl_ayo_repo_answer" in |
| 345 | 3) |
| 346 | #local harddisk dir |
| 347 | catscip-shell system . . cat. <<-APT_END >> /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. |
| 348 | rpm copy:$url_drbl/$drbl_ayo_path . drbl-stable $DRBL_TEST $DRBL_UNSTABLE $CJK_REPOSITORY $DRBL_EXTRA |
| 349 | #rpm-src copy:$url_drbl/$drbl_ayo_path . drbl-stable $DRBL_TEST $DRBL_UNSTABLE $CJK_REPOSITORY $DRBL_EXTRA |
| 350 | APT_END |
| 351 | ;; |
| 352 | *) |
| 353 | catscip-shell system . . cat. <<-APT_END >> /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. |
| 354 | rpm $url_drbl/$drbl_ayo_path . drbl-stable $DRBL_TEST $DRBL_UNSTABLE $CJK_REPOSITORY $DRBL_EXTRA |
| 355 | rpm $url_drbl_collect_root . drbl-collect |
| 356 | #rpm-src $url_drbl/$drbl_ayo_path . drbl-stable $DRBL_TEST $DRBL_UNSTABLE $CJK_REPOSITORY $DRBL_EXTRA |
| 357 | #rpm-src $url_drbl_collect_root . drbl-collect |
| 358 | APT_END |
| 359 | esac |
| 360 | |
| 361 | # append some examples to sources.list |
| 362 | append_RH_apt_sources_list_examplescip-shell shell shell-project 0.0.0 append_RH_apt_sources_list_example(). |
| 363 | |
| 364 | echoscip-shell system . . echo. "--------------------------------------------------------------------" |
| 365 | echoscip-shell system . . echo. "$msg_enjoy_apt" |
| 366 | |
| 367 | } # setup_RH_apt |
| 368 | |
| 369 | install_drbl_RHscip-shell shell shell-project 0.0.0 install_drbl_RH().() { |
| 370 | # function to install Redhat/Fedora DRBL |
| 371 | |
| 372 | # Source networking configuration. |
| 373 | . /etc/sysconfig/networkscip-shell source . . `/etc/sysconfig/network`. |
| 374 | |
| 375 | # Check that networking is up. |
| 376 | [scip-shell system . . `[`. "${NETWORKING}" = "no" ] && exit 0 |
| 377 | |
| 378 | # clean the stale files and make necessary directories |
| 379 | [scip-shell system . . `[`. -f $drbl_pkgdir/dev.tgz ] && rmscip-shell system . . rm. -f $drbl_pkgdir/dev.tgz |
| 380 | # create the directory for diskless image |
| 381 | [scip-shell system . . `[`. ! -d "/tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`." ] && mkdirscip-shell system . . mkdir. -p /tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`. |
| 382 | |
| 383 | # Check if selinux is enabled |
| 384 | if [scip-shell system . . `[`. -e /etc/selinux/configscip-shell filesystem . . `/etc/selinux/config`. ]; then |
| 385 | SELINUX="" |
| 386 | . /etc/selinux/configscip-shell source . . `/etc/selinux/config`. |
| 387 | if [scip-shell system . . `[`. "$SELINUX" = "enforcing" ]; then |
| 388 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 389 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 390 | echoscip-shell system . . echo. "$msg_warning_selinux_is_enabled" |
| 391 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 392 | confirm_continue_or_not_default_quit |
| 393 | fi |
| 394 | fi |
| 395 | |
| 396 | # 1. |
| 397 | # setup apt/yum first |
| 398 | # parse os to set the repository |
| 399 | parse_os_to_set_repositoryscip-shell shell shell-project 0.0.0 parse_os_to_set_repository(). |
| 400 | |
| 401 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 402 | |
| 403 | # Check package in blacklist. Especially for grub2. |
| 404 | case "$OS_Version" in |
| 405 | CO*|RH*) |
| 406 | grub2_ver_rel="$(LC_ALL=C rpm -q --qf "%{VERSION}-%{RELEASE}\n" grub2)" |
| 407 | # For newer CentOS 7 (e.g. 7.1.1503) and Fedora 22, 23. It seems either (tftp) can not be accessed or some other issues. |
| 408 | grub2_blacklist_v="2.02-0.16 2.02-0.17 2.02-0.23" |
| 409 | for iblack in $grub2_blacklist_v; do |
| 410 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $grub2_ver_rel | grepscip-shell system . . grep. -iw "$iblack")" ]; then |
| 411 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 412 | echoscip-shell system . . echo. "This version of grub2 ($iblack) is buggy. You have to downgrade or upgrade it to bug free version, otherwise your uEFI client won't be able to make uEFI network boot, and its error in clients is as follows:" |
| 413 | echoscip-shell system . . echo. "error: timeout: could not resolve hardware address." |
| 414 | echoscip-shell system . . echo. "Or" |
| 415 | echoscip-shell system . . echo. "Blank screen for a while, then show an error about \"Could not find config file\" on tftp server." |
| 416 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 417 | echoscip-shell system . . echo. "E.g. you can run these commands as root to downgrade the bug free version of grub2 on CentOS:" |
| 418 | if [scip-shell system . . `[`. -n "$(rpm -q grub2-efi-modules)" ]; then |
| 419 | echoscip-shell system . . echo. "yum remove grub2-efi-modules" |
| 420 | fi |
| 421 | echoscip-shell system . . echo. "yum downgrade http://vault.centos.org/7.0.1406/os/x86_64/Packages/grub2-2.02-0.2.10.el7.centos.1.x86_64.rpm http://vault.centos.org/7.0.1406/os/x86_64/Packages/grub2-efi-2.02-0.2.10.el7.centos.1.x86_64.rpm http://vault.centos.org/7.0.1406/os/x86_64/Packages/grub2-tools-2.02-0.2.10.el7.centos.1.x86_64.rpm" |
| 422 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 423 | confirm_continue_or_not_default_quit |
| 424 | break |
| 425 | fi |
| 426 | done |
| 427 | ;; |
| 428 | esac |
| 429 | if [scip-shell system . . `[`. -z "$select_repository" ]; then |
| 430 | # default setting, maybe overwritten by command option |
| 431 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 432 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 433 | echoscip-shell system . . echo. "$msg_do_you_want_set_yum_repo" |
| 434 | echoscip-shell system . . echo. "$msg_set_yum_conf_yes_prompt" |
| 435 | echoscip-shell system . . echo. "$msg_set_yum_conf_no_prompt" |
| 436 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 437 | echoscip-shell system . . echo. -n "[y/N] " |
| 438 | read set_repo_ans |
| 439 | case "$set_repo_ans" in |
| 440 | y|Y|[yY][eE][sS]) |
| 441 | select_repository="yes" |
| 442 | ;; |
| 443 | *) |
| 444 | select_repository="no" |
| 445 | ;; |
| 446 | esac |
| 447 | fi |
| 448 | |
| 449 | # Set the fedora repository. |
| 450 | if [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 451 | # FC1-4: fedora.repo |
| 452 | # FC5: fedore-core.repo |
| 453 | # FC7: fedora.repo |
| 454 | if [scip-shell system . . `[`. -e "/etc/yum.repos.d/fedora-core.reposcip-shell filesystem . . `/etc/yum.repos.d/fedora-core.repo`." ]; then |
| 455 | FC_CORE_REPO="fedora-core.repo" |
| 456 | elif [scip-shell system . . `[`. -e "/etc/yum.repos.d/fedora.reposcip-shell filesystem . . `/etc/yum.repos.d/fedora.repo`." ]; then |
| 457 | FC_CORE_REPO="fedora.repo" |
| 458 | else |
| 459 | # default one: |
| 460 | FC_CORE_REPO="fedora-core.repo" |
| 461 | fi |
| 462 | fi |
| 463 | |
| 464 | if [scip-shell system . . `[`. "$select_repository" = "yes" ]; then |
| 465 | # Since we might for to install rpm package, it's better to import RPM key for yum, the default setting of yum enables key check. |
| 466 | [scip-shell system . . `[`. "$installer" = "yum" ] && import_rpm_keyscip-shell shell shell-project 0.0.0 import_rpm_key(). |
| 467 | # For RH8/9.0/FC1-2, already set $select_repository=yes, so this will be run |
| 468 | echoscip-shell system . . echo. "Now select the $OS_Version repository settings..." |
| 469 | setup_${OS_type}_${installer} |
| 470 | install_curl_etc_via_${installer}_if_necessary |
| 471 | else |
| 472 | # This only for yum |
| 473 | # put drbl-core yum repos conf |
| 474 | [scip-shell system . . `[`. ! -d "/etc/yum.repos.dscip-shell filesystem . . `/etc/yum.repos.d`." ] && mkdirscip-shell system . . mkdir. -p /etc/yum.repos.dscip-shell filesystem . . `/etc/yum.repos.d`. |
| 475 | |
| 476 | # Check if the repository setting exists |
| 477 | # TODO: need beter method to check. |
| 478 | if [scip-shell system . . `[`. ! -f "/etc/yum.repos.d/$FC_CORE_REPO" -a ! -f "/etc/yum.repos.d/CentOS-Base.reposcip-shell filesystem . . `/etc/yum.repos.d/CentOS-Base.repo`." ]; then |
| 479 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 480 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 481 | echoscip-shell system . . echo. "No yum repository setting found!" |
| 482 | echoscip-shell system . . echo. "You must set the yum repository in /etc/yum.repos.d/!" |
| 483 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 484 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 485 | echoscip-shell system . . echo. "$msg_program_stop" |
| 486 | exit 1 |
| 487 | fi |
| 488 | echoscip-shell system . . echo. "Use the $OS_Version repository settings in /etc/yum.repos.d/." |
| 489 | |
| 490 | # backup the old setting |
| 491 | echoscip-shell system . . echo. -n "Seting the DRBL yum repository in /etc/yum.repos.d/... " |
| 492 | for ifile in $drbl_yum_repo_list; do |
| 493 | [scip-shell system . . `[`. -f "/etc/yum.repos.d/$ifile" ] && mvscip-shell system . . mv. -f /etc/yum.repos.d/$ifile /etc/yum.repos.d/$ifile.drblsave |
| 494 | done |
| 495 | cpscip-shell system . . cp. -f $DRBL_SCRIPT_PATH/setup/yum-repos/drbl*.repo /etc/yum.repos.d/scip-shell filesystem . . `/etc/yum.repos.d/`. |
| 496 | echoscip-shell system . . echo. "done!" |
| 497 | |
| 498 | # ask some RPM and apt repository options, such as drbl-testing, drbl-unstable |
| 499 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 500 | # turn on some branches if set |
| 501 | if [scip-shell system . . `[`. -n "$DRBL_STABLE" ]; then |
| 502 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 503 | else |
| 504 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 505 | fi |
| 506 | if [scip-shell system . . `[`. -n "$DRBL_TEST" ]; then |
| 507 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 508 | else |
| 509 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 510 | fi |
| 511 | if [scip-shell system . . `[`. -n "$DRBL_UNSTABLE" ]; then |
| 512 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 513 | else |
| 514 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 515 | fi |
| 516 | # [ -n "$DRBL_EXTRA" ] && perl -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" /etc/yum.repos.d/drbl-extra.repo |
| 517 | |
| 518 | get_url_ocs_then_install_curl_etc_via_yum_if_necessaryscip-shell shell shell-project 0.0.0 get_url_ocs_then_install_curl_etc_via_yum_if_necessary(). |
| 519 | |
| 520 | if [scip-shell system . . `[`. -z "$url_os" ]; then |
| 521 | # Not found, use the default one... |
| 522 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 523 | echoscip-shell system . . echo. "The repository in the system is not found, use DRBL default one." |
| 524 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 525 | parse_${OS_type}_os_${installer}_repo_answer $OS_Version default |
| 526 | parse_${OS_type}_drbl_${installer}_repo_answer default |
| 527 | echoscip-shell system . . echo. "Use yum repository in $url_os_coreroot" |
| 528 | check_if_repository_in_blacklistscip-shell shell shell-project 0.0.0 check_if_repository_in_blacklist(). $url_os |
| 529 | fi |
| 530 | fi |
| 531 | |
| 532 | # ask some setting for client, such as SMP, serial console... |
| 533 | ask_and_parse_client_extra_settingscip-shell shell shell-project 0.0.0 ask_and_parse_client_extra_setting(). |
| 534 | |
| 535 | # parse the setting of client archi. |
| 536 | parse_client_archi_settingscip-shell shell shell-project 0.0.0 parse_client_archi_setting(). |
| 537 | |
| 538 | # It's important to remove the cache of apt, otherwise |
| 539 | # the RPM::Architecture will not take effect. check this: |
| 540 | # http://distro2.conectiva.com.br/pipermail/apt-rpm/2003-November/002015.html |
| 541 | # ... RPM::Architecture, is what he's looking for. His problem was that the cache was built before he set the architecture. Doing "rm -f /var/cache/apt/*.bin; apt-get update" would make it work. |
| 542 | |
| 543 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 544 | echoscip-shell system . . echo. "$msg_clean_apt_cache" |
| 545 | for ifile in /var/cache/apt/*.bin; do |
| 546 | rmscip-shell system . . rm. -f /var/cache/apt/$ifile |
| 547 | done |
| 548 | fi |
| 549 | |
| 550 | # Update the apt data with repository. |
| 551 | # if it's yum, skip this, later yum will do it. Because yum update will also |
| 552 | # do upgrade... |
| 553 | [scip-shell system . . `[`. "$installer" = "apt" ] && $inst_prog update |
| 554 | |
| 555 | # 2. |
| 556 | # check if apt is integrity... Ex: original MDK 9.2 is buggy... |
| 557 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 558 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 559 | echoscip-shell system . . echo. "$msg_check_apt_integrity" |
| 560 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 561 | check_apt_integrityscip-shell shell shell-project 0.0.0 check_apt_integrity(). |
| 562 | fi |
| 563 | |
| 564 | # 3. |
| 565 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 566 | # Before update or install packages, if there is yum-updatesd service, stop it first to avoid conflict |
| 567 | flag_start_yumupdatesd_later="no" |
| 568 | if [scip-shell system . . `[`. -e /var/lock/subsys/yum-updatesdscip-shell filesystem . . `/var/lock/subsys/yum-updatesd`. ]; then |
| 569 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 570 | echoscip-shell system . . echo. "Stopping service yum-updatesd to avoid locking problem... " |
| 571 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 572 | /etc/init.d/yum-updatesdscip-shell filesystem . . `/etc/init.d/yum-updatesd`. stop |
| 573 | flag_start_yumupdatesd_later="yes" |
| 574 | # In case the following is running, kill it: |
| 575 | # /usr/bin/python -tt /usr/libexec/yum-updatesd-helper --check --dbus |
| 576 | # Otherwise we will see this annoying message: |
| 577 | # "Another app is currently holding the yum lock; waiting for it to exit..." |
| 578 | # Here we use subshell to avoid function names in /etc/init.d/functions might be the same with that in DRBL. |
| 579 | ( # We need the function killproc in /etc/init.d/functions |
| 580 | . /etc/init.d/functionsscip-shell source . . `/etc/init.d/functions`. |
| 581 | killproc yum-updatesd-helper &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 582 | ) |
| 583 | fi |
| 584 | # 3.a |
| 585 | # We will ask if upgrade system first or not. |
| 586 | # Try to find if the i386 glibc and openssl are installed or not |
| 587 | # If they are installed, hold them not to be upgraded to i686 |
| 588 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 589 | if [scip-shell system . . `[`. -z "$upgrade_system_answer" ]; then |
| 590 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 591 | echoscip-shell system . . echo. "$msg_upgrade_system_question" |
| 592 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 593 | echoscip-shell system . . echo. -n "[y/N] " |
| 594 | read upgrade_system_answer |
| 595 | fi |
| 596 | |
| 597 | case "$upgrade_system_answer" in |
| 598 | y|Y|[yY][eE][sS]) |
| 599 | do_upgrade_system_for_RHscip-shell shell shell-project 0.0.0 do_upgrade_system_for_RH(). |
| 600 | ;; |
| 601 | esac |
| 602 | |
| 603 | # 3.b |
| 604 | # ugly...might be not my fault... |
| 605 | # for some distribution some version, we have to force upgrading some packages. |
| 606 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 607 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 608 | echoscip-shell system . . echo. "$msg_try_to_update_some_pkgs" |
| 609 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 610 | case "$OS_Version" in |
| 611 | "RH8.0"|"RH9") |
| 612 | # This one only works for RH8 |
| 613 | $inst_prog -y install redhat-config-xfree86 |
| 614 | ;; |
| 615 | "FC1") |
| 616 | # gpm is buggy, can not work with clonezilla, so upgrage to mine |
| 617 | # in drbl repository |
| 618 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 619 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 620 | $inst_prog -y install gpm redhat-config-xfree86 |
| 621 | ;; |
| 622 | "FC2") |
| 623 | # FC2 use different name "system-config-display" instead of "redhat-config-xfree86" |
| 624 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 625 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 626 | $inst_prog -y install system-config-display |
| 627 | ;; |
| 628 | "FC4") |
| 629 | # in FC4, sfdisk, rpm and nc are buggy, |
| 630 | # sfdisk can not work with clonezilla, |
| 631 | # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=159418 |
| 632 | # Original nc is buggy since it will skip some input tail... |
| 633 | # So upgrage |
| 634 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 635 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 636 | $inst_prog -y install rpm util-linux nc |
| 637 | ;; |
| 638 | "FC5") |
| 639 | # released lftp (3.4.2-5) is buggy, can not work |
| 640 | # with http://free.nchc.org.tw/fedora |
| 641 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 642 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 643 | $inst_prog -y install lftp |
| 644 | ;; |
| 645 | "FC6") |
| 646 | # released kudzu (1.2.57.1-2) is buggy: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=213602 |
| 647 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 648 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 649 | $inst_prog -y install kudzu |
| 650 | ;; |
| 651 | esac |
| 652 | |
| 653 | # 4. |
| 654 | # prepare the kernel for clients |
| 655 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 656 | echoscip-shell system . . echo. "$msg_prepare_kernel_for_clients" |
| 657 | prepare_install_RH_MDK_client_kernelscip-shell shell shell-project 0.0.0 prepare_install_RH_MDK_client_kernel(). |
| 658 | |
| 659 | # 5. |
| 660 | # Install the necessary packages for DRBL |
| 661 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 662 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 663 | echoscip-shell system . . echo. "$msg_install_DRBL_necesary_files" |
| 664 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 665 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 666 | echoscip-shell system . . echo. "$msg_install_dhcp_tftp_etc" |
| 667 | |
| 668 | # wget maybe not installed, we will check it is installed only when apt is not installed, so if apt/yum is installed while wget is not installed, get_inst_rpm() will failed! Add wget here. |
| 669 | |
| 670 | # $PKG_FROM_RH, $PKG_TO_QUERY, $PKG_TO_QUERY_RH and $PKG_FROM_DRBL are loaded from conf/drbl.conf |
| 671 | PKG_TO_QUERY="$PKG_TO_QUERY $PKG_TO_QUERY_RH" |
| 672 | echoscip-shell system . . echo. "Searching if $PKG_TO_QUERY available... " |
| 673 | case "$installer" in |
| 674 | yum) |
| 675 | for ipkg in $PKG_TO_QUERY; do |
| 676 | if [scip-shell system . . `[`. -n "$(LC_ALL=C yum list $ipkg 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -E "^$ipkg")" ]; then |
| 677 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 678 | PKG_FROM_RH="$PKG_FROM_RH $ipkg" |
| 679 | fi |
| 680 | done |
| 681 | ;; |
| 682 | apt) |
| 683 | for ipkg in $PKG_TO_QUERY; do |
| 684 | if [scip-shell system . . `[`. -n "$(apt-cachescip-shell system . . apt-cache. pkgnames $ipkg 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 685 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 686 | PKG_FROM_RH="$PKG_FROM_RH $ipkg" |
| 687 | fi |
| 688 | done |
| 689 | ;; |
| 690 | esac |
| 691 | |
| 692 | $inst_prog -y install $PKG_FROM_RH $PKG_FROM_DRBL |
| 693 | # TODO |
| 694 | RETVAL=$? |
| 695 | check_apt_installscip-shell shell shell-project 0.0.0 check_apt_install(). $RETVAL |
| 696 | |
| 697 | # 6. |
| 698 | # After the dist upgrade, check the ARCH for glibc, openssl... if it does not fit the requirement, replace it. |
| 699 | install_client_archi_glibc_openssl_RHscip-shell shell shell-project 0.0.0 install_client_archi_glibc_openssl_RH(). |
| 700 | |
| 701 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 702 | # 7. |
| 703 | # 7.a |
| 704 | # netinstall |
| 705 | if [scip-shell system . . `[`. "$DRBL_NETINSTALL" = "yes" ]; then |
| 706 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 707 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 708 | echoscip-shell system . . echo. "$msg_install_net_install_images" |
| 709 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 710 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 711 | drbl-netinstall -i all -s -v |
| 712 | fi |
| 713 | |
| 714 | # 7.b |
| 715 | # Creat dev tarball in $drbl_pkgdir, |
| 716 | # which will be copied to /tftpboot/node_root/etc/diskless-image |
| 717 | # in deploy script |
| 718 | tmp_dev_dir="$(mktempscip-shell system . . mktemp. -d -q /tmp/devtmp.XXXXXXscip-shell filesystem . . `/tmp/devtmp.XXXXXX`.)" |
| 719 | dev_wgettmp="$(mktempscip-shell system . . mktemp. -d -q /tmp/dev_wgettmp.XXXXXXscip-shell filesystem . . `/tmp/dev_wgettmp.XXXXXX`.)" |
| 720 | [scip-shell system . . `[`. ! -d $drbl_pkgdir ] && mkdirscip-shell system . . mkdir. -p $drbl_pkgdir |
| 721 | |
| 722 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 723 | |
| 724 | # get dev |
| 725 | if [scip-shell system . . `[`. -n "$(LC_ALL=C lsscip-shell system . . ls. /sbin/udev* 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 726 | # udev |
| 727 | echoscip-shell system . . echo. "udev is found in server... The DRBL client will use udev... " |
| 728 | # checking, just in case. |
| 729 | # we must install udev... |
| 730 | if ! rpm -q --quiet udev; then |
| 731 | echoscip-shell system . . echo. -n "Try to install udev..." |
| 732 | $inst_prog -y install udev |
| 733 | _install_udev_result=$? |
| 734 | echoscip-shell system . . echo. "done!" |
| 735 | if [scip-shell system . . `[`. "$_install_udev_result" -ne 0 ]; then |
| 736 | # actually this should not happen, but who knows ? |
| 737 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 738 | echoscip-shell system . . echo. "Program udev was found in the server, but unable to install a complete udev rpm!" |
| 739 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 740 | echoscip-shell system . . echo. "$msg_program_stop" |
| 741 | exit 1 |
| 742 | fi |
| 743 | fi |
| 744 | else |
| 745 | echoscip-shell system . . echo. "$msg_get_dev" |
| 746 | echoscip-shell system . . echo. "$msg_creating_dev" |
| 747 | # pre-packaged dev.tgz |
| 748 | dev_got=0 |
| 749 | for ipkg in dev MAKEDEV; do |
| 750 | Is_ipkg_avail="" |
| 751 | for idir in $RH_RPMS_os_update_dir; do |
| 752 | Is_ipkg_avail="$(list_available_rpm $url_os_coreroot/$idir/ | grepscip-shell system . . grep. -E "^$ipkg-[0-9]+.*.i386.rpm" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 753 | if [scip-shell system . . `[`. -n "$Is_ipkg_avail" ]; then |
| 754 | echoscip-shell system . . echo. "Downloading $ipkg rpm from $url_os_coreroot/$idir/..." |
| 755 | wget -r -l1 --no-parent --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$dev_wgettmp" -A "$ipkg-[0-9]*.i386.rpm" $url_os_coreroot/${idir}/ |
| 756 | fi |
| 757 | # once it's done, skip the next search |
| 758 | if [scip-shell system . . `[`. "$(lsscip-shell system . . ls. $dev_wgettmp/$ipkg-[0-9]*.i386.rpm 2> /dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 759 | echoscip-shell system . . echo. "Got the $ipkg rpm!" |
| 760 | dev_got=1 |
| 761 | break |
| 762 | else |
| 763 | [scip-shell system . . `[`. -n "$verbose" ] && echoscip-shell system . . echo. "\"$ipkg\" is not found in $url_os_coreroot/$idir/." |
| 764 | fi |
| 765 | done |
| 766 | # if we can not download dev rpm, then skip the MAKEDEV download. |
| 767 | [scip-shell system . . `[`. "$dev_got" = 0 ] && break |
| 768 | done |
| 769 | ( |
| 770 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. $dev_wgettmp/dev[-_]*.i386.rpm 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" -a -n "$(lsscip-shell system . . ls. $dev_wgettmp/MAKEDEV[-_]*.i386.rpm 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 771 | cd $tmp_dev_dir |
| 772 | echoscip-shell system . . echo. -n "Creating the device files for DRBL client..." |
| 773 | # To avoid the duplicated rpms... just find the latest one. |
| 774 | latest_dev="$(list_latest_rpm $dev_wgettmp/ | grepscip-shell system . . grep. -E "^dev[-_].*.i386.rpm")" |
| 775 | latest_MAKEDEV="$(list_latest_rpm $dev_wgettmp/ | grepscip-shell system . . grep. -E "^MAKEDEV[-_].*.i386.rpm")" |
| 776 | rpm2cpio $dev_wgettmp/$latest_dev | cpio -idm |
| 777 | rpm2cpio $dev_wgettmp/$latest_MAKEDEV | cpio -idm |
| 778 | cd $tmp_dev_dir/dev && tarscip-shell system . . tar. czf $drbl_pkgdir/dev.tgz * |
| 779 | echoscip-shell system . . echo. "done!" |
| 780 | else |
| 781 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 782 | echoscip-shell system . . echo. "No udev, and no pre-packaged devices file!" |
| 783 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 784 | echoscip-shell system . . echo. "$msg_program_stop" |
| 785 | exit 1 |
| 786 | fi |
| 787 | ) |
| 788 | echoscip-shell system . . echo. "$msg_clean_tmp_dev" |
| 789 | fi |
| 790 | [scip-shell system . . `[`. -d "$tmp_dev_dir" -a -n "$(echoscip-shell system . . echo. $tmp_dev_dir | grepscip-shell system . . grep. "devtmp" )" ] && rmscip-shell system . . rm. -rf $tmp_dev_dir |
| 791 | [scip-shell system . . `[`. -d "$dev_wgettmp" -a -n "$(echoscip-shell system . . echo. $dev_wgettmp | grepscip-shell system . . grep. "dev_wgettmp" )" ] && rmscip-shell system . . rm. -rf $dev_wgettmp |
| 792 | # |
| 793 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 794 | if [scip-shell system . . `[`. "$flag_start_yumupdatesd_later" = "yes" ]; then |
| 795 | echoscip-shell system . . echo. "Finished the package installation, now resume yum-updatesd." |
| 796 | /etc/init.d/yum-updatesdscip-shell filesystem . . `/etc/init.d/yum-updatesd`. start |
| 797 | fi |
| 798 | |
| 799 | # 8. |
| 800 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 801 | # Force to install all the kernel selected. |
| 802 | echoscip-shell system . . echo. "$msg_install_kernel_for_clients ..." |
| 803 | echoscip-shell system . . echo. "$msg_search_kernel_in_ayo kernel${SMP_OPTION} ..." |
| 804 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 805 | run_drblsrv_offlinescip-shell shell shell-project 0.0.0 run_drblsrv_offline(). |
| 806 | |
| 807 | } # end of install_drbl_RH |
| 808 | |
| 809 | uninstall_drbl_RHscip-shell shell shell-project 0.0.0 uninstall_drbl_RH().() { |
| 810 | # check if apt is installed or not |
| 811 | if ! rpm -q --quiet apt && ! rpm -q --quiet yum; then |
| 812 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 813 | echoscip-shell system . . echo. "$msg_no_apt_already_uninstall" |
| 814 | echoscip-shell system . . echo. "$msg_program_stop" |
| 815 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 816 | exit 1 |
| 817 | fi |
| 818 | |
| 819 | # if apt is not installed, the installer must be yum |
| 820 | if ! rpm -q --quiet apt; then |
| 821 | installer="yum" |
| 822 | inst_prog="yum" |
| 823 | fi |
| 824 | |
| 825 | # Set the fedora repository. |
| 826 | if [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 827 | # FC1-4: fedora.repo |
| 828 | # FC5: fedore-core.repo |
| 829 | if [scip-shell system . . `[`. -e "/etc/yum.repos.d/fedora-core.reposcip-shell filesystem . . `/etc/yum.repos.d/fedora-core.repo`." ]; then |
| 830 | FC_CORE_REPO="fedora-core.repo" |
| 831 | elif [scip-shell system . . `[`. -e "/etc/yum.repos.d/fedora.reposcip-shell filesystem . . `/etc/yum.repos.d/fedora.repo`." ]; then |
| 832 | FC_CORE_REPO="fedora.repo" |
| 833 | else |
| 834 | # default one: |
| 835 | FC_CORE_REPO="fedora-core.repo" |
| 836 | fi |
| 837 | fi |
| 838 | |
| 839 | # |
| 840 | do_some_cleanup_before_uninstallscip-shell shell shell-project 0.0.0 do_some_cleanup_before_uninstall(). |
| 841 | drbl-netinstall -u all -s |
| 842 | |
| 843 | # |
| 844 | # skip removing dialog, rsync, curl... which are usually necessary. |
| 845 | # TODO, separate ntp, it seems that to remove ntp together will fail in FC3 |
| 846 | # with yum. |
| 847 | $inst_prog remove $PKG_TO_UNINSTALL_PART1_RH $PKG_FROM_DRBL |
| 848 | [scip-shell system . . `[`. -n "$PKG_TO_UNINSTALL_PART2_RH" ] && $inst_prog remove $PKG_TO_UNINSTALL_PART2_RH |
| 849 | |
| 850 | # rename some config files if they still exist |
| 851 | for icfg in dhcpd.conf dhcpd.conf.etherboot.include exports sysconfig/iptables; do |
| 852 | [scip-shell system . . `[`. -f "/etc/${icfg}" ] && mvscip-shell system . . mv. -f /etc/${icfg} /etc/${icfg}.drblsave |
| 853 | done |
| 854 | |
| 855 | # remove the stale files |
| 856 | rmscip-shell system . . rm. -f /etc/init.d/ocsscip-shell filesystem . . `/etc/init.d/ocs`. |
| 857 | rmscip-shell system . . rm. -f $SYSCONF_PATH/mkswapfile |
| 858 | |
| 859 | echoscip-shell system . . echo. "$msg_remove_drbl_setup_question" |
| 860 | echoscip-shell system . . echo. -n "[y/N] " |
| 861 | read drbl_remove_answer |
| 862 | case "$drbl_remove_answer" in |
| 863 | y|Y|[yY][eE][sS]) |
| 864 | $inst_prog remove drbl |
| 865 | drbl_remove_answer=y |
| 866 | ;; |
| 867 | esac |
| 868 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 869 | echoscip-shell system . . echo. "$msg_remove_apt_question" |
| 870 | echoscip-shell system . . echo. -n "[y/N] " |
| 871 | read apt_answer |
| 872 | case "$apt_answer" in |
| 873 | y|Y|[yY][eE][sS]) |
| 874 | rpm -e apt |
| 875 | [scip-shell system . . `[`. -d /var/cache/apt/scip-shell filesystem . . `/var/cache/apt/`. ] && echoscip-shell system . . echo. "$msg_cleaning_apt_cache" && rmscip-shell system . . rm. -rf /var/cache/apt/scip-shell filesystem . . `/var/cache/apt/`. |
| 876 | ;; |
| 877 | esac |
| 878 | elif [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 879 | echoscip-shell system . . echo. "$msg_remove_yum_repo_question" |
| 880 | echoscip-shell system . . echo. -n "[y/N] " |
| 881 | read yum_repo_answer |
| 882 | case "$yum_repo_answer" in |
| 883 | y|Y|[yY][eE][sS]) |
| 884 | repo_lists="$drbl_yum_repo_list" |
| 885 | for ifile in $repo_lists; do |
| 886 | [scip-shell system . . `[`. -f "/etc/yum.repos.d/$ifile" ] && mvscip-shell system . . mv. -v /etc/yum.repos.d/$ifile /etc/yum.repos.d/$ifile.drblsave |
| 887 | done |
| 888 | esac |
| 889 | fi |
| 890 | |
| 891 | # clean tftpboot and misc files. |
| 892 | clean_tftpboot_and_miscscip-shell shell shell-project 0.0.0 clean_tftpboot_and_misc(). |
| 893 | |
| 894 | echoscip-shell system . . echo. "$msg_Done!!!" |
| 895 | |
| 896 | } # end of uninstall_drbl_RH |
| 897 | |
| 898 | # |
| 899 | setup_MDK_urpmiscip-shell shell shell-project 0.0.0 setup_MDK_urpmi().() { |
| 900 | # Setting |
| 901 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 902 | |
| 903 | # 1. |
| 904 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 905 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 906 | echoscip-shell system . . echo. "$msg_which_os_ayo_repository" |
| 907 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 908 | mdk_os_ayo_repo_answer_def="2" |
| 909 | echoscip-shell system . . echo. "$msg_os_ayo_repository_0 (http)," |
| 910 | echoscip-shell system . . echo. "1 -> ftp.twaren.net (http)," |
| 911 | echoscip-shell system . . echo. "2 -> mirrors.kernel.org (http)," |
| 912 | echoscip-shell system . . echo. "3 -> ftp.isu.edu.tw (ftp)," |
| 913 | echoscip-shell system . . echo. "$msg_os_ayo_repository_5" |
| 914 | echoscip-shell system . . echo. -n "[$mdk_os_ayo_repo_answer_def] " |
| 915 | read mdk_os_ayo_repo_answer |
| 916 | [scip-shell system . . `[`. -z "$mdk_os_ayo_repo_answer" ] && mdk_os_ayo_repo_answer="$mdk_os_ayo_repo_answer_def" |
| 917 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 918 | parse_MDK_os_ayo_repo_answerscip-shell shell shell-project 0.0.0 parse_MDK_os_ayo_repo_answer(). $mdk_os_ayo_repo_answer |
| 919 | |
| 920 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 921 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 922 | echoscip-shell system . . echo. "$msg_which_drbl_ayo_repository" |
| 923 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 924 | mdk_drbl_ayo_repo_answer_def="0" |
| 925 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_0 (http)," |
| 926 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_1_mdk (http)," |
| 927 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_2_mdk (http)," |
| 928 | echoscip-shell system . . echo. "$msg_drbl_ayo_repository_5," |
| 929 | echoscip-shell system . . echo. -n "[$mdk_drbl_ayo_repo_answer_def] " |
| 930 | read mdk_drbl_ayo_repo_answer |
| 931 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 932 | [scip-shell system . . `[`. -z "$mdk_drbl_ayo_repo_answer" ] && mdk_drbl_ayo_repo_answer="$mdk_drbl_ayo_repo_answer_def" |
| 933 | parse_MDK_drbl_ayo_repo_answerscip-shell shell shell-project 0.0.0 parse_MDK_drbl_ayo_repo_answer(). $mdk_drbl_ayo_repo_answer |
| 934 | |
| 935 | # ask some RPM and apt repository options, such as drbl-testing, drbl-unstable |
| 936 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 937 | |
| 938 | # Import the pub GPG keys |
| 939 | for ik in /etc/RPM-GPG-KEYS/*.asc; do |
| 940 | key_version=$(basenamescip-shell system . . basename. $ik | sedscip-shell system . . sed. -e "s/.asc//g") |
| 941 | if ! rpm -q gpg-pubkey-$key_version &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 942 | echoscip-shell system . . echo. -n "Importing the public GPG keys from $ik... " |
| 943 | rpm --import $ik |
| 944 | echoscip-shell system . . echo. "done!" |
| 945 | fi |
| 946 | done |
| 947 | |
| 948 | # TODO: find a method to keep the existing OS uprmi, but overwrite the DRBL urpmi |
| 949 | [scip-shell system . . `[`. -f "/etc/urpmi/urpmi.cfgscip-shell filesystem . . `/etc/urpmi/urpmi.cfg`." ] && cpscip-shell system . . cp. -v /etc/urpmi/urpmi.cfgscip-shell filesystem . . `/etc/urpmi/urpmi.cfg`. /etc/urpmi/urpmi.cfg.drblsavescip-shell filesystem . . `/etc/urpmi/urpmi.cfg.drblsave`. |
| 950 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 951 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 952 | echoscip-shell system . . echo. "$msg_reset_all_existing_urpmi_setting" |
| 953 | echoscip-shell system . . echo. "$msg_are_u_sure_u_want_to_continue" |
| 954 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 955 | echoscip-shell system . . echo. -n "[Y/n] " |
| 956 | read remove_urpmi_setting |
| 957 | case "$remove_urpmi_setting" in |
| 958 | n|N|[nN][oO]) |
| 959 | echoscip-shell system . . echo. "$msg_program_stop" |
| 960 | exit 1 |
| 961 | ;; |
| 962 | y|Y|[yY][eE][sS]) |
| 963 | echoscip-shell system . . echo. "$msg_ok_let_do_it" |
| 964 | ;; |
| 965 | esac |
| 966 | echoscip-shell system . . echo. "Removing the old urpmi setting..." |
| 967 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 968 | urpmi.removemedia -a |
| 969 | |
| 970 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 971 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 972 | echoscip-shell system . . echo. "Adding urpmi source..." |
| 973 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 974 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 975 | # OS |
| 976 | urpmi.addmedia --distrib --probe-synthesis MDK${MDK_VER_PATH} $url_os/$os_ayo_path/$MDK_VER_PATH/$ARCH/ |
| 977 | urpmi.addmedia MDK${MDK_VER_PATH}-updates $url_os/$os_ayo_path/updates/${update_extra_code_name}$MDK_VER_PATH/$update_rpmdir_info |
| 978 | |
| 979 | # DRBL |
| 980 | case "$OS_Version" in |
| 981 | # For older than 2009.0 version, we need to use "with ../...cz" |
| 982 | # For 2009.0 or later, not necessary, since media_info is already in the RPMS.drbl-*/ |
| 983 | MDK10.[1-2]|MDV200[678].*) |
| 984 | drbl_stable_mdv_with_option="with ../base/synthesis.hdlist.drbl.cz" |
| 985 | drbl_testing_mdv_with_option="with ../base/synthesis.hdlist.drbl-testing.cz" |
| 986 | drbl_unstable_mdv_with_option="with ../base/synthesis.hdlist.drbl-unstable.cz" |
| 987 | ;; |
| 988 | esac |
| 989 | urpmi.addmedia drbl-stable $url_drbl/$drbl_ayo_path/RPMS.drbl-stable/ $drbl_stable_mdv_with_option |
| 990 | if [scip-shell system . . `[`. -n "$DRBL_TEST" ]; then |
| 991 | urpmi.addmedia drbl-testing $url_drbl/$drbl_ayo_path/RPMS.drbl-testing/ $drbl_testing_mdv_with_option |
| 992 | fi |
| 993 | if [scip-shell system . . `[`. -n "$DRBL_UNSTABLE" ]; then |
| 994 | urpmi.addmedia drbl-unstable $url_drbl/$drbl_ayo_path/RPMS.drbl-unstable/ $drbl_unstable_mdv_with_option |
| 995 | fi |
| 996 | |
| 997 | echoscip-shell system . . echo. "--------------------------------------------------------------------" |
| 998 | echoscip-shell system . . echo. "The urpmi setting is finished." |
| 999 | |
| 1000 | } # setup_MDK_urpmi |
| 1001 | |
| 1002 | install_drbl_MDKscip-shell shell shell-project 0.0.0 install_drbl_MDK().() { |
| 1003 | # function to install MDK DRBL |
| 1004 | |
| 1005 | # Source networking configuration. |
| 1006 | . /etc/sysconfig/networkscip-shell source . . `/etc/sysconfig/network`. |
| 1007 | |
| 1008 | # Check that networking is up. |
| 1009 | [scip-shell system . . `[`. ${NETWORKING} = "no" ] && exit 0 |
| 1010 | |
| 1011 | # clean the stale files and make necessary directories |
| 1012 | [scip-shell system . . `[`. -f $drbl_pkgdir/dev.tgz ] && rmscip-shell system . . rm. -f $drbl_pkgdir/dev.tgz |
| 1013 | # create the directory for diskless image |
| 1014 | [scip-shell system . . `[`. ! -d "/tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`." ] && mkdirscip-shell system . . mkdir. -p /tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`. |
| 1015 | |
| 1016 | # 1. |
| 1017 | # setup urpmi first |
| 1018 | # parse os to set the repository |
| 1019 | parse_os_to_set_repositoryscip-shell shell shell-project 0.0.0 parse_os_to_set_repository(). |
| 1020 | |
| 1021 | if [scip-shell system . . `[`. "$select_repository" = "yes" ]; then |
| 1022 | setup_${OS_type}_${installer} |
| 1023 | else |
| 1024 | # we need $url_os, "$os_ayo_path"and "$url_os_coreroot for kernel and dev |
| 1025 | parse_${OS_type}_os_ayo_repo_answer default $OS_Version |
| 1026 | parse_${OS_type}_drbl_ayo_repo_answer default |
| 1027 | echoscip-shell system . . echo. "Use urpmi repository in $url_os_coreroot" |
| 1028 | fi |
| 1029 | |
| 1030 | # Now only for urpmi only, no more apt in MDK |
| 1031 | inst_prog="urpmi" |
| 1032 | inst_opt="--auto --force" |
| 1033 | inst_action="" |
| 1034 | |
| 1035 | # we need curl to parse url to get kernel. |
| 1036 | # we need lftp to parse the yum repo config if the repo is in ftp:// |
| 1037 | $inst_prog $inst_opt $inst_action lftp curl |
| 1038 | |
| 1039 | # ask some setting for client, such as SMP, serial console... |
| 1040 | ask_and_parse_client_extra_settingscip-shell shell shell-project 0.0.0 ask_and_parse_client_extra_setting(). |
| 1041 | |
| 1042 | # for MDK, although it's only i586, but for mdk10.1/10.2, i686 is necessary for |
| 1043 | # SMP. MDK does NOT provide i586-smp kernel |
| 1044 | parse_client_archi_settingscip-shell shell shell-project 0.0.0 parse_client_archi_setting(). |
| 1045 | |
| 1046 | # 2. |
| 1047 | # We will upgrade system first. |
| 1048 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1049 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1050 | echoscip-shell system . . echo. "$msg_upgrade_system_question" |
| 1051 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1052 | echoscip-shell system . . echo. -n "[y/N] " |
| 1053 | read upgrade_system_answer |
| 1054 | case "$upgrade_system_answer" in |
| 1055 | y|Y|[yY][eE][sS]) |
| 1056 | do_upgrade_system_for_MDKscip-shell shell shell-project 0.0.0 do_upgrade_system_for_MDK(). |
| 1057 | ;; |
| 1058 | esac |
| 1059 | |
| 1060 | # 3. |
| 1061 | # prepare the kernel for clients |
| 1062 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1063 | echoscip-shell system . . echo. "$msg_prepare_kernel_for_clients" |
| 1064 | prepare_install_RH_MDK_client_kernelscip-shell shell shell-project 0.0.0 prepare_install_RH_MDK_client_kernel(). |
| 1065 | |
| 1066 | # 4. |
| 1067 | # Install the necessary packages for DRBL |
| 1068 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1069 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1070 | echoscip-shell system . . echo. "$msg_install_DRBL_necesary_files" |
| 1071 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1072 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1073 | |
| 1074 | # $PKG_FROM_MDK, $PKG_TO_QUERY and $PKG_FROM_DRBL are loaded from conf/drbl.conf |
| 1075 | # Check if lvm2 is available, if so, add it, we need this for |
| 1076 | # clonezilla to save or restore LVM2 PV/VG/LV. |
| 1077 | # Check lzop also. |
| 1078 | echoscip-shell system . . echo. "Searching if $PKG_TO_QUERY available... " |
| 1079 | for ipkg in $PKG_TO_QUERY; do |
| 1080 | if urpmq $ipkg &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 1081 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 1082 | PKG_FROM_MDK="$PKG_FROM_MDK $ipkg" |
| 1083 | fi |
| 1084 | done |
| 1085 | |
| 1086 | $inst_prog $inst_opt $inst_action $PKG_FROM_MDK $PKG_FROM_DRBL |
| 1087 | |
| 1088 | # 4.b |
| 1089 | # ugly...might be not my fault... |
| 1090 | # for some distribution some version, we have to force upgrading some packages. |
| 1091 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1092 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1093 | echoscip-shell system . . echo. "$msg_try_to_update_some_pkgs" |
| 1094 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1095 | case "$OS_Version" in |
| 1096 | MDV200[6789].*|MDV201[0].*) |
| 1097 | # released cdialog is buggy, can not work correctly without gpm running |
| 1098 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 1099 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 1100 | $inst_prog $inst_opt $inst_action gpm |
| 1101 | ;; |
| 1102 | esac |
| 1103 | |
| 1104 | # netinstall |
| 1105 | if [scip-shell system . . `[`. "$DRBL_NETINSTALL" = "yes" ]; then |
| 1106 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1107 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1108 | echoscip-shell system . . echo. "$msg_install_net_install_images" |
| 1109 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1110 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1111 | drbl-netinstall -i all -s -v |
| 1112 | fi |
| 1113 | |
| 1114 | # 5. dev for client machines |
| 1115 | # For MDK 9.2... no dev rpm...It's necessary to make one before run |
| 1116 | # this... (Just create the tarball from some Mandrake machine) |
| 1117 | # It's ugly here... |
| 1118 | [scip-shell system . . `[`. ! -d $drbl_pkgdir ] && mkdirscip-shell system . . mkdir. -p $drbl_pkgdir |
| 1119 | if [scip-shell system . . `[`. -f $drbl_setup_path/files/${OS_type}/${OS_Version}/dev.${OS_Version}.tgz ]; then |
| 1120 | cpscip-shell system . . cp. -f $drbl_setup_path/files/${OS_type}/${OS_Version}/dev.${OS_Version}.tgz $drbl_pkgdir/dev.tgz |
| 1121 | else |
| 1122 | # we must install udev... |
| 1123 | if ! rpm -q --quiet udev; then |
| 1124 | echoscip-shell system . . echo. -n "Try to install udev..." |
| 1125 | $inst_prog $inst_opt $inst_action udev |
| 1126 | echoscip-shell system . . echo. "Done!" |
| 1127 | fi |
| 1128 | if ! rpm -q --quiet udev; then |
| 1129 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 1130 | echoscip-shell system . . echo. "No udev, and no pre-packaged devices file!" |
| 1131 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1132 | echoscip-shell system . . echo. "$msg_program_stop" |
| 1133 | exit 1 |
| 1134 | fi |
| 1135 | fi |
| 1136 | |
| 1137 | # 6. |
| 1138 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1139 | # Force to install all the kernel selected. |
| 1140 | echoscip-shell system . . echo. "$msg_install_kernel_for_clients ..." |
| 1141 | echoscip-shell system . . echo. "$msg_search_kernel_in_ayo kernel${SMP_OPTION} ..." |
| 1142 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1143 | run_drblsrv_offlinescip-shell shell shell-project 0.0.0 run_drblsrv_offline(). |
| 1144 | |
| 1145 | } # end of install_drbl_MDK |
| 1146 | |
| 1147 | uninstall_drbl_MDKscip-shell shell shell-project 0.0.0 uninstall_drbl_MDK().() { |
| 1148 | # check if apt is installed or not |
| 1149 | if ! rpm -q --quiet apt && ! rpm -q --quiet urpmi; then |
| 1150 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 1151 | echoscip-shell system . . echo. "$msg_no_apt_already_uninstall" |
| 1152 | echoscip-shell system . . echo. "$msg_program_stop" |
| 1153 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1154 | exit 1 |
| 1155 | fi |
| 1156 | |
| 1157 | # if apt is not installed, the installer must be urpmi |
| 1158 | if ! rpm -q --quiet apt; then |
| 1159 | installer="urpmi" |
| 1160 | uninst_prog="urpme" |
| 1161 | uninst_action="" |
| 1162 | else |
| 1163 | installer="apt" |
| 1164 | uninst_prog="apt-get" |
| 1165 | uninst_action="remove" |
| 1166 | fi |
| 1167 | |
| 1168 | # |
| 1169 | do_some_cleanup_before_uninstallscip-shell shell shell-project 0.0.0 do_some_cleanup_before_uninstall(). |
| 1170 | drbl-netinstall -u all -s |
| 1171 | |
| 1172 | # Do not uninstall curl, usually necessary |
| 1173 | $uninst_prog $uninst_action $PKG_TO_UNINSTALL_PART1_MDK $PKG_FROM_DRBL |
| 1174 | [scip-shell system . . `[`. -n "$PKG_TO_UNINSTALL_PART2_MDK" ] && $uninst_prog $uninst_action $PKG_TO_UNINSTALL_PART2_MDK |
| 1175 | |
| 1176 | # rename some config files if they exist |
| 1177 | for icfg in dhcpd.conf dhcpd.conf.etherboot.include exports sysconfig/iptables; do |
| 1178 | [scip-shell system . . `[`. -f "/etc/${icfg}" ] && mvscip-shell system . . mv. -f /etc/${icfg} /etc/${icfg}.drblsave |
| 1179 | done |
| 1180 | |
| 1181 | # remove the stale files |
| 1182 | rmscip-shell system . . rm. -f /etc/init.d/ocsscip-shell filesystem . . `/etc/init.d/ocs`. |
| 1183 | rmscip-shell system . . rm. -f $SYSCONF_PATH/mkswapfile |
| 1184 | |
| 1185 | echoscip-shell system . . echo. "$msg_remove_drbl_setup_question" |
| 1186 | echoscip-shell system . . echo. -n "[y/N] " |
| 1187 | read drbl_remove_answer |
| 1188 | case "$drbl_remove_answer" in |
| 1189 | y|Y|[yY][eE][sS]) |
| 1190 | $uninst_prog $uninst_action drbl |
| 1191 | ;; |
| 1192 | esac |
| 1193 | |
| 1194 | echoscip-shell system . . echo. "$msg_remove_urpmi_media_question" |
| 1195 | echoscip-shell system . . echo. -n "[y/N] " |
| 1196 | read urpmi_media_answer |
| 1197 | case "$urpmi_media_answer" in |
| 1198 | y|Y|[yY][eE][sS]) |
| 1199 | urpmi.removemedia -a |
| 1200 | ;; |
| 1201 | esac |
| 1202 | |
| 1203 | # clean tftpboot and misc files. |
| 1204 | clean_tftpboot_and_miscscip-shell shell shell-project 0.0.0 clean_tftpboot_and_misc(). |
| 1205 | |
| 1206 | echoscip-shell system . . echo. "$msg_Done!!!" |
| 1207 | |
| 1208 | } # end of uninstall_drbl_MDK |
| 1209 | |
| 1210 | uninstall_drbl_DBNscip-shell shell shell-project 0.0.0 uninstall_drbl_DBN().() { |
| 1211 | # function to uninstall Debian DRBL |
| 1212 | [scip-shell system . . `[`. -e /etc/lsb-releasescip-shell filesystem . . `/etc/lsb-release`. ] && . /etc/lsb-releasescip-shell source . . `/etc/lsb-release`. |
| 1213 | #if [ "$DISTRIB_ID" = "Ubuntu" ]; then |
| 1214 | # # Ubuntu, not Debian. |
| 1215 | # # Force to set LC_ALL=C, otherwise in Ubuntu, it will show a lot warning messages in debconf like |
| 1216 | # # perl: warning: Setting locale failed. |
| 1217 | # # perl: warning: Please check that your locale settings: |
| 1218 | # # LANGUAGE = "zh_TW:zh:en_US:en", |
| 1219 | # # LC_ALL = "zh_TW.Big5", |
| 1220 | # # LANG = "zh_TW.UTF-8" |
| 1221 | # # are supported and installed on your system. |
| 1222 | # # perl: warning: Falling back to the standard locale ("C"). |
| 1223 | # export LC_ALL=C |
| 1224 | #fi |
| 1225 | |
| 1226 | # |
| 1227 | do_some_cleanup_before_uninstallscip-shell shell shell-project 0.0.0 do_some_cleanup_before_uninstall(). |
| 1228 | drbl-netinstall -u all -s |
| 1229 | |
| 1230 | # |
| 1231 | # do not remove rsync, bc, iptables, curl since this will remove a lots in B2D. |
| 1232 | # $PKG_TO_UNSINSTALL_PART*_DBN and $PKG_FROM_DRBL loaded from conf/drbl.conf |
| 1233 | apt-getscip-shell system . . apt-get. --purge remove $PKG_TO_UNINSTALL_PART1_DBN $PKG_FROM_DRBL |
| 1234 | # Separate the dhcp3-server/dhcp3-common as an another package to be removed, othewise something went wrong in Woody. Do not put --purge |
| 1235 | [scip-shell system . . `[`. -n "$PKG_TO_UNINSTALL_PART2_DBN" ] && apt-getscip-shell system . . apt-get. remove $PKG_TO_UNINSTALL_PART2_DBN |
| 1236 | |
| 1237 | # rename some config files if they exist |
| 1238 | for icfg in exports drbl-nat.up.rules; do |
| 1239 | [scip-shell system . . `[`. -f "/etc/${icfg}" ] && mvscip-shell system . . mv. -f /etc/${icfg} /etc/${icfg}.drblsave |
| 1240 | done |
| 1241 | for icfg in dhcpd.conf dhcpd.conf.etherboot.include; do |
| 1242 | # For distribution <= lenny |
| 1243 | [scip-shell system . . `[`. -f /etc/dhcp3/$icfg ] && mvscip-shell system . . mv. -f /etc/dhcp3/${icfg} /etc/dhcp3/${icfg}.drblsave |
| 1244 | # For distribution >= squeeze |
| 1245 | [scip-shell system . . `[`. -f /etc/dhcp/$icfg ] && mvscip-shell system . . mv. -f /etc/dhcp/${icfg} /etc/dhcp/${icfg}.drblsave |
| 1246 | done |
| 1247 | # remove drbl-clients-nat |
| 1248 | if [scip-shell system . . `[`. -e /etc/init.d/drbl-clients-natscip-shell filesystem . . `/etc/init.d/drbl-clients-nat`. ]; then |
| 1249 | get_debian_ubuntu_init_serv_control_prog |
| 1250 | if [scip-shell system . . `[`. "$dbn_ubn_serv_control_prog" = "use-insserv" ]; then |
| 1251 | # Use insserv |
| 1252 | insserv -r drbl-clients-nat &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 1253 | else |
| 1254 | # Use update-rc.d |
| 1255 | update-rc.dscip-shell system . . `update-rc.d`. -f drbl-clients-nat remove &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 1256 | fi |
| 1257 | rmscip-shell system . . rm. -f /etc/init.d/drbl-clients-natscip-shell filesystem . . `/etc/init.d/drbl-clients-nat`. |
| 1258 | fi |
| 1259 | |
| 1260 | # Revert the modifications about systemd-logind bug. |
| 1261 | # For Ubuntu 18.04 using systemd > 275, a bug for systemd-logind |
| 1262 | # Ref: https://sourceforge.net/p/drbl/mailman/message/36319119/ |
| 1263 | # https://github.com/systemd/systemd/issues/7074 |
| 1264 | if [scip-shell system . . `[`. -e /lib/systemd/system/systemd-logind.servicescip-shell filesystem . . `/lib/systemd/system/systemd-logind.service`. ]; then |
| 1265 | perlscip-shell system . . perl. -pi -e "s/^#IPAddressDeny=any.*$/IPAddressDeny=any/g" /lib/systemd/system/systemd-logind.servicescip-shell filesystem . . `/lib/systemd/system/systemd-logind.service`. |
| 1266 | fi |
| 1267 | if [scip-shell system . . `[`. -e /lib/systemd/system/systemd-udevd.servicescip-shell filesystem . . `/lib/systemd/system/systemd-udevd.service`. ]; then |
| 1268 | perlscip-shell system . . perl. -pi -e "s/^#IPAddressDeny=any.*$/IPAddressDeny=any/g" /lib/systemd/system/systemd-udevd.servicescip-shell filesystem . . `/lib/systemd/system/systemd-udevd.service`. |
| 1269 | fi |
| 1270 | |
| 1271 | # remove the stale file |
| 1272 | rmscip-shell system . . rm. -f /etc/init.d/ocsscip-shell filesystem . . `/etc/init.d/ocs`. |
| 1273 | rmscip-shell system . . rm. -f $SYSCONF_PATH/mkswapfile |
| 1274 | [scip-shell system . . `[`. -f $SYSCONF_PATH/drbl-nat.up.rules ] && mvscip-shell system . . mv. -f $SYSCONF_PATH/drbl-nat.up.rules $SYSCONF_PATH/drbl-nat.up.rules.drblsave |
| 1275 | |
| 1276 | echoscip-shell system . . echo. "$msg_remove_drbl_setup_question" |
| 1277 | echoscip-shell system . . echo. -n "[y/N] " |
| 1278 | read drbl_remove_answer |
| 1279 | case "$drbl_remove_answer" in |
| 1280 | y|Y|[yY][eE][sS]) |
| 1281 | apt-getscip-shell system . . apt-get. --purge remove drbl |
| 1282 | ;; |
| 1283 | esac |
| 1284 | |
| 1285 | # clean tftpboot and misc files. |
| 1286 | clean_tftpboot_and_miscscip-shell shell shell-project 0.0.0 clean_tftpboot_and_misc(). |
| 1287 | |
| 1288 | echoscip-shell system . . echo. "$msg_Done!!!" |
| 1289 | |
| 1290 | } # end of uninstall_drbl_DBN |
| 1291 | |
| 1292 | uninstall_drbl_SUSEscip-shell shell shell-project 0.0.0 uninstall_drbl_SUSE().() { |
| 1293 | # Function to uninstall SuSE DRBL |
| 1294 | # |
| 1295 | do_some_cleanup_before_uninstallscip-shell shell shell-project 0.0.0 do_some_cleanup_before_uninstall(). |
| 1296 | drbl-netinstall -u all -s |
| 1297 | |
| 1298 | # do not remove curl, usually necessary |
| 1299 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 1300 | apt-getscip-shell system . . apt-get. --purge remove $PKG_TO_UNINSTALL_SUSE $PKG_FROM_DRBL |
| 1301 | elif [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 1302 | find_yum_repos_dir_path_for_opensusescip-shell shell shell-project 0.0.0 find_yum_repos_dir_path_for_opensuse(). |
| 1303 | yum remove $PKG_TO_UNINSTALL_SUSE $PKG_FROM_DRBL |
| 1304 | elif [scip-shell system . . `[`. "$installer" = "zypper" ]; then |
| 1305 | zypper remove $PKG_TO_UNINSTALL_SUSE $PKG_FROM_DRBL |
| 1306 | fi |
| 1307 | |
| 1308 | # rename some config files if they exist |
| 1309 | for icfg in dhcpd.conf dhcpd.conf.etherboot.include exports; do |
| 1310 | [scip-shell system . . `[`. -f "/etc/${icfg}" ] && mvscip-shell system . . mv. -f /etc/${icfg} /etc/${icfg}.drblsave |
| 1311 | done |
| 1312 | |
| 1313 | # remove the stale files |
| 1314 | rmscip-shell system . . rm. -f /etc/init.d/ocsscip-shell filesystem . . `/etc/init.d/ocs`. |
| 1315 | rmscip-shell system . . rm. -f /etc/apt/apt.conf.d/drbl-arch.confscip-shell filesystem . . `/etc/apt/apt.conf.d/drbl-arch.conf`. |
| 1316 | rmscip-shell system . . rm. -f $SYSCONF_PATH/mkswapfile |
| 1317 | |
| 1318 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 1319 | echoscip-shell system . . echo. "$msg_remove_apt_question" |
| 1320 | echoscip-shell system . . echo. -n "[y/N] " |
| 1321 | read apt_answer |
| 1322 | case "$apt_answer" in |
| 1323 | y|Y|[yY][eE][sS]) |
| 1324 | rpm -e apt-libs apt |
| 1325 | [scip-shell system . . `[`. -d /var/cache/apt/scip-shell filesystem . . `/var/cache/apt/`. ] && echoscip-shell system . . echo. "$msg_cleaning_apt_cache" && rmscip-shell system . . rm. -rf /var/cache/apt/scip-shell filesystem . . `/var/cache/apt/`. |
| 1326 | ;; |
| 1327 | esac |
| 1328 | elif [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 1329 | echoscip-shell system . . echo. "$msg_remove_yum_repo_question" |
| 1330 | echoscip-shell system . . echo. -n "[y/N] " |
| 1331 | read yum_repo_answer |
| 1332 | case "$yum_repo_answer" in |
| 1333 | y|Y|[yY][eE][sS]) |
| 1334 | # we won't touch the existing one, just copied by drbl. |
| 1335 | repo_lists="$drbl_yum_repo_list opensuse-${OS_VER_NO}.repo opensuse-updates-${OS_VER_NO}.repo" |
| 1336 | for ifile in $repo_lists; do |
| 1337 | [scip-shell system . . `[`. -f "$yum_conf_dir_path/$ifile" ] && mvscip-shell system . . mv. -v $yum_conf_dir_path/$ifile $yum_conf_dir_path/$ifile.drblsave |
| 1338 | done |
| 1339 | esac |
| 1340 | fi |
| 1341 | |
| 1342 | echoscip-shell system . . echo. "$msg_remove_drbl_setup_question" |
| 1343 | echoscip-shell system . . echo. -n "[y/N] " |
| 1344 | read drbl_remove_answer |
| 1345 | case "$drbl_remove_answer" in |
| 1346 | y|Y|[yY][eE][sS]) |
| 1347 | [scip-shell system . . `[`. "$installer" = "apt" ] && apt-getscip-shell system . . apt-get. --purge remove drbl |
| 1348 | [scip-shell system . . `[`. "$installer" = "yum" ] && yum remove drbl |
| 1349 | [scip-shell system . . `[`. "$installer" = "zypper" ] && zypper remove drbl |
| 1350 | ;; |
| 1351 | esac |
| 1352 | |
| 1353 | # clean tftpboot and misc files. |
| 1354 | clean_tftpboot_and_miscscip-shell shell shell-project 0.0.0 clean_tftpboot_and_misc(). |
| 1355 | |
| 1356 | echoscip-shell system . . echo. "$msg_Done!!!" |
| 1357 | |
| 1358 | } # end of uninstall_drbl_SUSE |
| 1359 | |
| 1360 | # common functions for DRBL in RedHat/Fedora/Mandrake Linux. |
| 1361 | |
| 1362 | # |
| 1363 | apt_install_result_msgscip-shell shell shell-project 0.0.0 apt_install_result_msg().() { |
| 1364 | RETVAL="$1" |
| 1365 | if [scip-shell system . . `[`. "$RETVAL" -gt 0 ]; then |
| 1366 | echoscip-shell system . . echo. "$msg_failed_to_install_pkgs" |
| 1367 | echoscip-shell system . . echo. "$msg_please $msg_browse $drbl_url_zh_TW $msg_or $drbl_url_en_US $msg_for_more_details. " |
| 1368 | echoscip-shell system . . echo. "$msg_press_ctrl_c_stop" |
| 1369 | read |
| 1370 | exit 1 |
| 1371 | fi |
| 1372 | } |
| 1373 | # |
| 1374 | check_apt_installscip-shell shell shell-project 0.0.0 check_apt_install().() { |
| 1375 | local RETVAL=$1 |
| 1376 | if [scip-shell system . . `[`. "$RETVAL" -gt 0 ]; then |
| 1377 | echoscip-shell system . . echo. "$msg_failed_to_install_pkgs" |
| 1378 | echoscip-shell system . . echo. "$msg_please $msg_browse $drbl_url_zh_TW $msg_or $drbl_url_en_US $msg_for_more_details. " |
| 1379 | echoscip-shell system . . echo. "$msg_press_ctrl_c_stop" |
| 1380 | read |
| 1381 | exit 1 |
| 1382 | fi |
| 1383 | } |
| 1384 | |
| 1385 | # |
| 1386 | check_rpm_installscip-shell shell shell-project 0.0.0 check_rpm_install().() { |
| 1387 | local RETVAL=$1 |
| 1388 | local pkg=$2 |
| 1389 | if [scip-shell system . . `[`. "$RETVAL" -gt 0 ]; then |
| 1390 | echoscip-shell system . . echo. "XXXXXXX XXXXXXX XXXXXXX" |
| 1391 | echoscip-shell system . . echo. "$msg_Failed_to_install \"$pkg\"!!!" |
| 1392 | echoscip-shell system . . echo. "$msg_check_network_and_url $url" |
| 1393 | exit 1 |
| 1394 | fi |
| 1395 | } |
| 1396 | |
| 1397 | # define a function get_inst_rpm to get and install rpm package which |
| 1398 | # apt can not process now. ie. only i386 rpms |
| 1399 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm().() { |
| 1400 | # Note! the last / in $url must be kept!!! |
| 1401 | # example: get_inst_rpm -u http://os.nchc.org.tw/... -p glibc -a i386 |
| 1402 | # If -f|--url-pkg is set, the rpm name is specified, so we will NOT use -A '*...rpm" for wget. |
| 1403 | # Note: -f|--url-pkg (no wildcard) and "-u|--url, -p|--pkg, -a|--arch" (wildcard) are two different ways to assign the package. They conflict each other. |
| 1404 | local specified_name="no" |
| 1405 | local url_tmp pkg arch rpm_run_and_opt dir="" assign_pkg_tmp_dir |
| 1406 | while [scip-shell system . . `[`. $# -gt 0 ]; do |
| 1407 | case "$1" in |
| 1408 | -f|--url-pkg) |
| 1409 | # full name (path and name, no wildcard) |
| 1410 | shift; url_pkg="$1" |
| 1411 | specified_name="yes" |
| 1412 | url_tmp="$(dirnamescip-shell system . . dirname. $url_pkg)" |
| 1413 | # Note! This pkg is like: glibc-2.4-25.i586.rpm |
| 1414 | pkg="$(basenamescip-shell system . . basename. $url_pkg)" |
| 1415 | shift;; |
| 1416 | -u|--url) |
| 1417 | shift; url_tmp="$1" |
| 1418 | shift;; |
| 1419 | -p|--pkg) |
| 1420 | shift; pkg="$1" |
| 1421 | shift;; |
| 1422 | -a|--arch) |
| 1423 | shift; arch="$1" |
| 1424 | shift;; |
| 1425 | -r|--rpm-run-and-opt) |
| 1426 | shift; rpm_run_and_opt="$1" |
| 1427 | shift;; |
| 1428 | -t|--tmp-dir) |
| 1429 | shift; assign_pkg_tmp_dir="$1" |
| 1430 | shift;; |
| 1431 | *) |
| 1432 | break ;; |
| 1433 | esac |
| 1434 | done |
| 1435 | if [scip-shell system . . `[`. -z "$assign_pkg_tmp_dir" ]; then |
| 1436 | pkg_tmp_dir="$(mktempscip-shell system . . mktemp. -d -q /tmp/${pkg}-rpm-tmp.XXXXXX)" |
| 1437 | else |
| 1438 | pkg_tmp_dir="$assign_pkg_tmp_dir" |
| 1439 | fi |
| 1440 | # try to append the version for regular expression if pkg without version number filter. |
| 1441 | if [scip-shell system . . `[`. "$specified_name" = "no" ]; then |
| 1442 | if [scip-shell system . . `[`. -n "$pkg" -a -z "$(echoscip-shell system . . echo. $pkg | grepscip-shell system . . grep. -E "\-[0-9]")" ]; then |
| 1443 | pkg="$pkg-[0-9]" |
| 1444 | fi |
| 1445 | fi |
| 1446 | case "$url_tmp" in |
| 1447 | http://*|ftp://*) |
| 1448 | if [scip-shell system . . `[`. "$specified_name" = "yes" ]; then |
| 1449 | wget -r -l1 --no-parent --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$pkg_tmp_dir" $url_pkg |
| 1450 | else |
| 1451 | # use wildcard |
| 1452 | wget -r -l1 --no-parent --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$pkg_tmp_dir" -A "$pkg*.$arch.rpm" $url_tmp/ |
| 1453 | fi |
| 1454 | ;; |
| 1455 | file://*) |
| 1456 | # TODO: maybe use link (ln -fs ) ? |
| 1457 | dir="$(echoscip-shell system . . echo. $url_tmp | sedscip-shell system . . sed. -e "s|file://||g")" |
| 1458 | if [scip-shell system . . `[`. "$specified_name" = "yes" ]; then |
| 1459 | cpscip-shell system . . cp. -f "$dir/$pkg" $pkg_tmp_dir |
| 1460 | else |
| 1461 | # use wildcard |
| 1462 | cpscip-shell system . . cp. -f "$dir/$pkg*.$arch.rpm" $pkg_tmp_dir |
| 1463 | fi |
| 1464 | ;; |
| 1465 | esac |
| 1466 | pkg_file="$(lsscip-shell system . . ls. $pkg_tmp_dir/$pkg* 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 1467 | # If the rpm_run_and_opt exists, we install the rpm package |
| 1468 | if [scip-shell system . . `[`. -n "$rpm_run_and_opt" ]; then |
| 1469 | if [scip-shell system . . `[`. -n "$pkg_file" ]; then |
| 1470 | $rpm_run_and_opt $opt $pkg_file |
| 1471 | RETVAL=$? |
| 1472 | if [scip-shell system . . `[`. "$RETVAL" -gt 0 ]; then |
| 1473 | if [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $pkg | grepscip-shell system . . grep. -E "\<glibc\>")" ]; then |
| 1474 | # UGLY!!! |
| 1475 | # For glibc, with --force, although the reinstallation is successful, |
| 1476 | # but the return code is always 1. ignore that. |
| 1477 | echoscip-shell system . . echo. "$msg_Failed_to_install $pkg_file..." |
| 1478 | fi |
| 1479 | fi |
| 1480 | else |
| 1481 | RETVAL=1 |
| 1482 | fi |
| 1483 | else |
| 1484 | # only download |
| 1485 | RETVAL=0 |
| 1486 | fi |
| 1487 | # If the pkg_tmp_dir is not assigned, we can remove it. Otherwise it's for |
| 1488 | # package to be used. |
| 1489 | if [scip-shell system . . `[`. -z "$assign_pkg_tmp_dir" ]; then |
| 1490 | [scip-shell system . . `[`. -d "$pkg_tmp_dir" -a -n "$(echoscip-shell system . . echo. $pkg_tmp_dir | grepscip-shell system . . grep. "-rpm-tmp" )" ] && rmscip-shell system . . rm. -rf $pkg_tmp_dir |
| 1491 | fi |
| 1492 | return $RETVAL |
| 1493 | } # end of get_inst_rpm |
| 1494 | # force to run apt-get install, this will force to install the necessary packages |
| 1495 | check_apt_integrityscip-shell shell shell-project 0.0.0 check_apt_integrity().() { |
| 1496 | apt-getscip-shell system . . apt-get. -f --yes install |
| 1497 | } |
| 1498 | |
| 1499 | # |
| 1500 | prepare_install_RH_MDK_client_kernelscip-shell shell shell-project 0.0.0 prepare_install_RH_MDK_client_kernel().() { |
| 1501 | local kgot |
| 1502 | local KEXTRA="" |
| 1503 | local avail_krpm |
| 1504 | LATEST_KTMP="$(mktempscip-shell system . . mktemp. /tmp/latest_ktmp.XXXXXXscip-shell filesystem . . `/tmp/latest_ktmp.XXXXXX`.)" |
| 1505 | |
| 1506 | # For Fedora Core 5 with x86_64 arch, all kernels have SMP support, even though the name will not contain smp. |
| 1507 | case "$OS_Version" in |
| 1508 | FC[12][0123456789]) |
| 1509 | # From Fedora Core 6, one kernel fits single processor and SMP (including |
| 1510 | # i386 and x86_64 distributions). |
| 1511 | SMP_OPTION="" |
| 1512 | ;; |
| 1513 | esac |
| 1514 | |
| 1515 | # set the OS and update dir |
| 1516 | eval RPMS_os_update_dir=\$${OS_type}_RPMS_os_update_dir |
| 1517 | |
| 1518 | # Set KARCH and KARCH_RPM, the reason we need to use these two different variable is that some kernel has "$KARCH_RPM" tag, but actually it's for $KARCH, especially in MDK10.[1-2]|MDV2005|MDV2006.0. |
| 1519 | case "$client_archi_set" in |
| 1520 | "best_optimization") |
| 1521 | # optimization, it could be i386/i586/i686/x86_64 |
| 1522 | KARCH="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 1523 | # if not found (maybe user make his own kernel, |
| 1524 | # but did NOT put config in /boot), set it as that in the server |
| 1525 | [scip-shell system . . `[`. -z "$KARCH" ] && KARCH=`unamescip-shell system . . uname. -m` |
| 1526 | KARCH_RPM=$KARCH |
| 1527 | ;; |
| 1528 | "i386") |
| 1529 | # for i386... this is not available for FC2/3, but we will force it |
| 1530 | # to be i586 before this... |
| 1531 | KARCH=i386 |
| 1532 | KARCH_RPM=$KARCH |
| 1533 | ;; |
| 1534 | *) |
| 1535 | # for i586 |
| 1536 | KARCH=i586 |
| 1537 | KARCH_RPM=$KARCH |
| 1538 | ;; |
| 1539 | esac |
| 1540 | |
| 1541 | # For Mandriva, before overwrite KARCH, we have to decide "KEXTRA" first. |
| 1542 | # Makdrake 10.1/10.2, MDV2005/2006.0 uses kernel-i586-up-1GB for 586 CPU, |
| 1543 | # The kernel rpm kernel-2.6.11.6mdk-1-1mdk.i586.rpm is only working with i686 CPU. |
| 1544 | # BUG REPORTED, but they do NOT care! |
| 1545 | # So I have to put a special case here. |
| 1546 | # http://qa.mandrakesoft.com/show_bug.cgi?id=14581 |
| 1547 | # http://qa.mandrakesoft.com/show_bug.cgi?id=15383 |
| 1548 | # SHIT! Why MDK 10.1/10.2/2006.0 kernel arch does NOT consistent with rpm name ? |
| 1549 | # |
| 1550 | # Mandriva 2008.0, new kernel name "kernel-desktop" (for i686) or "kernel-desktoip586" (for i586)... |
| 1551 | case "$OS_Version" in |
| 1552 | MDK10.[1-2]|MDV2005|MDV2006.0) |
| 1553 | case "$KARCH" in |
| 1554 | i[35]86) |
| 1555 | if [scip-shell system . . `[`. -z "$SMP_OPTION" ]; then |
| 1556 | KEXTRA="-i586-up-1GB" |
| 1557 | echoscip-shell system . . echo. "Since there is a bug in Mandrake 10.1, Mandriva 2005 and Mandriva 2006.0, we need to use the kernel rpm package "kernel${KEXTRA}" for i586 CPU client!" |
| 1558 | fi |
| 1559 | ;; |
| 1560 | esac |
| 1561 | ;; |
| 1562 | MDV200[89].*|MDV201[0].*) |
| 1563 | case "$KARCH" in |
| 1564 | i[35]86) |
| 1565 | if [scip-shell system . . `[`. -z "$SMP_OPTION" ]; then |
| 1566 | # The kernel package name is like: kernel-desktop586-2.6.22.9-1mdv-1-1mdv2008.0.i586.rpm |
| 1567 | KEXTRA="-desktop586" |
| 1568 | echoscip-shell system . . echo. "Since the kernel-.*-i586.rpm is actually for i686 CPU in Mandriva 2008 or later, we need to use the kernel rpm package "kernel${KEXTRA}" for i586 CPU client!" |
| 1569 | fi |
| 1570 | ;; |
| 1571 | i686) |
| 1572 | if [scip-shell system . . `[`. -z "$SMP_OPTION" ]; then |
| 1573 | # The kernel package name is like: kernel-desktop-2.6.22.9-1mdv-1-1mdv2008.0.i586.rpm |
| 1574 | KEXTRA="-desktop" |
| 1575 | fi |
| 1576 | ;; |
| 1577 | esac |
| 1578 | ;; |
| 1579 | FC*) |
| 1580 | # For Fedora 17, kernel package availables: |
| 1581 | # kernel-3.3.4-5.fc17.i686.rpm |
| 1582 | # kernel-PAE-3.3.4-5.fc17.i686.rpm |
| 1583 | # This is regular expression, we will put it in as parameters of "grep -E" |
| 1584 | KEXTRA="(|-PAE)" |
| 1585 | ;; |
| 1586 | esac |
| 1587 | |
| 1588 | # Mandriva i586 version is not consistent. We have to overwrite the above rules. |
| 1589 | # Ex: Makdrake 10.1/10.2 uses kernel-i586-up-1GB for 586 CPU, |
| 1590 | # The kernel rpm kernel-2.6.11.6mdk-1-1mdk.i586.rpm is only working |
| 1591 | # with i686 CPU. |
| 1592 | # STUPID!!! We have to force the rpm package tag (KARCH_RPM) as i586, |
| 1593 | # but actually it for i686 (KARCH). SHIT!!! |
| 1594 | case "$OS_Version" in |
| 1595 | MDK10.[1-2]|MDV*) |
| 1596 | if [scip-shell system . . `[`. "$ARCH" = "i586" ]; then |
| 1597 | KARCH=i686 |
| 1598 | KARCH_RPM=i586 |
| 1599 | fi |
| 1600 | ;; |
| 1601 | esac |
| 1602 | |
| 1603 | # get the client_archi, which is used to filter the rpm package name. |
| 1604 | case "$KARCH" in |
| 1605 | i[0-9]86) |
| 1606 | # skip the leading "i" |
| 1607 | client_archi=${KARCH_RPM:1} |
| 1608 | ;; |
| 1609 | *) |
| 1610 | # for x86_64 |
| 1611 | client_archi=${KARCH_RPM} |
| 1612 | ;; |
| 1613 | esac |
| 1614 | |
| 1615 | case "$OS_type" in |
| 1616 | MDK) |
| 1617 | # For MDK, since only 1 CPU kernel type, then it will be universal. We |
| 1618 | # use "cat -" to pipe, i.e. all work. |
| 1619 | cpu_filter="cat -" |
| 1620 | ;; |
| 1621 | *) |
| 1622 | cpu_filter="grep -i $client_archi" |
| 1623 | ;; |
| 1624 | esac |
| 1625 | |
| 1626 | # |
| 1627 | klist_no= |
| 1628 | i=1 |
| 1629 | for idir in $RPMS_os_update_dir; do |
| 1630 | kgot="$(list_available_rpm $url_os_coreroot/${idir}/ | grepscip-shell system . . grep. -E "^kernel${KEXTRA}${SMP_OPTION}-[2-9]\.[0-9]+\.[0-9]+" | grepscip-shell system . . grep. -v "test" | $cpu_filter | sortscip-shell system . . sort. -V -r | uniqscip-shell system . . uniq.)" |
| 1631 | # store the url to show error msg later if no kernel available. |
| 1632 | klist_ar[$i]="$url_os_coreroot/${idir}/" |
| 1633 | i=$((i+1)) |
| 1634 | # RPMS.os and RPMS.core might be symbolic link, so maybe the result will |
| 1635 | # duplicate. To avoid this, we filter it first. |
| 1636 | if [scip-shell system . . `[`. -n "$kgot" ]; then |
| 1637 | for ikgot in $kgot; do |
| 1638 | if ! grepscip-shell system . . grep. -q $ikgot $LATEST_KTMP; then |
| 1639 | # make a tag so that we know the kernel is from ? |
| 1640 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $idir | grepscip-shell system . . grep. -i updates)" ]; then |
| 1641 | ktag="(in updates repository)" |
| 1642 | else |
| 1643 | ktag="(in release repository)" |
| 1644 | fi |
| 1645 | klist_no=$(($klist_no + 1)) |
| 1646 | echoscip-shell system . . echo. "${klist_no}: $ikgot $ktag" >> $LATEST_KTMP |
| 1647 | fi |
| 1648 | done |
| 1649 | fi |
| 1650 | done |
| 1651 | |
| 1652 | if [scip-shell system . . `[`. -n "$SMP_OPTION" ]; then |
| 1653 | # enable SMP filter |
| 1654 | smp_filter="grep -i smp" |
| 1655 | else |
| 1656 | # "NOT SMP" filter |
| 1657 | smp_filter="grep -iv smp" |
| 1658 | fi |
| 1659 | |
| 1660 | # Another available kernel maybe is from server, check it: |
| 1661 | running_karch="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 1662 | running_kernel_in_server="$(echoscip-shell system . . echo. $(unamescip-shell system . . uname. -r) $running_karch | $cpu_filter | $smp_filter)" |
| 1663 | if [scip-shell system . . `[`. -n "$running_kernel_in_server" ]; then |
| 1664 | klist_no=$(($klist_no + 1)) |
| 1665 | echoscip-shell system . . echo. "${klist_no}: kernel_$running_kernel_in_server (from this DRBL server)" >> $LATEST_KTMP |
| 1666 | fi |
| 1667 | |
| 1668 | # If no kernel is found, show some method |
| 1669 | if [scip-shell system . . `[`. -z "$(catscip-shell system . . cat. $LATEST_KTMP 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 1670 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1671 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 1672 | echoscip-shell system . . echo. "$msg_no_kernel_rpm_is_available ${klist_ar[@]}" |
| 1673 | echoscip-shell system . . echo. "$msg_txt_check:" |
| 1674 | echoscip-shell system . . echo. "$msg_internet_connection" |
| 1675 | [scip-shell system . . `[`. "$installer" = "yum" ] && echoscip-shell system . . echo. "$msg_use_baseurl_in_yum_centos" |
| 1676 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1677 | echoscip-shell system . . echo. "$msg_program_stop" |
| 1678 | exit 1 |
| 1679 | fi |
| 1680 | |
| 1681 | # |
| 1682 | chosen_kernel_for_client="" |
| 1683 | while [scip-shell system . . `[`. -z "$chosen_kernel_for_client" ]; do |
| 1684 | # We use the release kernel as the default one, since FC3/4 the kernel changes too aggressive in updates. |
| 1685 | # Maybe there are more than 1 kernel image in the directory, like in MDK 10.1 |
| 1686 | # 1: kernel-2.4.28.0.rc1.6mdk-1-1mdk (in updates repository) |
| 1687 | # 2: kernel-2.6.8.1.25mdk-1-1mdk (in updates repository) |
| 1688 | # 3: kernel-2.4.27.0.pre2.1mdk-1-1mdk (in release repository) |
| 1689 | # 4: kernel-2.6.8.1.12mdk-1-1mdk (in release repository) |
| 1690 | latest_krn_in_release="$(awkscip-shell system . . awk. -F" " '/in release repository/ {print $2}scip-shell filesystem . . `/in release repository/ {print $2}`.' $LATEST_KTMP | pkg-ver-latest| headscip-shell system . . head. -n 1)" |
| 1691 | # Maybe we can not find the desired kernel in release. For example, in RH8.0/RH9/FC1, if we want to use i586 smp kernel, in FC1, there is no kernel-smp-2.4.22-1.2115.nptl.i586.rpm, only kernel-smp-2.4.22-1.2115.nptl.athlon.rpm, kernel-smp-2.4.22-1.2115.nptl.i686.rpm in http://opensource.nchc.org.tw/fedora/linux/core/1/i386/os/Fedora/RPMS/. However, i586 smp kernel exists in Rh8.0/RH9/FC1 updates dir. When this happens, we default to use the one in updates. |
| 1692 | if [scip-shell system . . `[`. -n "$latest_krn_in_release" ]; then |
| 1693 | default_release="$(awkscip-shell system . . awk. -F":" "/$latest_krn_in_release/ {print \$1}" $LATEST_KTMP)" |
| 1694 | default_release_ker_name="$(awkscip-shell system . . awk. -F":" "/$latest_krn_in_release/ {print \$2}" $LATEST_KTMP)" |
| 1695 | else |
| 1696 | # default to use the one in updates. |
| 1697 | latest_krn_in_updates="$(awkscip-shell system . . awk. -F" " '/in updates repository/ {print $2}scip-shell filesystem . . `/in updates repository/ {print $2}`.' $LATEST_KTMP | pkg-ver-latest| headscip-shell system . . head. -n 1)" |
| 1698 | default_release="$(awkscip-shell system . . awk. -F":" "/$latest_krn_in_updates/ {print \$1}" $LATEST_KTMP)" |
| 1699 | default_release_ker_name="$(awkscip-shell system . . awk. -F":" "/$latest_krn_in_updates/ {print \$2}" $LATEST_KTMP)" |
| 1700 | fi |
| 1701 | # If only 1 kernel available, just use that. |
| 1702 | if [scip-shell system . . `[`. "$(wcscip-shell system . . wc. -l $LATEST_KTMP | awkscip-shell system . . awk. -F" " '{print $1}')" -eq 1 ]; then |
| 1703 | echoscip-shell system . . echo. "$msg_only_one_kernel_meets_requirement: $default_release_ker_name, use it." |
| 1704 | chosen_ker="$default_release" |
| 1705 | else |
| 1706 | echoscip-shell system . . echo. "$msg_available_kernel:" |
| 1707 | catscip-shell system . . cat. $LATEST_KTMP |
| 1708 | echoscip-shell system . . echo. "$msg_which_kernel_do_you_perfer" |
| 1709 | echoscip-shell system . . echo. -n "[$default_release] " |
| 1710 | read chosen_ker |
| 1711 | [scip-shell system . . `[`. -z "$chosen_ker" ] && chosen_ker="$default_release" |
| 1712 | echoscip-shell system . . echo. "$msg_you_choose $chosen_ker." |
| 1713 | fi |
| 1714 | chosen_kernel_for_client="$(awkscip-shell system . . awk. -F" " "/^$chosen_ker:/ {print \$2}" $LATEST_KTMP)" |
| 1715 | chosen_kernel_for_client_from_server="$(grepscip-shell system . . grep. "^$chosen_ker:.*from.*server" $LATEST_KTMP)" |
| 1716 | if [scip-shell system . . `[`. -z "$chosen_kernel_for_client" ]; then |
| 1717 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 1718 | echoscip-shell system . . echo. "$msg_not_available_enter_again" |
| 1719 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1720 | fi |
| 1721 | done |
| 1722 | [scip-shell system . . `[`. -f "$LATEST_KTMP" ] && rmscip-shell system . . rm. -f $LATEST_KTMP |
| 1723 | # |
| 1724 | if [scip-shell system . . `[`. -n "$chosen_kernel_for_client_from_server" ]; then |
| 1725 | client_kernel_install_mode="from_server" |
| 1726 | else |
| 1727 | client_kernel_install_mode="from_downloaded_pkg" |
| 1728 | fi |
| 1729 | |
| 1730 | echoscip-shell system . . echo. "${msg_chosen_kernel}: $chosen_kernel_for_client" |
| 1731 | |
| 1732 | # Get kernel for client |
| 1733 | case "$client_kernel_install_mode" in |
| 1734 | from_server) |
| 1735 | client_kernel_ver=`unamescip-shell system . . uname. -r` |
| 1736 | ;; |
| 1737 | from_downloaded_pkg) |
| 1738 | # Use RPM to install kernel. |
| 1739 | # Try to find that in RPMS.core or RPMS.updates... |
| 1740 | |
| 1741 | avail_krpm="" |
| 1742 | echoscip-shell system . . echo. "Searching $KARCH kernel in repository... " |
| 1743 | for idir in $RPMS_os_update_dir; do |
| 1744 | avail_krpm="$(list_available_rpm $url_os_coreroot/${idir} | grepscip-shell system . . grep. "^$chosen_kernel_for_client" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 1745 | rc=1 |
| 1746 | if [scip-shell system . . `[`. -n "$avail_krpm" ]; then |
| 1747 | kgot_url_rpm="$url_os_coreroot/${idir}/${avail_krpm}" |
| 1748 | client_kernel_tmp_dir="$(mktempscip-shell system . . mktemp. -d /tmp/client_kernel_PKG.XXXXXXscip-shell filesystem . . `/tmp/client_kernel_PKG.XXXXXX`.)" |
| 1749 | echoscip-shell system . . echo. -n "Downloading $KARCH $chosen_kernel_for_client from $kgot_url_rpm to $client_kernel_tmp_dir/... " |
| 1750 | # just download it |
| 1751 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $kgot_url_rpm -t $client_kernel_tmp_dir |
| 1752 | rc=$? |
| 1753 | # FC 22 or later use kernel-core-`uname -r`*.rpm as real package , but kernel-`uname-r`*.rpm only be meta package |
| 1754 | if [scip-shell system . . `[`. -z "$(LC_ALL=C rpm -qpl $client_kernel_tmp_dir/${avail_krpm} 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. vmlinuz )" ] ; then |
| 1755 | kcore_rpm="$(LC_ALL=C rpm -qpR $client_kernel_tmp_dir/${avail_krpm} | grepscip-shell system . . grep. -E '^kernel[-PAE]*-core' | sedscip-shell system . . sed. -e 's/uname-r\ *=\ *//g' -e 's/+PAE$//g').rpm" |
| 1756 | kmodules_rpm="$(LC_ALL=C rpm -qpR $client_kernel_tmp_dir/${avail_krpm} | grepscip-shell system . . grep. -E '^kernel[-PAE]*-modules' | sedscip-shell system . . sed. -e 's/uname-r\ *=\ *//g' -e 's/+PAE$//g').rpm" |
| 1757 | kcoregot_url_rpm="$url_os_coreroot/${idir}/${kcore_rpm}" |
| 1758 | kmodulesgot_url_rpm="$url_os_coreroot/${idir}/${kmodules_rpm}" |
| 1759 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $kcoregot_url_rpm -t $client_kernel_tmp_dir |
| 1760 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $kmodulesgot_url_rpm -t $client_kernel_tmp_dir |
| 1761 | if [scip-shell system . . `[`. -n "$(LC_ALL=C rpm -qpl $client_kernel_tmp_dir/${kcore_rpm} 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. vmlinuz )" ] ; then |
| 1762 | chosen_kernel_for_client=${kcore_rpm} |
| 1763 | drblsrv_offline_extra_opt="$drblsrv_offline_extra_opt -e $client_kernel_tmp_dir/$kmodules_rpm" |
| 1764 | else |
| 1765 | rc=1 |
| 1766 | fi |
| 1767 | fi |
| 1768 | fi |
| 1769 | # once it's done, skip the next search |
| 1770 | if [scip-shell system . . `[`. "$rc" -eq 0 ]; then |
| 1771 | echoscip-shell system . . echo. "done!" |
| 1772 | break |
| 1773 | else |
| 1774 | [scip-shell system . . `[`. -n "$verbose" ] && echoscip-shell system . . echo. "$chosen_kernel_for_client is not found in $url_os_coreroot/${idir}." |
| 1775 | fi |
| 1776 | done |
| 1777 | |
| 1778 | if [scip-shell system . . `[`. "$rc" -ne 0 ]; then |
| 1779 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 1780 | echoscip-shell system . . echo. "$chosen_kernel_for_client is NOT found in the repository!" |
| 1781 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1782 | echoscip-shell system . . echo. "$msg_program_stop" |
| 1783 | exit 1 |
| 1784 | fi |
| 1785 | esac |
| 1786 | } # end of prepare_install_RH_MDK_client_kernel |
| 1787 | |
| 1788 | # |
| 1789 | ask_if_setup_proxyscip-shell shell shell-project 0.0.0 ask_if_setup_proxy().() { |
| 1790 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1791 | DOMAINNAME=`/bin/dnsdomainnamescip-shell filesystem . . `/bin/dnsdomainname`.` |
| 1792 | if [scip-shell system . . `[`. -n "$DOMAINNAME" ]; then |
| 1793 | DEFAULT_PROXY="proxy.$DOMAINNAME" |
| 1794 | fi |
| 1795 | |
| 1796 | if [scip-shell system . . `[`. -z "$set_proxy_answer" ]; then |
| 1797 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1798 | echoscip-shell system . . echo. "$msg_set_proxy" |
| 1799 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1800 | echoscip-shell system . . echo. -n "[y/N] " |
| 1801 | read set_proxy_answer |
| 1802 | fi |
| 1803 | |
| 1804 | case "$set_proxy_answer" in |
| 1805 | [yY]|[yY]) |
| 1806 | echoscip-shell system . . echo. "$msg_http_proxy_server" |
| 1807 | echoscip-shell system . . echo. -n "[$DEFAULT_PROXY] " |
| 1808 | read http_proxy_server_name |
| 1809 | echoscip-shell system . . echo. "$msg_http_proxy_port" |
| 1810 | echoscip-shell system . . echo. -n "[3128] " |
| 1811 | read http_proxy_server_port |
| 1812 | if [scip-shell system . . `[`. -z "$http_proxy_server_name" ]; then |
| 1813 | http_proxy_server_name="proxy.$DOMAINNAME" |
| 1814 | fi |
| 1815 | if [scip-shell system . . `[`. -z "$http_proxy_server_port" ]; then |
| 1816 | http_proxy_server_port="3128" |
| 1817 | fi |
| 1818 | |
| 1819 | # use the one use input for DEFAULT value. |
| 1820 | echoscip-shell system . . echo. "$msg_ftp_proxy_server" |
| 1821 | echoscip-shell system . . echo. -n "[$http_proxy_server_name] " |
| 1822 | read ftp_proxy_server_name |
| 1823 | echoscip-shell system . . echo. "$msg_ftp_proxy_port" |
| 1824 | echoscip-shell system . . echo. -n "[$http_proxy_server_port] " |
| 1825 | read ftp_proxy_server_port |
| 1826 | if [scip-shell system . . `[`. -z "$ftp_proxy_server_name" ]; then |
| 1827 | ftp_proxy_server_name="$http_proxy_server_name" |
| 1828 | fi |
| 1829 | if [scip-shell system . . `[`. -z "$ftp_proxy_server_port" ]; then |
| 1830 | ftp_proxy_server_port="$http_proxy_server_port" |
| 1831 | fi |
| 1832 | |
| 1833 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1834 | echoscip-shell system . . echo. "$msg_http_proxy_you_set: http://$http_proxy_server_name:$http_proxy_server_port" |
| 1835 | echoscip-shell system . . echo. "$msg_ftp_proxy_you_set: http://$ftp_proxy_server_name:$ftp_proxy_server_port" |
| 1836 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1837 | |
| 1838 | export http_proxy=http://$http_proxy_server_name:$http_proxy_server_port |
| 1839 | export ftp_proxy=ftp://$ftp_proxy_server_name:$ftp_proxy_server_port |
| 1840 | ;; |
| 1841 | *) |
| 1842 | esac |
| 1843 | } # end of ask_if_setup_proxy |
| 1844 | |
| 1845 | # |
| 1846 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options().() { |
| 1847 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1848 | if [scip-shell system . . `[`. -z "$drbl_unstable_answer" ]; then |
| 1849 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1850 | echoscip-shell system . . echo. "$msg_drbl_unstable_option" |
| 1851 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1852 | echoscip-shell system . . echo. -n "[y/N] " |
| 1853 | read drbl_unstable_answer |
| 1854 | fi |
| 1855 | |
| 1856 | # |
| 1857 | case "$drbl_unstable_answer" in |
| 1858 | y|Y|[yY][eE][sS]) truescip-shell system . . true. ;; |
| 1859 | *) |
| 1860 | if [scip-shell system . . `[`. -z "$drbl_test_answer" ]; then |
| 1861 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1862 | echoscip-shell system . . echo. "$msg_drbl_test_option" |
| 1863 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1864 | echoscip-shell system . . echo. -n "[y/N] " |
| 1865 | read drbl_test_answer |
| 1866 | fi |
| 1867 | ;; |
| 1868 | esac |
| 1869 | |
| 1870 | # [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1871 | # echo "$msg_drbl_extra_option" |
| 1872 | # [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1873 | # echo -n "[y/N] " |
| 1874 | # read drbl_extra_answer |
| 1875 | |
| 1876 | # parse it |
| 1877 | case "$drbl_test_answer" in |
| 1878 | [yY]|[yY][eE][Ss]) |
| 1879 | DRBL_TEST="drbl-testing" |
| 1880 | ;; |
| 1881 | *) |
| 1882 | DRBL_TEST="" |
| 1883 | esac |
| 1884 | case "$drbl_unstable_answer" in |
| 1885 | [yY]|[yY][eE][Ss]) |
| 1886 | DRBL_UNSTABLE="drbl-unstable" |
| 1887 | ;; |
| 1888 | *) |
| 1889 | DRBL_UNSTABLE="" |
| 1890 | esac |
| 1891 | |
| 1892 | if [scip-shell system . . `[`. -z "$DRBL_TEST" -a -z "$DRBL_UNSTABLE" ]; then |
| 1893 | DRBL_STABLE="drbl-stable" |
| 1894 | fi |
| 1895 | # case "$drbl_extra_answer" in |
| 1896 | # [yY]|[yY][eE][Ss]) |
| 1897 | # DRBL_EXTRA="drbl-extra" |
| 1898 | # ;; |
| 1899 | # *) |
| 1900 | # DRBL_EXTRA="" |
| 1901 | # esac |
| 1902 | |
| 1903 | } # end of ask_and_parse_rpm_ayo_repo_options |
| 1904 | |
| 1905 | ask_and_parse_client_extra_settingscip-shell shell shell-project 0.0.0 ask_and_parse_client_extra_setting().() { |
| 1906 | # netinstall options |
| 1907 | if [scip-shell system . . `[`. -z "$drbl_netinstall_answer" ]; then |
| 1908 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1909 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1910 | echoscip-shell system . . echo. "$msg_drbl_netinstall_option" |
| 1911 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1912 | echoscip-shell system . . echo. -n "[y/N] " |
| 1913 | read drbl_netinstall_answer |
| 1914 | fi |
| 1915 | |
| 1916 | # |
| 1917 | case "$OS_Version" in |
| 1918 | # Since 2006/09, most new distribution with kernel >=2.6.17 only supports single kernel package, which auto-detect CPU. Hence we won't ask this question in those newer distribution. Only old distribution: |
| 1919 | RH*|FC[1-5]|CO4*|MDK*|MDV2005|MDV2006.0|SUSE9.3|SUSE10.[0-1]|DBN3.[0-1]) |
| 1920 | # SMP clients ? |
| 1921 | if [scip-shell system . . `[`. -z "$drbl_SMP_answer" ]; then |
| 1922 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1923 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1924 | echoscip-shell system . . echo. "$msg_smp_clients_RH" |
| 1925 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1926 | echoscip-shell system . . echo. -n "[y/N] " |
| 1927 | read drbl_SMP_answer |
| 1928 | fi |
| 1929 | ;; |
| 1930 | *) |
| 1931 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1932 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1933 | echoscip-shell system . . echo. "This GNU/Linux distribution uses one kernel to support SMP and non-SMP arch." |
| 1934 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1935 | ;; |
| 1936 | esac |
| 1937 | |
| 1938 | # forget about this... we did NOT compile some module for a long time. |
| 1939 | #[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1940 | #echo "$msg_drbl_driver" |
| 1941 | #[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1942 | #echo -n "[Y/n] " |
| 1943 | #read driver_answer |
| 1944 | |
| 1945 | # console output |
| 1946 | if [scip-shell system . . `[`. -z "$console_output_answer" ]; then |
| 1947 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 1948 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 1949 | echoscip-shell system . . echo. "$msg_serial_console_option" |
| 1950 | echoscip-shell system . . echo. "$msg_know_nothing_serial_console" |
| 1951 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 1952 | echoscip-shell system . . echo. -n "[y/N] " |
| 1953 | read console_output_answer |
| 1954 | fi |
| 1955 | |
| 1956 | case "$console_output_answer" in |
| 1957 | [yY]|[yY]) |
| 1958 | echoscip-shell system . . echo. "$msg_serial_console_only" |
| 1959 | echoscip-shell system . . echo. -n "[y/N] " |
| 1960 | read serial_console_only |
| 1961 | echoscip-shell system . . echo. "$msg_redirect_to_which_port" |
| 1962 | echoscip-shell system . . echo. "$msg_text_Enter \"1\" for COM1, \"2\" for COM2, \"3\" for COM3, \"4\" for COM4," |
| 1963 | echoscip-shell system . . echo. -n "[1] " |
| 1964 | read console_port |
| 1965 | echoscip-shell system . . echo. "$msg_serial_console_speed" |
| 1966 | echoscip-shell system . . echo. "$msg_text_Enter \"1\" for 9600, \"2\" for 19200, \"3\" for 38400." |
| 1967 | echoscip-shell system . . echo. -n "[3] " |
| 1968 | read console_port_speed |
| 1969 | ;; |
| 1970 | *) |
| 1971 | esac |
| 1972 | |
| 1973 | # parse it |
| 1974 | case "$console_output_answer" in |
| 1975 | [yY]|[yY][eE][Ss]) |
| 1976 | case "$console_port" in |
| 1977 | 2) |
| 1978 | PXE_CONSOLE_PORT="1" |
| 1979 | CONSOLE_PORT="ttyS1" |
| 1980 | ;; |
| 1981 | 3) |
| 1982 | PXE_CONSOLE_PORT="2" |
| 1983 | CONSOLE_PORT="ttyS2" |
| 1984 | ;; |
| 1985 | 4) |
| 1986 | PXE_CONSOLE_PORT="3" |
| 1987 | CONSOLE_PORT="ttyS3" |
| 1988 | ;; |
| 1989 | *) |
| 1990 | PXE_CONSOLE_PORT="0" |
| 1991 | CONSOLE_PORT="ttyS0" |
| 1992 | esac |
| 1993 | case "$console_port_speed" in |
| 1994 | 1) |
| 1995 | CONSOLE_PORT_SPEED="9600" |
| 1996 | ;; |
| 1997 | 2) |
| 1998 | CONSOLE_PORT_SPEED="19200" |
| 1999 | ;; |
| 2000 | *) |
| 2001 | CONSOLE_PORT_SPEED="38400" |
| 2002 | esac |
| 2003 | case "$serial_console_only" in |
| 2004 | [yY]|[yY][eE][Ss]) |
| 2005 | # note! The latter console will dominate the whole boot message |
| 2006 | CONSOLE_OUTPUT="console=tty0 console=$CONSOLE_PORT,"$CONSOLE_PORT_SPEED"n81" |
| 2007 | ;; |
| 2008 | *) |
| 2009 | CONSOLE_OUTPUT="console=$CONSOLE_PORT,"$CONSOLE_PORT_SPEED"n81 console=tty0 " |
| 2010 | esac |
| 2011 | PXE_SERIAL_OUTPUT="serial $PXE_CONSOLE_PORT $CONSOLE_PORT_SPEED" |
| 2012 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2013 | echoscip-shell system . . echo. "$msg_serial_console_parameter: $CONSOLE_OUTPUT" |
| 2014 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2015 | ;; |
| 2016 | *) |
| 2017 | CONSOLE_OUTPUT="" |
| 2018 | PXE_SERIAL_OUTPUT="" |
| 2019 | esac |
| 2020 | case "$drbl_SMP_answer" in |
| 2021 | [yY]|[yY][eE][Ss]) |
| 2022 | SMP_OPTION="-smp" |
| 2023 | ;; |
| 2024 | *) |
| 2025 | SMP_OPTION="" |
| 2026 | esac |
| 2027 | |
| 2028 | # netinstall |
| 2029 | case "$drbl_netinstall_answer" in |
| 2030 | [yY]|[yY][eE][Ss]) |
| 2031 | DRBL_NETINSTALL="yes" |
| 2032 | ;; |
| 2033 | *) |
| 2034 | DRBL_NETINSTALL="no" |
| 2035 | esac |
| 2036 | |
| 2037 | } # end of ask_and_parse_client_extra_setting |
| 2038 | |
| 2039 | # |
| 2040 | backup_apt_sources_listscip-shell shell shell-project 0.0.0 backup_apt_sources_list().() { |
| 2041 | if [scip-shell system . . `[`. -f /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. ]; then |
| 2042 | echoscip-shell system . . echo. "$msg_backup_apt_sources" |
| 2043 | mvscip-shell system . . mv. -v /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. /etc/apt/sources.list.origscip-shell filesystem . . `/etc/apt/sources.list.orig`. |
| 2044 | fi |
| 2045 | } |
| 2046 | |
| 2047 | # |
| 2048 | clean_tftpboot_and_miscscip-shell shell shell-project 0.0.0 clean_tftpboot_and_misc().() { |
| 2049 | local bind_dirs |
| 2050 | # Unmount those "--bind" dir under /tftpboot/ |
| 2051 | # The results of "mount" command is like: |
| 2052 | # /usr on /tftpboot/node_root/usr type none (rw,bind) |
| 2053 | bind_dirs="$(LC_ALL=C mountscip-shell system . . mount. | awkscip-shell system . . awk. -F" " '{print $3}' | grepscip-shell system . . grep. -Ew "/tftpbootscip-shell filesystem . . `/tftpboot`.")" |
| 2054 | bind_dirs="$(echoscip-shell system . . echo. $bind_dirs)" # make it in a line |
| 2055 | for i in $bind_dirs; do |
| 2056 | echoscip-shell system . . echo. "Unmounting binding dir $i..." |
| 2057 | umountscip-shell system . . umount. $i |
| 2058 | done |
| 2059 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2060 | echoscip-shell system . . echo. "$msg_cleaning_tftpboot_and_misc" |
| 2061 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2062 | # clean the nodes link, like 192.168.1.1... |
| 2063 | findscip-shell system . . find. /tftpboot/scip-shell filesystem . . `/tftpboot/`. -maxdepth 1 -type l -exec rm -f {} \; |
| 2064 | # we won't to affect those netinstall, maybe they are not removed previuosly. . |
| 2065 | findscip-shell system . . find. /tftpboot/nbi_img/scip-shell filesystem . . `/tftpboot/nbi_img/`. ! -name "*netinstall*" ! -type d -exec rm -f {} \; |
| 2066 | [scip-shell system . . `[`. -d "/tftpboot/nodes/scip-shell filesystem . . `/tftpboot/nodes/`." ] && rmscip-shell system . . rm. -rf /tftpboot/nodesscip-shell filesystem . . `/tftpboot/nodes`. |
| 2067 | [scip-shell system . . `[`. -d "/tftpboot/node_root/scip-shell filesystem . . `/tftpboot/node_root/`." ] && rmscip-shell system . . rm. -rf /tftpboot/node_rootscip-shell filesystem . . `/tftpboot/node_root`. |
| 2068 | [scip-shell system . . `[`. -d "$drbl_syscfg" -a "$drbl_remove_answer" = "y" ] && rmscip-shell system . . rm. -rf $drbl_syscfg |
| 2069 | [scip-shell system . . `[`. -f "$ocs_lock_dir/clonezilla.lock" ] && rmscip-shell system . . rm. -f $ocs_lock_dir/clonezilla.lock |
| 2070 | # For old version, we have to remove the old tag, now we use $ocs_lock_dir/clonezilla.lock instead of $ocsroot/clonezilla.lock |
| 2071 | [scip-shell system . . `[`. -f "$ocsroot/clonezilla.lock" ] && rmscip-shell system . . rm. -f $ocsroot/clonezilla.lock |
| 2072 | [scip-shell system . . `[`. -f /etc/yp.confscip-shell filesystem . . `/etc/yp.conf`. ] && mvscip-shell system . . mv. -v /etc/yp.confscip-shell filesystem . . `/etc/yp.conf`. /etc/yp.conf.drblsavescip-shell filesystem . . `/etc/yp.conf.drblsave`. |
| 2073 | [scip-shell system . . `[`. -f /etc/ypserv.confscip-shell filesystem . . `/etc/ypserv.conf`. ] && mvscip-shell system . . mv. -v /etc/ypserv.confscip-shell filesystem . . `/etc/ypserv.conf`. /etc/ypserv.conf.drblsavescip-shell filesystem . . `/etc/ypserv.conf.drblsave`. |
| 2074 | [scip-shell system . . `[`. -f /var/yp/securenetsscip-shell filesystem . . `/var/yp/securenets`. ] && mvscip-shell system . . mv. -v /var/yp/securenetsscip-shell filesystem . . `/var/yp/securenets`. /var/yp/securenets.drblsavescip-shell filesystem . . `/var/yp/securenets.drblsave`. |
| 2075 | [scip-shell system . . `[`. -f $drbl_pkgdir/dev.tgz ] && rmscip-shell system . . rm. -f $drbl_pkgdir/dev.tgz |
| 2076 | } # end of clean_tftpboot_and_misc() |
| 2077 | |
| 2078 | append_RH_apt_sources_list_examplescip-shell shell shell-project 0.0.0 append_RH_apt_sources_list_example().() { |
| 2079 | catscip-shell system . . cat. <<-APT_END >> /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. |
| 2080 | # Examples: |
| 2081 | # DRBL for RH9 in drbl.sourceforge.net, only DRBL packages, no RH9 packages |
| 2082 | #rpm http://drbl.sourceforge.net/redhat/apt redhat/9/i386 drbl drbl-testing |
| 2083 | #rpm-src http://drbl.sourceforge.net/redhat/apt redhat/9/i386 drbl drbl-testing |
| 2084 | |
| 2085 | # DRBL for FC1 in drbl.sourceforge.net, only DRBL packages, no FC1 packages |
| 2086 | #rpm http://drbl.sourceforge.net/fedora/apt/ fedora/linux/1/i386 drbl drbl-testing |
| 2087 | #rpm-src http://drbl.sourceforge.net//fedora/apt/ fedora/linux/1/i386 drbl drbl-testing |
| 2088 | |
| 2089 | # DRBL for RH9 in free.nchc.org.tw, including DRBL packages and RH9 pacakges |
| 2090 | #rpm http://free.nchc.org.tw//redhat/apt/ redhat/9/i386 os updates drbl |
| 2091 | #rpm-src http://free.nchc.org.tw//redhat/apt/ redhat/9/i386 os updates drbl |
| 2092 | |
| 2093 | # DRBL for FC1 in linux.nchc.org.tw, including DRBL packages and FC1 pacakges |
| 2094 | #rpm http://free.nchc.org.tw//fedora/apt/ fedora/linux/1/i386 core updates drbl |
| 2095 | #rpm-src http://free.nchc.org.tw//fedora/apt/ fedora/linux/1/i386 core updates drbl |
| 2096 | |
| 2097 | ### Dag Apt Repository for Red Hat Fedora Core |
| 2098 | #rpm http://apt.sw.be fedora/3/en/i386 dag |
| 2099 | #rpm http://apt.sw.be fedora/2/en/i386 dag |
| 2100 | #rpm http://apt.sw.be fedora/1/en/i386 dag |
| 2101 | |
| 2102 | ### Dag Apt Repository for Red Hat 9 (rh90) |
| 2103 | #rpm http://apt.sw.be redhat/9/en/i386 dag |
| 2104 | |
| 2105 | ### Dag Apt Repository for Red Hat 8.0 (rh80) |
| 2106 | #rpm http://apt.sw.be redhat/8.0/en/i386 dag |
| 2107 | |
| 2108 | ### Fedora Legacy Respository |
| 2109 | # Red Hat Linux 8.0: |
| 2110 | # rpm http://download.fedoralegacy.org/apt redhat/8.0/i386 os updates legacy-utils |
| 2111 | # Red Hat Linux 9: |
| 2112 | # rpm http://download.fedoralegacy.org/apt redhat/9/i386 os updates legacy-utils |
| 2113 | # Fedora Core 1: |
| 2114 | # rpm http://download.fedoralegacy.org/apt fedora/1/i386 os updates legacy-utils |
| 2115 | # Fedora Core 2: |
| 2116 | # rpm http://download.fedoralegacy.org/apt fedora/2/i386 os updates legacy-utils |
| 2117 | APT_END |
| 2118 | |
| 2119 | } # end of append_RH_apt_sources_list_example |
| 2120 | |
| 2121 | parse_os_to_set_repositoryscip-shell shell shell-project 0.0.0 parse_os_to_set_repository().() { |
| 2122 | # If the OS_Version is not supported, exit |
| 2123 | if [scip-shell system . . `[`. -z "$OS_Version" ]; then |
| 2124 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 2125 | echoscip-shell system . . echo. "$msg_not_determine_OS" |
| 2126 | echoscip-shell system . . echo. "$msg_is_not_supported" |
| 2127 | echoscip-shell system . . echo. "$msg_try_drblsrv_offline" |
| 2128 | echoscip-shell system . . echo. -n "$msg_press_ctrl_c_stop! " |
| 2129 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2130 | read |
| 2131 | exit 1 |
| 2132 | fi |
| 2133 | |
| 2134 | case "$OS_Version" in |
| 2135 | "RH8.0"|"RH9") |
| 2136 | # set the official release number... 8.0, 9... |
| 2137 | RH_VER=${OS_Version:2} |
| 2138 | #DIST="redhat" |
| 2139 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2140 | # core_dir is for the core program, for RH8 and 9, RPMS.os, set it as "os" |
| 2141 | core_dir="os" |
| 2142 | # RH_RPMS_os_update_dir indicates in apt repository, |
| 2143 | # where OS and updates pakcage (rpms) exist, |
| 2144 | # We will use it to search glibc & openssl only, not |
| 2145 | # for apt repository (not for /etc/apt/sources.list) |
| 2146 | # freshrpms: |
| 2147 | #http://ayo.freshrpms.net/redhat/9/i386/updates/RPMS/ |
| 2148 | #http://ayo.freshrpms.net/redhat/9/i386/os/RPMS |
| 2149 | # opensource (normal) |
| 2150 | #http://free.nchc.org.tw/redhat/linux/9/en/os/i386/RedHat/RPMS/ |
| 2151 | #http://free.nchc.org.tw/redhat/linux/updates/9/en/os/i386 |
| 2152 | #http://free.nchc.org.tw/redhat/linux/updates/9/en/os/i586 |
| 2153 | #http://free.nchc.org.tw/redhat/linux/updates/9/en/os/i686 |
| 2154 | RH_RPMS_os_update_dir="updates/$RH_VER/en/os/i386 updates/$RH_VER/en/os/i586 updates/$RH_VER/en/os/i686 updates/$RH_VER/en/os/noarch $RH_VER/en/os/i386/RedHat/RPMS $RH_VER/i386/updates/RPMS $RH_VER/i386/os/RPMS" |
| 2155 | ;; |
| 2156 | FC*) |
| 2157 | FC_VER=${OS_Version:2} |
| 2158 | #DIST="fedora" |
| 2159 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2160 | # core_dir is for the core program, for FC1, RPMS.core, set it as "core". Note! variable core_dir is only used for apt repository |
| 2161 | core_dir="core" |
| 2162 | # RH_RPMS_os_update_dir indicates in apt repository, |
| 2163 | # where OS and updates pakcage (rpms) exist, |
| 2164 | # We will use it to search glibc & openssl only, not |
| 2165 | # for apt repository (not for /etc/apt/sources.list) |
| 2166 | # freshrpms: |
| 2167 | # http://ayo.freshrpms.net/fedora/linux/3/i386/updates/RPMS/ |
| 2168 | # http://ayo.freshrpms.net/fedora/linux/3/i386/core/RPMS/ |
| 2169 | # |
| 2170 | # http://opensource.nchc.org.tw/fedora/linux/core/6/i386/ |
| 2171 | # http://opensource.nchc.org.tw/fedora/linux/core/updates/6/i386/ |
| 2172 | # Ex: for FC6, url_os_coreroot=http://opensource.nchc.org.tw/fedora/linux/core |
| 2173 | # From Fedora 7, the path is changed. |
| 2174 | # http://opensource.nchc.org.tw/fedora/linux/releases/7/Fedora/i386/os/ |
| 2175 | # http://opensource.nchc.org.tw/fedora/linux/updates/7/i386 |
| 2176 | # Ex: for FC7, url_os_coreroot=http://opensource.nchc.org.tw/fedora/linux/releases/ |
| 2177 | # in fedora.repo, it's used as: |
| 2178 | # baseurl=$url_os_coreroot/\$releasever/\$basearch/os |
| 2179 | |
| 2180 | # From Fedora 8, the path is changed. (The last dir name 'Fedora' -> 'Packages') |
| 2181 | # http://opensource.nchc.org.tw/fedora/linux/releases/8/Fedora/i386/os/Packages/ |
| 2182 | # http://opensource.nchc.org.tw/fedora/linux/releases/8/Everything/i386/os/Packages/ |
| 2183 | # http://opensource.nchc.org.tw/fedora/linux/updates/8/i386/ |
| 2184 | RH_RPMS_os_update_dir="../updates/$FC_VER/$ARCH/k/ ../updates/$FC_VER/$ARCH/ $FC_VER/Fedora/$ARCH/os/Packages/k/ $FC_VER/Fedora/$ARCH/os/Packages/ $FC_VER/Fedora/$ARCH/os/Fedora/ $FC_VER/Everything/$ARCH/os/Packages/ $FC_VER/Everything/$ARCH/os/Fedora/ updates/$FC_VER/$ARCH/ $FC_VER/$ARCH/os/Fedora/RPMS/ $FC_VER/$ARCH/updates/RPMS/ $FC_VER/$ARCH/os/RPMS/" |
| 2185 | ;; |
| 2186 | CO*) |
| 2187 | CO_VER=${OS_Version:2} |
| 2188 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2189 | # RH_RPMS_os_update_dir indicates in apt repository, |
| 2190 | # where OS and updates pakcage (rpms) exist, |
| 2191 | # We will use it to search kernel, glibc & openssl only, not |
| 2192 | # for apt repository (not for /etc/apt/sources.list) |
| 2193 | # 2007/05/06. For CentOS 5, it's centos/5/os/i386/CentOS/, no RPMS in the end. |
| 2194 | # 2011/08/22, For CentOS 6, it's centos/6/os/i386/Packages/ |
| 2195 | # 2012/01/30, For CentOS 6, the updates is in centos/6/updates/i386/Packages |
| 2196 | RH_RPMS_os_update_dir="$CO_VER/updates/$ARCH/Packages/ $CO_VER/os/$ARCH/Packages/ $CO_VER/updates/$ARCH/RPMS/ $CO_VER/os/$ARCH/CentOS/ $CO_VER/os/$ARCH/CentOS/RPMS/" |
| 2197 | ;; |
| 2198 | MDK9.2|MDK10.0) |
| 2199 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2200 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2201 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2202 | #http://free.nchc.org.tw/mandrake/apt/ mandrake/linux/9.2/i586 core updates drbl drbl-testing drbl-unstable |
| 2203 | |
| 2204 | # sources.list |
| 2205 | # rpm $url_os/official/$MDK_VER_PATH/i586/Mandrake/ base/hdlist RPMS |
| 2206 | # Mandrake updates |
| 2207 | # rpm $url_os/official/updates/$MDK_VER_PATH/ base/hdlist RPMS |
| 2208 | MDK_VER_PATH=${OS_Version:3} |
| 2209 | # The media_info directory in the same directory level with RPMS |
| 2210 | update_rpmdir_info="RPMS" |
| 2211 | # SHIT!!! why Mandrake use differnet name for 2005 (LE2005) in updates ? |
| 2212 | # To make it more clear, we add an empty variable update_extra_code_name |
| 2213 | update_extra_code_name="" |
| 2214 | # MDK_RPMS_os_update_dir indicates in rpm repository, |
| 2215 | # where OS and update rpms exists |
| 2216 | # We will use MDK_RPMS_os_update_dir for search glibc & openssl only, not |
| 2217 | # for apt repository (not for /etc/apt/sources.list) |
| 2218 | MDK_RPMS_os_update_dir="updates/$MDK_VER_PATH/RPMS $MDK_VER_PATH/i586/Mandrake/RPMS" |
| 2219 | ;; |
| 2220 | MDK10.[1-2]|MDV2005|MDV2006.0) |
| 2221 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2222 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2223 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2224 | # main |
| 2225 | # http://free.nchc.org.tw//mandrake/official/10.1/i586/media media_info/hdlist main |
| 2226 | # updates |
| 2227 | # rpm http://free.nchc.org.tw//mandrake/official/updates/10.1/ main_updates/media_info/hdlist main_updates |
| 2228 | # "MDV2006.0" -> "2006.0" |
| 2229 | MDK_VER_PATH=${OS_Version:3} |
| 2230 | # This update_rpmdir_info is for urpmi.addmedia: urpmi.addmedia MDK${MDK_VER_PATH}-updates $url_os/$os_ayo_path/updates/${update_extra_code_name}$MDK_VER_PATH/$update_rpmdir_info |
| 2231 | update_rpmdir_info="main_updates" |
| 2232 | |
| 2233 | # SHIT!!! why Mandrake use differnet name for 2005 (LE2005) in updates ? |
| 2234 | if [scip-shell system . . `[`. "$OS_Version" = "MDV2005" ];then |
| 2235 | update_extra_code_name="LE" |
| 2236 | else |
| 2237 | update_extra_code_name="" |
| 2238 | fi |
| 2239 | # MDK_RPMS_os_update_dir indicates in rpm repository, |
| 2240 | # where OS and update rpms exists |
| 2241 | # We will use MDK_RPMS_os_update_dir to search kernel, not for urpmi |
| 2242 | MDK_RPMS_os_update_dir="updates/$MDK_VER_PATH/main_updates $MDK_VER_PATH/$ARCH/media/main" |
| 2243 | ;; |
| 2244 | MDV*) |
| 2245 | # From MDV2007.0 |
| 2246 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2247 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version" |
| 2248 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2249 | # ftp://mdk.linux.org.tw//pub/mandrake-linux/official/2007.0/i586/media/main |
| 2250 | # updates |
| 2251 | # ftp://mdk.linux.org.tw//pub/mandrake-linux/official/updates/2007.0/i586/media |
| 2252 | # "MDV2007.0" -> "2007.0" |
| 2253 | MDK_VER_PATH=${OS_Version:3} |
| 2254 | # This update_rpmdir_info is for urpmi.addmedia: urpmi.addmedia MDK${MDK_VER_PATH}-updates $url_os/$os_ayo_path/updates/${update_extra_code_name}$MDK_VER_PATH/$update_rpmdir_info |
| 2255 | # For 2007.0, ftp://mdk.linux.org.tw//pub/mandrake-linux/official/updates/2007.0/i586/media/main/updates/media_info |
| 2256 | update_rpmdir_info="/$ARCH/media/main/updates" |
| 2257 | |
| 2258 | # MDK_RPMS_os_update_dir indicates in rpm repository, |
| 2259 | # where OS and update rpms exists |
| 2260 | # We will use MDK_RPMS_os_update_dir to search kernel, not for urpmi |
| 2261 | # Note by Steven Shiau on 2006/09/26 |
| 2262 | # For MDV2007.0, in 2007.0/i586/media/main, there are still 3 dirs: |
| 2263 | # release, testing, updates |
| 2264 | # Hence we have to include them. |
| 2265 | MDK_RPMS_os_update_dir="updates/$MDK_VER_PATH/$ARCH/media/main/updates $MDK_VER_PATH/$ARCH/media/main/release $MDK_VER_PATH/$ARCH/media/main/updates" |
| 2266 | ;; |
| 2267 | *) |
| 2268 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 2269 | echoscip-shell system . . echo. "$msg_is_not_supported: $OS_Version" |
| 2270 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2271 | echoscip-shell system . . echo. "$msg_try_drblsrv_offline" |
| 2272 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2273 | echoscip-shell system . . echo. -n "$msg_press_ctrl_c_stop! " |
| 2274 | read |
| 2275 | exit 1 |
| 2276 | esac |
| 2277 | |
| 2278 | # |
| 2279 | ask_if_setup_proxyscip-shell shell shell-project 0.0.0 ask_if_setup_proxy(). |
| 2280 | |
| 2281 | } # parse_os_to_set_repository |
| 2282 | # |
| 2283 | preset_client_archi_ansscip-shell shell shell-project 0.0.0 preset_client_archi_ans().() { |
| 2284 | # The function to preset client_archi_ans for some specific arch or distribution release. |
| 2285 | # The return value is client_archi_ans or client_archi_ans_def |
| 2286 | # Apply the client_archi_ans for x86_64 and SMP |
| 2287 | # x86_64 added, we will use best_optimization for x86_64. |
| 2288 | if [scip-shell system . . `[`. "$ARCH" = "x86_64" -o "$ARCH" = "amd64" ]; then |
| 2289 | client_archi_ans=2 |
| 2290 | return 0 |
| 2291 | fi |
| 2292 | |
| 2293 | # if SMP for client -> best_optimization. |
| 2294 | # Not SMP -> ask user. |
| 2295 | case "$drbl_SMP_answer" in |
| 2296 | [yY]|[yY][eE][Ss]) |
| 2297 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2298 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2299 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2300 | echoscip-shell system . . echo. "$msg_smp_optimization_kernel" |
| 2301 | client_archi_ans="2" |
| 2302 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 2303 | read |
| 2304 | return 0 |
| 2305 | ;; |
| 2306 | esac |
| 2307 | |
| 2308 | # Ugly! For CentOS 5.0, when it's initial release, only i686 kernel supported! For more info, check this: http://wiki.centos.org/QaWiki/CentOS5PentiumSupport |
| 2309 | # This will be removed when CentOS 5 officially supports i586 CPU. |
| 2310 | case "$OS_Version" in |
| 2311 | CO5*|CO6*) |
| 2312 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2313 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2314 | echoscip-shell system . . echo. "$msg_only_i686_kernel_available_in_centos_5" |
| 2315 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2316 | client_archi_ans="2" |
| 2317 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 2318 | read |
| 2319 | return 0 |
| 2320 | ;; |
| 2321 | FC*) |
| 2322 | client_archi_ans="2" |
| 2323 | return 0 |
| 2324 | ;; |
| 2325 | esac |
| 2326 | |
| 2327 | [scip-shell system . . `[`. -e /etc/lsb-releasescip-shell filesystem . . `/etc/lsb-release`. ] && . /etc/lsb-releasescip-shell source . . `/etc/lsb-release`. |
| 2328 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "Ubuntu" ]; then |
| 2329 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2330 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2331 | echoscip-shell system . . echo. "This server is running Ubuntu Linux, so generic kernel is available." |
| 2332 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2333 | case "$DISTRIB_RELEASE" in |
| 2334 | # Ubuntu 5.04 to 10.04 |
| 2335 | [5-9].[01][460]|10.04) client_archi_ans_def="2" ;; |
| 2336 | *) |
| 2337 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2338 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2339 | echoscip-shell system . . echo. "$msg_only_kernel_same_with_srv_available" |
| 2340 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2341 | client_archi_ans="2" |
| 2342 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 2343 | read |
| 2344 | ;; |
| 2345 | esac |
| 2346 | return 0 |
| 2347 | fi |
| 2348 | } # end of preset_client_archi_ans |
| 2349 | |
| 2350 | # |
| 2351 | parse_client_archi_settingscip-shell shell shell-project 0.0.0 parse_client_archi_setting().() { |
| 2352 | # |
| 2353 | preset_client_archi_ansscip-shell shell shell-project 0.0.0 preset_client_archi_ans(). |
| 2354 | |
| 2355 | # if $client_archi_ans is not set (i.e. NOT x86_64, NOT SMP), ask user. |
| 2356 | [scip-shell system . . `[`. -z "$client_archi_ans_def" ] && client_archi_ans_def="2" |
| 2357 | if [scip-shell system . . `[`. -z "$client_archi_ans" ]; then |
| 2358 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2359 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2360 | echoscip-shell system . . echo. "$msg_apt_optimization_question" |
| 2361 | echoscip-shell system . . echo. "$msg_optimization_level_0" |
| 2362 | echoscip-shell system . . echo. "$msg_optimization_level_1" |
| 2363 | echoscip-shell system . . echo. "$msg_optimization_level_2" |
| 2364 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 2365 | echoscip-shell system . . echo. "$msg_N_note" |
| 2366 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2367 | echoscip-shell system . . echo. "$msg_note!!! $msg_different_level_machine_prompt" |
| 2368 | echoscip-shell system . . echo. "$msg_diff_arch_explain" |
| 2369 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2370 | echoscip-shell system . . echo. "$msg_not_sure_better_1" |
| 2371 | echoscip-shell system . . echo. -n "[$client_archi_ans_def] " |
| 2372 | read client_archi_ans |
| 2373 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2374 | fi |
| 2375 | [scip-shell system . . `[`. -z "$client_archi_ans" ] && client_archi_ans="$client_archi_ans_def" |
| 2376 | case "$client_archi_ans" in |
| 2377 | [0-9]) |
| 2378 | echoscip-shell system . . echo. "The CPU arch option for your clients: $client_archi_ans" |
| 2379 | ;; |
| 2380 | *) |
| 2381 | client_archi_ans=1 |
| 2382 | ;; |
| 2383 | esac |
| 2384 | |
| 2385 | # check if the answer fits to the distribution |
| 2386 | # This is based on the kernel rpm: kernel-.*.i[356]86.rpm |
| 2387 | # client_archi_ans: (1) i386 (2) i586 (3) optimization |
| 2388 | # for RH8/9, FC1 -> i386, i586, i686 are available |
| 2389 | # for FC2/3 -> i586, i686 are available, i386 is not available |
| 2390 | # for CO4/4.1/4.2 -> i586, i686 are available, i386 is not available |
| 2391 | # for MDK -> i586 and i686 (a bug) are available, i386 is not available. |
| 2392 | # for SUSE -> i586, i686 are available, i386 is not available |
| 2393 | # for Debian woody/sarge/breezy -> i386, i686 are available, i586 is not available |
| 2394 | # for Debian etch/dapper -> i486, i686 are available, i386 is not available |
| 2395 | if [scip-shell system . . `[`. "$client_archi_ans" = "0" ]; then |
| 2396 | case "$OS_Version" in |
| 2397 | FC[2-9]|FC1[01]|MD[KV]*|SUSE*|CO*) |
| 2398 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2399 | echoscip-shell system . . echo. "$msg_change_opt_from_i386_to_i586" |
| 2400 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2401 | client_archi_ans="1" |
| 2402 | ;; |
| 2403 | esac |
| 2404 | fi |
| 2405 | |
| 2406 | # for Debian woody/sarge/breezy-> i386 and i686 are available, i586 is not available. |
| 2407 | if [scip-shell system . . `[`. "$client_archi_ans" = "1" ]; then |
| 2408 | case "$OS_Version" in |
| 2409 | DBN*) |
| 2410 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2411 | echoscip-shell system . . echo. "$msg_change_opt_from_i586_to_i386" |
| 2412 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2413 | client_archi_ans="0" |
| 2414 | ;; |
| 2415 | esac |
| 2416 | fi |
| 2417 | # |
| 2418 | case "$client_archi_ans" in |
| 2419 | 2) |
| 2420 | # use default, let apt-rpm decide, so we do not have to change anything in |
| 2421 | # /etc/apt/apt.conf |
| 2422 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2423 | echoscip-shell system . . echo. "$msg_same_optimization" |
| 2424 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2425 | client_archi_set="best_optimization" |
| 2426 | ;; |
| 2427 | 0) |
| 2428 | # for i386... this is not available for FC2... |
| 2429 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2430 | echoscip-shell system . . echo. "$msg_no_optimization" |
| 2431 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2432 | [scip-shell system . . `[`. -f "/etc/apt/apt.confscip-shell filesystem . . `/etc/apt/apt.conf`." ] && perlscip-shell system . . perl. -p -i -e "s/^.*Install-Options.*\"\".*;/ Install-Options \"\"; Architecture \"i386\";/" /etc/apt/apt.confscip-shell filesystem . . `/etc/apt/apt.conf`. |
| 2433 | client_archi_set="i386" |
| 2434 | ;; |
| 2435 | *) |
| 2436 | # for apt to use upto i586, the change will be in /etc/apt/apt.conf |
| 2437 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2438 | echoscip-shell system . . echo. "$msg_i586_optimization" |
| 2439 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2440 | [scip-shell system . . `[`. -f "/etc/apt/apt.confscip-shell filesystem . . `/etc/apt/apt.conf`." ] && perlscip-shell system . . perl. -p -i -e "s/^.*Install-Options.*\"\".*;/ Install-Options \"\"; Architecture \"i586\";/" /etc/apt/apt.confscip-shell filesystem . . `/etc/apt/apt.conf`. |
| 2441 | client_archi_set="i586" |
| 2442 | ;; |
| 2443 | esac |
| 2444 | } # end of parse_client_archi_setting |
| 2445 | |
| 2446 | # |
| 2447 | install_client_archi_glibc_openssl_RHscip-shell shell shell-project 0.0.0 install_client_archi_glibc_openssl_RH().() { |
| 2448 | local pkg_ARCH installed_pkg Is_i386_pkg_available ipkg pkg_ARCH_now lib_bk idir |
| 2449 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2450 | # x86_64 will be in best_optimization |
| 2451 | if [scip-shell system . . `[`. "$client_archi_set" = "best_optimization" ]; then |
| 2452 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2453 | echoscip-shell system . . echo. "$msg_optimization_is_on" |
| 2454 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2455 | return 0 |
| 2456 | fi |
| 2457 | # for i586 and i386, we force to use i386 version: glibc, openssl and opensssl-perl (for CentOS 4.3) and more... |
| 2458 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2459 | echoscip-shell system . . echo. "$msg_optimization_is_off" |
| 2460 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2461 | |
| 2462 | for ipkg in $i686_pkg_check_list_RH_like; do |
| 2463 | pkg_ARCH="" |
| 2464 | installed_pkg="" |
| 2465 | # ///NOTE/// Ex: In CentOS 5 x86_64, the output results: |
| 2466 | # >rpm -q --qf '%{arch}\n' glibc |
| 2467 | # x86_64 |
| 2468 | # i686 |
| 2469 | # i.e. we might have 2 archs |
| 2470 | rpm -q --qf '%{ARCH}' $ipkg > /dev/nullscip-shell filesystem . . `/dev/null`. && pkg_ARCH="$(rpm -q --qf '%{ARCH}\n' $ipkg)" |
| 2471 | # If the package is not installed of it's already i386, try next |
| 2472 | [scip-shell system . . `[`. -z "$pkg_ARCH" ] && continue |
| 2473 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $pkg_ARCH | grepscip-shell system . . grep. -Ew "i386")" ]; then |
| 2474 | echoscip-shell system . . echo. "$ipkg is already for i386 arch." |
| 2475 | continue |
| 2476 | fi |
| 2477 | # From Fedora 9, the query output for rpm is different: |
| 2478 | # Ex: rpm -q glibc: |
| 2479 | # Before Fedora 9 the output is: glibc-2.7-2 |
| 2480 | # After Fedora 9 the output is: glibc-2.8-3.i686 |
| 2481 | # i.e. an extra .i686 will be append. |
| 2482 | # ///NOTE/// Ex: In CentOS 5 x86_64, the output results: |
| 2483 | # >rpm -q --qf '%{arch}\n' glibc |
| 2484 | # x86_64 |
| 2485 | # i686 |
| 2486 | # i.e. we might have 2 archs |
| 2487 | installed_pkg="$(rpm -q "${ipkg}" | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. | sedscip-shell system . . sed. -e "s|\.i[3-6]86||g")" |
| 2488 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2489 | echoscip-shell system . . echo. "$msg_install_i386_of $installed_pkg..." |
| 2490 | echoscip-shell system . . echo. "$msg_searching_pkg_in_ayo..." |
| 2491 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2492 | for irpm in $RH_RPMS_os_update_dir; do |
| 2493 | # Before installing, check if it's available. This is due to a bug in |
| 2494 | # FC4. rpm in FC4 will not able to return to command line if package |
| 2495 | # is not available. So we have to check it first. |
| 2496 | Is_i386_pkg_available="$(list_available_rpm $url_os_coreroot/$irpm/ | grepscip-shell system . . grep. "^${installed_pkg}.i386.rpm" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 2497 | if [scip-shell system . . `[`. -n "$Is_i386_pkg_available" ]; then |
| 2498 | echoscip-shell system . . echo. "Installing i386 $ipkg from $url_os_coreroot/$irpm/${installed_pkg}.i386.rpm..." |
| 2499 | # since rpm does not support file://..., we use get_inst_rpm |
| 2500 | #rpm -Uvh --force --quiet $url_os_coreroot/$irpm/${installed_pkg}.i386.rpm 2>/dev/null |
| 2501 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $url_os_coreroot/$irpm/${installed_pkg}.i386.rpm -r "rpm -Uvh --force --quiet" |
| 2502 | fi |
| 2503 | # it seems that even if rpm successfully install glibc with |
| 2504 | # -Uvh --force, the return code is still 1... |
| 2505 | # So we have to use rpm -q --qf to check |
| 2506 | #RETVAL=$? |
| 2507 | #[ $RETVAL -eq 0 ] && break |
| 2508 | rpm -q --qf '%{ARCH}' $ipkg > /dev/nullscip-shell filesystem . . `/dev/null`. && pkg_ARCH_now=`rpm -q --qf '%{ARCH}' $ipkg` |
| 2509 | [scip-shell system . . `[`. "$pkg_ARCH_now" = "i386" ] && break |
| 2510 | done |
| 2511 | # add warning if i386 rpm is not installed |
| 2512 | if [scip-shell system . . `[`. "$pkg_ARCH_now" != "i386" ]; then |
| 2513 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2514 | echoscip-shell system . . echo. "Warning! Unable to find the i386 ${installed_glibc} in the repository!!! The DRBL client will fail to boot if different CPU arch from that of DRBL server!" |
| 2515 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2516 | fi |
| 2517 | # If it's glibc, we have to take care of the bug in RH9, i.e. stale files still exist, we have remove them. |
| 2518 | if [scip-shell system . . `[`. "$ipkg" = "glibc" ]; then |
| 2519 | # sleep to make rpm db ok. |
| 2520 | sleepscip-shell system . . sleep. 5 |
| 2521 | # to mv the i686 lib which should not exists in i386 glibc packags |
| 2522 | # if they are not cleaned. |
| 2523 | lib_bk="/lib/i686 /lib/tls /usr/lib/i686scip-shell filesystem . . `/lib/i686 /lib/tls /usr/lib/i686`." |
| 2524 | for idir in $lib_bk; do |
| 2525 | if [scip-shell system . . `[`. -d "$idir" ]; then |
| 2526 | [scip-shell system . . `[`. -d "$idir.bak" ] && rmscip-shell system . . rm. -rf $idir.bak |
| 2527 | mvscip-shell system . . mv. -f $idir $idir.bak |
| 2528 | fi |
| 2529 | done |
| 2530 | fi |
| 2531 | done |
| 2532 | } # end of install_client_archi_glibc_openssl_RH |
| 2533 | |
| 2534 | # |
| 2535 | install_client_archi_glibc_etc_SUSEscip-shell shell shell-project 0.0.0 install_client_archi_glibc_etc_SUSE().() { |
| 2536 | # |
| 2537 | local url_tmp="" pkg_tmp="" |
| 2538 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2539 | case "$client_archi_set" in |
| 2540 | "best_optimization") |
| 2541 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2542 | echoscip-shell system . . echo. "$msg_optimization_is_on" |
| 2543 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2544 | ;; |
| 2545 | *) |
| 2546 | # for i586 and i386, we force to use i586 version: glibc, db... |
| 2547 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2548 | echoscip-shell system . . echo. "$msg_optimization_is_off" |
| 2549 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2550 | for ipkg in $i686_pkg_check_list_SUSE; do |
| 2551 | # i686_pkg_check_list_SUSE is: glibc glibc-devel db db-devel... |
| 2552 | # since "-" can not ba a variable name, replace it as "_" |
| 2553 | ipkg_arch_var="$(echoscip-shell system . . echo. $ipkg | sedscip-shell system . . sed. -e "s/-/_/g")" |
| 2554 | eval ipkg_ARCH=\$${ipkg_arch_var}_ARCH |
| 2555 | [scip-shell system . . `[`. -z "$ipkg_ARCH" ] && continue |
| 2556 | echoscip-shell system . . echo. "$ipkg arch: $ipkg_ARCH." |
| 2557 | if [scip-shell system . . `[`. "$ipkg_ARCH" != "i586" ]; then |
| 2558 | echoscip-shell system . . echo. "Finding the i586 $ipkg in apt repository..." |
| 2559 | case "$installer" in |
| 2560 | apt) |
| 2561 | available_ipkg_rpm="$(parse_apt_url_get_rpm.sh -a RPMS.updates -a RPMS.base -r i586 --no-specific-ver ${ipkg} 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 2562 | # The obtained $available_ipkg_rpm is like: http://opensource.nchc.org.tw/opensuse/distribution/SL-10.1/inst-source/suse/i586/glibc-2.4-25.i586.rpm |
| 2563 | if [scip-shell system . . `[`. -n "$available_ipkg_rpm" ]; then |
| 2564 | echoscip-shell system . . echo. "Installing i586 ${ipkg}: $available_ipkg_rpm..." |
| 2565 | # since rpm does not support file://..., we use get_inst_rpm |
| 2566 | #rpm -Uvh --force --quiet $available_ipkg_rpm 2>/dev/null |
| 2567 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $available_ipkg_rpm -r "rpm -Uvh --force --quiet" |
| 2568 | fi |
| 2569 | ;; |
| 2570 | yum|zypper) |
| 2571 | available_ipkg_rpm="$(list_available_rpm $url_os_coreroot/$OS_PATH_IN_YUM_REPO/$REPO_PATH/suse/i586/ | grepscip-shell system . . grep. -E "^$ipkg-[0-9]+.*.i586.rpm" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 2572 | if [scip-shell system . . `[`. -n "$available_ipkg_rpm" ]; then |
| 2573 | echoscip-shell system . . echo. "Installing i586 ${ipkg}: $available_ipkg_rpm..." |
| 2574 | # since rpm does not support file://..., we use get_inst_rpm |
| 2575 | # rpm -Uvh --force --quiet $url_os_coreroot/$OS_PATH_IN_YUM_REPO/inst-source/suse/i586/$available_ipkg_rpm 2>/dev/null |
| 2576 | get_inst_rpmscip-shell shell shell-project 0.0.0 get_inst_rpm(). -f $url_os_coreroot/$OS_PATH_IN_YUM_REPO/$REPO_PATH/suse/i586/$available_ipkg_rpm -r "rpm -Uvh --force --quiet" |
| 2577 | fi |
| 2578 | ;; |
| 2579 | esac |
| 2580 | |
| 2581 | # it seems that even if rpm successfully install glibc with |
| 2582 | # -Uvh --force, the return code is still 1... |
| 2583 | # So we have to use rpm -q --qf to check, not by return code. |
| 2584 | rpm -q --qf '%{ARCH}' ${ipkg} > /dev/nullscip-shell filesystem . . `/dev/null`. && ipkg_ARCH_now=`rpm -q --qf '%{ARCH}' ${ipkg}` |
| 2585 | [scip-shell system . . `[`. "$ipkg_ARCH_now" = "i586" ] && continue |
| 2586 | # add warning if i586 rpm is not installed |
| 2587 | if [scip-shell system . . `[`. "$ipkg_ARCH_now" != "i586" ]; then |
| 2588 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 2589 | echoscip-shell system . . echo. "Warning! Unable to find the i586 ${ipkg} in the repository!!! The DRBL client will fail to boot if different CPU arch from that of DRBL server!" |
| 2590 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 2591 | fi |
| 2592 | if [scip-shell system . . `[`. "$ipkg" = "glibc" ]; then |
| 2593 | # sleep to make rpm db ok. |
| 2594 | sleepscip-shell system . . sleep. 5 |
| 2595 | # to mv the i686 lib which should not exists in i386 glibc packags |
| 2596 | # if they are not cleaned. |
| 2597 | lib_bk="/lib/i686 /lib/tls /usr/lib/i686scip-shell filesystem . . `/lib/i686 /lib/tls /usr/lib/i686`." |
| 2598 | for idir in $lib_bk; do |
| 2599 | if [scip-shell system . . `[`. -d "$idir" ]; then |
| 2600 | [scip-shell system . . `[`. -d "$idir.bak" ] && rmscip-shell system . . rm. -rf $idir.bak |
| 2601 | mvscip-shell system . . mv. -f $idir $idir.bak |
| 2602 | fi |
| 2603 | done |
| 2604 | fi |
| 2605 | fi |
| 2606 | done |
| 2607 | esac |
| 2608 | } # end of install_client_archi_glibc_etc_SUSE |
| 2609 | |
| 2610 | # |
| 2611 | parse_RH_os_yum_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_os_yum_repo_answer().() { |
| 2612 | local os_name="$1" |
| 2613 | local answer="$2" |
| 2614 | case "$answer" in |
| 2615 | 1) |
| 2616 | # download.fedora.redhat.com |
| 2617 | url_os="http://download.fedora.redhat.com" |
| 2618 | os_ayo_path="/pub/fedora/linux/corescip-shell filesystem . . `/pub/fedora/linux/core`." |
| 2619 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2620 | ;; |
| 2621 | 2) |
| 2622 | # mirrors.kernel.org |
| 2623 | url_os="http://mirrors.kernel.org" |
| 2624 | os_ayo_path="/fedora/corescip-shell filesystem . . `/fedora/core`." |
| 2625 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2626 | ;; |
| 2627 | 4) |
| 2628 | # skip the yum config, but we will use the following url_os... for glibc/kernel inst |
| 2629 | use_existing_yum_config="yes" |
| 2630 | |
| 2631 | url_os="http://free.nchc.org.tw" |
| 2632 | os_ayo_path="/fedora/linux/corescip-shell filesystem . . `/fedora/linux/core`." |
| 2633 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2634 | ;; |
| 2635 | 5) |
| 2636 | #enter by user |
| 2637 | url_os_default="http://mirrors.kernel.org" |
| 2638 | os_ayo_path_default="/fedora/core/scip-shell filesystem . . `/fedora/core/`." |
| 2639 | echoscip-shell system . . echo. "$msg_enter_FQDN_IP_yum_repository" |
| 2640 | echoscip-shell system . . echo. -n "[$url_os_default] " |
| 2641 | read url_os |
| 2642 | [scip-shell system . . `[`. -z "$url_os" ] && url_os="$url_os_default" |
| 2643 | |
| 2644 | echoscip-shell system . . echo. "$msg_enter_the_path_for_dir_ver_updates: \"$FC_VER\" $msg_and \"updates\"..." |
| 2645 | echoscip-shell system . . echo. -n "[$os_ayo_path_default] " |
| 2646 | read os_ayo_path |
| 2647 | [scip-shell system . . `[`. -z "$os_ayo_path" ] && os_ayo_path="$os_ayo_path_default" |
| 2648 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2649 | ;; |
| 2650 | *) |
| 2651 | # default one, use free.nchc.org.tw |
| 2652 | url_os="http://free.nchc.org.tw" |
| 2653 | case "$os_name" in |
| 2654 | FC*) |
| 2655 | os_ayo_path="/fedora/linux/corescip-shell filesystem . . `/fedora/linux/core`." |
| 2656 | ;; |
| 2657 | CO*) |
| 2658 | os_ayo_path="/centosscip-shell filesystem . . `/centos`." |
| 2659 | ;; |
| 2660 | esac |
| 2661 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2662 | esac |
| 2663 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2664 | echoscip-shell system . . echo. "$msg_select_url_path: $url_os, $os_ayo_path" |
| 2665 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2666 | |
| 2667 | } # end of parse_RH_os_yum_repo_answer |
| 2668 | |
| 2669 | # |
| 2670 | parse_RH_drbl_yum_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_drbl_yum_repo_answer().() { |
| 2671 | local answer="$1" |
| 2672 | # TODO x86_64: change i386 -> x86_64 ? or it works ? |
| 2673 | case "$answer" in |
| 2674 | 1) |
| 2675 | # ftp.twaren.net |
| 2676 | url_drbl="http://ftp.twaren.net" |
| 2677 | drbl_ayo_path="local-distfiles/drbl-core/i386" |
| 2678 | ;; |
| 2679 | 2) |
| 2680 | # drbl.sf.net |
| 2681 | url_drbl="http://drbl.sourceforge.net" |
| 2682 | drbl_ayo_path="drbl-core/i386" |
| 2683 | ;; |
| 2684 | 5) |
| 2685 | #enter by user |
| 2686 | url_drbl_default="http://drbl.sourceforge.net" |
| 2687 | drbl_ayo_path_default="/drbl-core/i386/scip-shell filesystem . . `/drbl-core/i386/`." |
| 2688 | echoscip-shell system . . echo. "Please enter the hostname or IP address of yum repository with http or ftp prefix where DRBL packages exists..." |
| 2689 | echoscip-shell system . . echo. -n "[$url_drbl_default] " |
| 2690 | read url_drbl |
| 2691 | [scip-shell system . . `[`. -z "$url_drbl" ] && url_drbl="$url_drbl_default" |
| 2692 | |
| 2693 | echoscip-shell system . . echo. "Enter the path where directory \"RPMS.drbl\" exists..." |
| 2694 | echoscip-shell system . . echo. -n "[$drbl_ayo_path_default] " |
| 2695 | read drbl_ayo_path |
| 2696 | [scip-shell system . . `[`. -z "$drbl_ayo_path" ] && drbl_ayo_path="$drbl_ayo_path_default" |
| 2697 | ;; |
| 2698 | *) |
| 2699 | # default one, use free.nchc.org.tw |
| 2700 | url_drbl="http://free.nchc.org.tw" |
| 2701 | drbl_ayo_path="drbl-core/i386" |
| 2702 | esac |
| 2703 | url_drbl_rpmroot="$url_drbl/$drbl_ayo_path/" |
| 2704 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2705 | echoscip-shell system . . echo. "$msg_select_url_path: $url_drbl, $drbl_ayo_path" |
| 2706 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2707 | |
| 2708 | } # parse_RH_drbl_yum_repo_answer |
| 2709 | |
| 2710 | # |
| 2711 | parse_RH_os_apt_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_os_apt_repo_answer().() { |
| 2712 | local os_ver="$1" |
| 2713 | local answer="$2" |
| 2714 | local ver_no="${os_ver:2}" |
| 2715 | case "$answer" in |
| 2716 | 1) |
| 2717 | # freshrpms |
| 2718 | url_os="http://ayo.freshrpms.net" |
| 2719 | case "$os_ver" in |
| 2720 | RH*) |
| 2721 | url_os_coreroot="$url_os/redhat" |
| 2722 | os_ayo_path="redhat/$RH_VER/i386" |
| 2723 | ;; |
| 2724 | FC*) |
| 2725 | url_os_coreroot="$url_os/fedora/linux" |
| 2726 | os_ayo_path="fedora/linux/$FC_VER/i386" |
| 2727 | ;; |
| 2728 | esac |
| 2729 | FRESHRPMS="freshrpms" |
| 2730 | ;; |
| 2731 | 3) |
| 2732 | # local repository |
| 2733 | url_os="/scip-shell filesystem . . `/`." |
| 2734 | url_os_coreroot_default="/opt/mirror/fedora/linux/corescip-shell filesystem . . `/opt/mirror/fedora/linux/core`." |
| 2735 | os_ayo_path_default="/opt/mirror/fedora/apt/fedora/linux/$ver_no/i386" |
| 2736 | echoscip-shell system . . echo. "Enter the path where directory \"$ver_no\" and \"updates\" exist." |
| 2737 | echoscip-shell system . . echo. -n "[$url_os_coreroot_default] " |
| 2738 | read url_os_coreroot |
| 2739 | [scip-shell system . . `[`. -z "$url_os_coreroot" ] && url_os_coreroot="$url_os_coreroot_default" |
| 2740 | while [scip-shell system . . `[`. ! -e "$url_os_coreroot/$ver_no" ]; do |
| 2741 | echoscip-shell system . . echo. "No such directory \"$url_os_coreroot/$ver_no\" or \"$url_os_coreroot/updates/$ver_no\"!" |
| 2742 | echoscip-shell system . . echo. "Please enter it again!" |
| 2743 | read url_os_coreroot |
| 2744 | done |
| 2745 | |
| 2746 | echoscip-shell system . . echo. "Enter the path where directory RPMS.$core_dir, RPMS.updates... exist." |
| 2747 | echoscip-shell system . . echo. -n "[$os_ayo_path_default] " |
| 2748 | read os_ayo_path |
| 2749 | [scip-shell system . . `[`. -z "$os_ayo_path" ] && os_ayo_path="$os_ayo_path_default" |
| 2750 | while [scip-shell system . . `[`. ! -e "$os_ayo_path/RPMS.$core_dir" ] || [scip-shell system . . `[`. ! -e "$os_ayo_path/RPMS.drbl" ]; do |
| 2751 | echoscip-shell system . . echo. "No such directory $os_ayo_path/RPMS.$core_dir or $os_ayo_path/RPMS.drbl!" |
| 2752 | echoscip-shell system . . echo. "Please enter it again!" |
| 2753 | read os_ayo_path |
| 2754 | done |
| 2755 | ;; |
| 2756 | 5) |
| 2757 | # enter by user |
| 2758 | url_os_default="http://ayo.freshrpms.net" |
| 2759 | os_coreroot_default="/fedora/linux/scip-shell filesystem . . `/fedora/linux/`." |
| 2760 | os_ayo_path_default="/fedora/linux/$ver_no/i386" |
| 2761 | echoscip-shell system . . echo. "Enter the hostname or IP address of $os_ver packages repository with http or ftp prefix." |
| 2762 | echoscip-shell system . . echo. -n "[$url_os_default] " |
| 2763 | read url_os |
| 2764 | [scip-shell system . . `[`. -z "$url_os" ] && url_os="$url_os_default" |
| 2765 | |
| 2766 | echoscip-shell system . . echo. "Enter the path where directory \"$ver_no\" and \"updates\" exist." |
| 2767 | echoscip-shell system . . echo. -n "[$os_coreroot_default] " |
| 2768 | read os_coreroot |
| 2769 | [scip-shell system . . `[`. -z "$os_coreroot" ] && os_coreroot="$os_coreroot_default" |
| 2770 | url_os_coreroot="$url_os/$os_coreroot" |
| 2771 | |
| 2772 | echoscip-shell system . . echo. "Enter the path where directory RPMS.$core_dir, RPMS.updates... exist." |
| 2773 | echoscip-shell system . . echo. -n "[$os_ayo_path_default] " |
| 2774 | read os_ayo_path |
| 2775 | [scip-shell system . . `[`. -z "$os_ayo_path" ] && os_ayo_path="$os_ayo_path_default" |
| 2776 | ;; |
| 2777 | *) |
| 2778 | # default one, use free.nchc.org.tw |
| 2779 | url_os="http://free.nchc.org.tw" |
| 2780 | case "$os_ver" in |
| 2781 | RH*) |
| 2782 | url_os_coreroot="$url_os/redhat/linux" |
| 2783 | os_ayo_path="redhat/apt/redhat/linux/$RH_VER/i386" |
| 2784 | ;; |
| 2785 | FC*) |
| 2786 | url_os_coreroot="$url_os/fedora/linux/core" |
| 2787 | os_ayo_path="fedora/apt/fedora/linux/$FC_VER/i386" |
| 2788 | ;; |
| 2789 | esac |
| 2790 | esac |
| 2791 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2792 | echoscip-shell system . . echo. "$msg_select_url_path: $url_os, $url_os_coreroot, $os_ayo_path" |
| 2793 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2794 | |
| 2795 | } # parse_RH_os_apt_repo_answer |
| 2796 | |
| 2797 | parse_RH_drbl_apt_repo_answerscip-shell shell shell-project 0.0.0 parse_RH_drbl_apt_repo_answer().() { |
| 2798 | # url_drbl_rpmroot is where the RPMS.drbl, RPMS.drbl-testing, RPMS.drbl-unstable... exist |
| 2799 | # url_os_rpmroot is where the RPMS.os, RPMS.core, RPMS.update... exist |
| 2800 | # try to set url_drbl_rpmroot and url_os, we need |
| 2801 | # url_drbl_rpmroot to get wget and apt |
| 2802 | # url_os_rpmroot to get glibc/openssl/kernel |
| 2803 | # os_ayo_path is under $url_os where RPMS.os/RPMS.core exists |
| 2804 | # drbl_ayo_path is under $url_drbl where RPMS.drbl exists |
| 2805 | local answer="$1" |
| 2806 | case "$answer" in |
| 2807 | 1) |
| 2808 | # ftp.twaren.net |
| 2809 | url_drbl="http://ftp.twaren.net" |
| 2810 | drbl_ayo_path="local-distfiles/drbl-core/i386" |
| 2811 | ;; |
| 2812 | 2) |
| 2813 | # drbl.sf.net |
| 2814 | url_drbl="http://drbl.sourceforge.net" |
| 2815 | drbl_ayo_path="drbl-core/i386" |
| 2816 | ;; |
| 2817 | 3) |
| 2818 | # local repository |
| 2819 | url_drbl_default="/scip-shell filesystem . . `/`." |
| 2820 | drbl_ayo_path_default="/drbl-core/i386scip-shell filesystem . . `/drbl-core/i386`." |
| 2821 | |
| 2822 | echoscip-shell system . . echo. "Enter the path where directory RPMS.$core_dir, RPMS.updates... exist." |
| 2823 | echoscip-shell system . . echo. -n "[$drbl_ayo_path_default] " |
| 2824 | read drbl_ayo_path |
| 2825 | [scip-shell system . . `[`. -z "$drbl_ayo_path" ] && os_ayo_path="$drbl_ayo_path_default" |
| 2826 | while [scip-shell system . . `[`. ! -e "$drbl_ayo_path/RPMS.$core_dir" ] || [scip-shell system . . `[`. ! -e "$drbl_ayo_path/RPMS.drbl" ]; do |
| 2827 | echoscip-shell system . . echo. "No such directory $drbl_ayo_path/RPMS.$core_dir or $drbl_ayo_path/RPMS.drbl!" |
| 2828 | echoscip-shell system . . echo. "Please enter it again!" |
| 2829 | read drbl_ayo_path |
| 2830 | done |
| 2831 | ;; |
| 2832 | 5) |
| 2833 | # enter by user |
| 2834 | url_drbl_default="http://drbl.sourceforge.net" |
| 2835 | drbl_ayo_path_default="/drbl-core/i386scip-shell filesystem . . `/drbl-core/i386`." |
| 2836 | |
| 2837 | echoscip-shell system . . echo. "Enter the hostname or IP address of DRBL packages repository with http or ftp prefix." |
| 2838 | echoscip-shell system . . echo. -n "[$url_drbl_default] " |
| 2839 | read url_drbl |
| 2840 | [scip-shell system . . `[`. -z "$url_drbl" ] && url_drbl="$url_drbl_default" |
| 2841 | echoscip-shell system . . echo. "Enter the path where directory RPMS.$core_dir, RPMS.updates... exist." |
| 2842 | echoscip-shell system . . echo. -n "[$drbl_ayo_path_default] " |
| 2843 | read drbl_ayo_path |
| 2844 | [scip-shell system . . `[`. -z "$drbl_ayo_path" ] && drbl_ayo_path="$drbl_ayo_path_default" |
| 2845 | ;; |
| 2846 | *) |
| 2847 | # default one, use free.nchc.org.tw |
| 2848 | url_drbl="http://free.nchc.org.tw" |
| 2849 | drbl_ayo_path="drbl-core/i386" |
| 2850 | esac |
| 2851 | url_drbl_rpmroot="$url_drbl/$drbl_ayo_path/" |
| 2852 | case "${OS_Version}" in |
| 2853 | FC*) |
| 2854 | dist="fedora" |
| 2855 | ;; |
| 2856 | RH*) |
| 2857 | dist="redhat" |
| 2858 | ;; |
| 2859 | esac |
| 2860 | url_drbl_collect_root="$url_drbl/drbl-core/pre-drbl/${dist}/linux/${OS_Version:2}/i386" |
| 2861 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2862 | echoscip-shell system . . echo. "$msg_select_url_path: $url_drbl, $drbl_ayo_path" |
| 2863 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2864 | } # parse_RH_drbl_apt_repo_answer |
| 2865 | |
| 2866 | # |
| 2867 | parse_MDK_os_ayo_repo_answerscip-shell shell shell-project 0.0.0 parse_MDK_os_ayo_repo_answer().() { |
| 2868 | # url_drbl_rpmroot is where the RPMS.drbl, RPMS.drbl-testing, RPMS.drbl-unstable... exist |
| 2869 | # url_os_rpmroot is where the rpm files (lernel-2.6.8-24mdk-1-1mdk.i586.rpm)... exist |
| 2870 | # try to set url_drbl_rpmroot and url_os, we need |
| 2871 | # url_drbl_rpmroot to get wget and apt |
| 2872 | # url_os_rpmroot to get glibc/openssl/kernel |
| 2873 | # url_os_rpmroot is to the path where "official" exists. |
| 2874 | local answer="$1" |
| 2875 | case "$answer" in |
| 2876 | 1) |
| 2877 | # ftp.twaren.net |
| 2878 | url_os="http://ftp.twaren.net" |
| 2879 | os_ayo_path="/Linux/Mandrake/officialscip-shell filesystem . . `/Linux/Mandrake/official`." |
| 2880 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2881 | ;; |
| 2882 | 2) |
| 2883 | # http://mirrors.kernel.org/mandrake/Mandrakelinux/official/ |
| 2884 | # mirrors.kernel.org |
| 2885 | url_os="http://mirrors.kernel.org" |
| 2886 | os_ayo_path="/mandrake/Mandrakelinux/officialscip-shell filesystem . . `/mandrake/Mandrakelinux/official`." |
| 2887 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2888 | ;; |
| 2889 | 3) |
| 2890 | # ftp://ftp.isu.edu.tw/pub/Linux/Mandriva/official/ |
| 2891 | url_os="ftp://ftp.isu.edu.tw" |
| 2892 | os_ayo_path="/pub/Linux/Mandriva/officialscip-shell filesystem . . `/pub/Linux/Mandriva/official`." |
| 2893 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2894 | ;; |
| 2895 | 4) |
| 2896 | # TODO... make $use_existing_yum_config work in urpmi.addmedia |
| 2897 | # skip the setting of yum, but we will add this for glibc/kernel inst. |
| 2898 | use_existing_urpmi_config="yes" |
| 2899 | url_os="http://free.nchc.org.tw" |
| 2900 | os_ayo_path="/mandrake/officialscip-shell filesystem . . `/mandrake/official`." |
| 2901 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2902 | ;; |
| 2903 | 5) |
| 2904 | #enter by user |
| 2905 | url_os_default="http://mirrors.kernel.org" |
| 2906 | os_ayo_path_default="/mandrake/Mandrakelinux/official/scip-shell filesystem . . `/mandrake/Mandrakelinux/official/`." |
| 2907 | echoscip-shell system . . echo. "Please enter the hostname or IP address of OS packages repository with http or ftp prefix..." |
| 2908 | echoscip-shell system . . echo. -n "[$url_os_default] " |
| 2909 | read url_os |
| 2910 | [scip-shell system . . `[`. -z "$url_os" ] && url_os="$url_os_default" |
| 2911 | |
| 2912 | echoscip-shell system . . echo. "Enter the path where directories \"${OS_Version:3}\" and \"updates\"exist..." |
| 2913 | echoscip-shell system . . echo. -n "[$os_ayo_path_default] " |
| 2914 | read os_ayo_path |
| 2915 | [scip-shell system . . `[`. -z "$os_ayo_path" ] && os_ayo_path="$os_ayo_path_default" |
| 2916 | |
| 2917 | url_os_coreroot=$url_os/$os_ayo_path |
| 2918 | ;; |
| 2919 | *) |
| 2920 | # default one, use free.nchc.org.tw |
| 2921 | url_os="http://free.nchc.org.tw" |
| 2922 | os_ayo_path="/mandrake/officialscip-shell filesystem . . `/mandrake/official`." |
| 2923 | url_os_coreroot="$url_os/$os_ayo_path" |
| 2924 | esac |
| 2925 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2926 | echoscip-shell system . . echo. "$msg_select_url_path: $url_os, $url_os_coreroot" |
| 2927 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2928 | |
| 2929 | } # end of parse_MDK_os_ayo_repo_answer |
| 2930 | |
| 2931 | # |
| 2932 | parse_MDK_drbl_ayo_repo_answerscip-shell shell shell-project 0.0.0 parse_MDK_drbl_ayo_repo_answer().() { |
| 2933 | # url_drbl_rpmroot is where the RPMS.drbl, RPMS.drbl-testing, RPMS.drbl-unstable... exist |
| 2934 | # url_os_rpmroot is where the rpm files (lernel-2.6.8-24mdk-1-1mdk.i586.rpm)... exist |
| 2935 | # try to set url_drbl_rpmroot and url_os, we need |
| 2936 | # url_drbl_rpmroot to get wget and apt |
| 2937 | # url_os_rpmroot to get glibc/openssl/kernel |
| 2938 | # url_os_rpmroot is to the path where "official" exists. |
| 2939 | local answer="$1" |
| 2940 | case "$answer" in |
| 2941 | 1) |
| 2942 | # ftp.twaren.net |
| 2943 | url_drbl="http://ftp.twaren.net" |
| 2944 | drbl_ayo_path="local-distfiles/drbl-core/i386" |
| 2945 | ;; |
| 2946 | 2) |
| 2947 | # drbl.sf.net |
| 2948 | url_drbl="http://drbl.sourceforge.net" |
| 2949 | drbl_ayo_path="drbl-core/i386" |
| 2950 | ;; |
| 2951 | 5) |
| 2952 | #enter by user |
| 2953 | url_drbl_default="ftp://free.nchc.org.tw" |
| 2954 | drbl_ayo_path_default="/drbl-core/i386scip-shell filesystem . . `/drbl-core/i386`." |
| 2955 | echoscip-shell system . . echo. "Please enter the hostname or IP address of apt repository with http or ftp prefix..." |
| 2956 | echoscip-shell system . . echo. -n "[$url_drbl_default] " |
| 2957 | read url_drbl |
| 2958 | [scip-shell system . . `[`. -z "$url_drbl" ] && url_drbl="$url_drbl_default" |
| 2959 | |
| 2960 | echoscip-shell system . . echo. "Enter the path where directory RPMS.drbl exist..." |
| 2961 | echoscip-shell system . . echo. -n "[$drbl_ayo_path_default] " |
| 2962 | read drbl_ayo_path |
| 2963 | [scip-shell system . . `[`. -z "$drbl_ayo_path" ] && drbl_ayo_path="$drbl_ayo_path_default" |
| 2964 | ;; |
| 2965 | *) |
| 2966 | # default one, use free.nchc.org.tw |
| 2967 | url_drbl="http://free.nchc.org.tw" |
| 2968 | drbl_ayo_path="drbl-core/i386" |
| 2969 | esac |
| 2970 | url_drbl_rpmroot="$url_drbl/$drbl_ayo_path/" |
| 2971 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2972 | echoscip-shell system . . echo. "$msg_select_url_path: $url_drbl, $drbl_ayo_path" |
| 2973 | echoscip-shell system . . echo. "------------------------------------------------------" |
| 2974 | |
| 2975 | } # end of parse_MDK_drbl_ayo_repo_answer |
| 2976 | # |
| 2977 | |
| 2978 | generate_fedora_yum_confscip-shell shell shell-project 0.0.0 generate_fedora_yum_conf().() { |
| 2979 | # backup old file |
| 2980 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 2981 | echoscip-shell system . . echo. "Backuping the repo files..." |
| 2982 | if [scip-shell system . . `[`. "$use_existing_yum_config" = "yes" ]; then |
| 2983 | # we won't touch the existing $FC_CORE_REPO fedora-updates.repo |
| 2984 | for ifile in $drbl_yum_repo_list; do |
| 2985 | [scip-shell system . . `[`. -f "/etc/yum.repos.d/$ifile" ] && mvscip-shell system . . mv. -f /etc/yum.repos.d/$ifile /etc/yum.repos.d/$ifile.drblsave |
| 2986 | done |
| 2987 | else |
| 2988 | for ifile in $FC_CORE_REPO fedora-updates.repo $drbl_yum_repo_list; do |
| 2989 | [scip-shell system . . `[`. -f "/etc/yum.repos.d/$ifile" ] && mvscip-shell system . . mv. -f /etc/yum.repos.d/$ifile /etc/yum.repos.d/$ifile.drblsave |
| 2990 | done |
| 2991 | fi |
| 2992 | echoscip-shell system . . echo. "done!" |
| 2993 | |
| 2994 | # Turn off the testing and devel repository |
| 2995 | echoscip-shell system . . echo. -n "Turn off the testing and devel repository..." |
| 2996 | for ifile in fedora-updates-testing.repo fedora-devel.repo; do |
| 2997 | [scip-shell system . . `[`. -f "$/etc/yum.repos.d/$ifile" ] && perlscip-shell system . . perl. -p -i -e "s/^enabled=.*/enabled=0/g" /etc/yum.repos.d/$ifile |
| 2998 | done |
| 2999 | echoscip-shell system . . echo. "done!" |
| 3000 | |
| 3001 | if [scip-shell system . . `[`. "$use_existing_yum_config" != "yes" ]; then |
| 3002 | # overwrite the existing $FC_CORE_REPO and fedora-updates.repo |
| 3003 | # |
| 3004 | echoscip-shell system . . echo. "Creating the fedora core packages repository list..." |
| 3005 | catscip-shell system . . cat. <<-YUM_END > /etc/yum.repos.d/$FC_CORE_REPO |
| 3006 | [core] |
| 3007 | name=Fedora Core \$releasever - \$basearch - Base |
| 3008 | #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/\$releasever/\$basearch/os/ |
| 3009 | #mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-\$releasever |
| 3010 | baseurl=$url_os_coreroot/\$releasever/\$basearch/os |
| 3011 | enabled=1 |
| 3012 | gpgcheck=1 |
| 3013 | YUM_END |
| 3014 | |
| 3015 | # |
| 3016 | echoscip-shell system . . echo. "Creating the fedora updates packages repository list..." |
| 3017 | catscip-shell system . . cat. <<-YUM_END > /etc/yum.repos.d/fedora-updates.reposcip-shell filesystem . . `/etc/yum.repos.d/fedora-updates.repo`. |
| 3018 | [updates-released] |
| 3019 | name=Fedora Core \$releasever - \$basearch - Released Updates |
| 3020 | #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/\$releasever/\$basearch/ |
| 3021 | #mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc\$releasever |
| 3022 | baseurl=$url_os_coreroot/updates/\$releasever/\$basearch/ |
| 3023 | enabled=1 |
| 3024 | gpgcheck=1 |
| 3025 | YUM_END |
| 3026 | |
| 3027 | fi |
| 3028 | } # end of generate_fedora_yum_conf |
| 3029 | |
| 3030 | # |
| 3031 | generate_drbl_yum_confscip-shell shell shell-project 0.0.0 generate_drbl_yum_conf().() { |
| 3032 | # copy those drbl template yum config |
| 3033 | cpscip-shell system . . cp. -f $DRBL_SCRIPT_PATH/setup/yum-repos/drbl*.repo /etc/yum.repos.d/scip-shell filesystem . . `/etc/yum.repos.d/`. |
| 3034 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3035 | |
| 3036 | # DRBL stable |
| 3037 | if [scip-shell system . . `[`. -n "$DRBL_STABLE" ]; then |
| 3038 | echoscip-shell system . . echo. "Preparing the DRBL stable packages repository list..." |
| 3039 | perlscip-shell system . . perl. -pi -e 's|(^[[:space:]]*mirrorlist=.*)|#$1|g' /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 3040 | perlscip-shell system . . perl. -pi -e "s|^#*[[:space:]]*baseurl=.*|baseurl=$url_drbl/$drbl_ayo_path/RPMS.drbl|g" /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 3041 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=1|g" /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 3042 | else |
| 3043 | echoscip-shell system . . echo. "Disabling the DRBL stable packages repository list..." |
| 3044 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=0|g" /etc/yum.repos.d/drbl.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl.repo`. |
| 3045 | fi |
| 3046 | |
| 3047 | # DRBL testing |
| 3048 | if [scip-shell system . . `[`. -n "$DRBL_TEST" ]; then |
| 3049 | echoscip-shell system . . echo. "Preparing the DRBL testing packages repository list..." |
| 3050 | perlscip-shell system . . perl. -pi -e 's|(^[[:space:]]*mirrorlist=.*)|#$1|g' /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 3051 | perlscip-shell system . . perl. -pi -e "s|^#*[[:space:]]*baseurl=.*|baseurl=$url_drbl/$drbl_ayo_path/RPMS.drbl-testing|g" /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 3052 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=1|g" /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 3053 | else |
| 3054 | echoscip-shell system . . echo. "Disabling the DRBL testing packages repository list..." |
| 3055 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=0|g" /etc/yum.repos.d/drbl-testing.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-testing.repo`. |
| 3056 | fi |
| 3057 | |
| 3058 | # DRBL unstable |
| 3059 | if [scip-shell system . . `[`. -n "$DRBL_UNSTABLE" ]; then |
| 3060 | echoscip-shell system . . echo. "Preparing the DRBL unstable packages repository list..." |
| 3061 | perlscip-shell system . . perl. -pi -e 's|(^[[:space:]]*mirrorlist=.*)|#$1|g' /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 3062 | perlscip-shell system . . perl. -pi -e "s|^#*[[:space:]]*baseurl=.*|baseurl=$url_drbl/$drbl_ayo_path/RPMS.drbl-unstable|g" /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 3063 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=1|g" /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 3064 | else |
| 3065 | echoscip-shell system . . echo. "Disabling the DRBL unstable packages repository list..." |
| 3066 | perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*enabled=.*|enabled=0|g" /etc/yum.repos.d/drbl-unstable.reposcip-shell filesystem . . `/etc/yum.repos.d/drbl-unstable.repo`. |
| 3067 | fi |
| 3068 | |
| 3069 | echoscip-shell system . . echo. "done!" |
| 3070 | } # end of generate_drbl_yum_conf |
| 3071 | |
| 3072 | # |
| 3073 | do_upgrade_system_for_RHscip-shell shell shell-project 0.0.0 do_upgrade_system_for_RH().() { |
| 3074 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3075 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3076 | echoscip-shell system . . echo. "$msg_glibc_openssl_upgrade_question" |
| 3077 | echoscip-shell system . . echo. "$msg_glibc_openssl_keep" |
| 3078 | echoscip-shell system . . echo. "$msg_keep_glibc_upgrade_openssl" |
| 3079 | echoscip-shell system . . echo. "$msg_upgrade_glibc_keep_openssl" |
| 3080 | echoscip-shell system . . echo. "$msg_upgrade_glibc_openssl" |
| 3081 | echoscip-shell system . . echo. "$msg_warning_glibc_upgrade" |
| 3082 | echoscip-shell system . . echo. "$msg_upgrade_glibc_make_you_cry" |
| 3083 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3084 | echoscip-shell system . . echo. -n "[3] " |
| 3085 | read RH_upgrade_option |
| 3086 | |
| 3087 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3088 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3089 | echoscip-shell system . . echo. "$msg_upgrade_whole_system" |
| 3090 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3091 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3092 | |
| 3093 | # we must keep drbl |
| 3094 | APT_KEEP_OPT='-o RPM::Hold::=drbl' |
| 3095 | YUM_KEEP_OPT='--exclude=drbl' |
| 3096 | case "$RH_upgrade_option" in |
| 3097 | 0) |
| 3098 | # keep glibc and openssl |
| 3099 | APT_KEEP_OPT="$APT_KEEP_OPT -o RPM::Hold::=openssl -o RPM::Hold::=glibc" |
| 3100 | YUM_KEEP_OPT="$YUM_KEEP_OPT --exclude=openssl --exclude=glibc --exclude=glibc-common --exclude=glibc-devel --exclude=glibc-headers" |
| 3101 | ;; |
| 3102 | 1) |
| 3103 | # upgrade openssl, keep glibc |
| 3104 | APT_KEEP_OPT="$APT_KEEP_OPT -o RPM::Hold::=glibc" |
| 3105 | YUM_KEEP_OPT="$YUM_KEEP_OPT --exclude=glibc --exclude=glibc-common --exclude=glibc-devel --exclude=glibc-headers" |
| 3106 | ;; |
| 3107 | 2) |
| 3108 | # upgrade glibc, keep openssl |
| 3109 | APT_KEEP_OPT="$APT_KEEP_OPT -o RPM::Hold::=openssl" |
| 3110 | YUM_KEEP_OPT="$YUM_KEEP_OPT --exclude=openssl" |
| 3111 | ;; |
| 3112 | *) |
| 3113 | # upgrade glibc and openssl |
| 3114 | echoscip-shell system . . echo. "We will upgrade glibc and openssl." |
| 3115 | ;; |
| 3116 | esac |
| 3117 | |
| 3118 | # do it |
| 3119 | [scip-shell system . . `[`. "$installer" = "apt" ] && apt-getscip-shell system . . apt-get. dist-upgrade $APT_KEEP_OPT |
| 3120 | [scip-shell system . . `[`. "$installer" = "yum" ] && yum $YUM_KEEP_OPT update |
| 3121 | } # end of do_upgrade_system_for_RH |
| 3122 | |
| 3123 | # |
| 3124 | import_rpm_keyscip-shell shell shell-project 0.0.0 import_rpm_key().() { |
| 3125 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3126 | case "$OS_Version" in |
| 3127 | FC*) |
| 3128 | # import GPG key if not imported. |
| 3129 | if ! rpm -qi --quiet gpg-pubkey-db42a60e-37ea5438; then |
| 3130 | # For FC[45], there are 2 dirs containing key, but they are same: |
| 3131 | # /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora |
| 3132 | # /usr/share/doc/fedora-release-5/RPM-GPG-KEY-fedora |
| 3133 | # We choose either one. |
| 3134 | RH_GPG_KEY="$(rpm -ql fedora-release | grepscip-shell system . . grep. -E "RPM-GPG-KEY$" | headscip-shell system . . head. -n 1)" |
| 3135 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3136 | echoscip-shell system . . echo. "Importing the RPM-GPG-KEY from $RH_GPG_KEY..." |
| 3137 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3138 | rpm --import $RH_GPG_KEY |
| 3139 | else |
| 3140 | echoscip-shell system . . echo. "Red Hat GPG public key gpg-pubkey-db42a60e-37ea5438 was already imported." |
| 3141 | fi |
| 3142 | if ! rpm -qi --quiet gpg-pubkey-4f2a6fd2-3f9d9d3b; then |
| 3143 | FC_GPG_KEY="$(rpm -ql fedora-release | grepscip-shell system . . grep. -E "RPM-GPG-KEY-fedora$" | headscip-shell system . . head. -n 1)" |
| 3144 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3145 | echoscip-shell system . . echo. "Importing the RPM-GPG-KEY-fedora from $FC_GPG_KEY..." |
| 3146 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3147 | rpm --import $FC_GPG_KEY |
| 3148 | else |
| 3149 | echoscip-shell system . . echo. "Fedora Project GPG public key gpg-pubkey-4f2a6fd2-3f9d9d3b was already imported." |
| 3150 | fi |
| 3151 | ;; |
| 3152 | CO*) |
| 3153 | if ! rpm -qi --quiet gpg-pubkey-443e1821-421f218f; then |
| 3154 | # /usr/share/doc/centos-release-4/RPM-GPG-KEY is all the same with |
| 3155 | # /usr/share/doc/centos-release-4/RPM-GPG-KEY-centos4 |
| 3156 | # So we just use the one RPM-GPG-KEY-centos4 |
| 3157 | CO_GPG_KEY="$(rpm -ql centos-release | grepscip-shell system . . grep. -E "RPM-GPG-KEY-centos4$")" |
| 3158 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3159 | echoscip-shell system . . echo. -n "Importing the RPM GPG KEY from $CO_GPG_KEY..." |
| 3160 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3161 | rpm --import $CO_GPG_KEY |
| 3162 | fi |
| 3163 | ;; |
| 3164 | esac |
| 3165 | } # end of import_rpm_key |
| 3166 | |
| 3167 | # |
| 3168 | do_upgrade_system_for_MDKscip-shell shell shell-project 0.0.0 do_upgrade_system_for_MDK().() { |
| 3169 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3170 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3171 | echoscip-shell system . . echo. "$msg_upgrade_whole_system" |
| 3172 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3173 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3174 | |
| 3175 | APT_KEEP_OPT='-o RPM::Hold::=drbl' |
| 3176 | case "$installer" in |
| 3177 | "apt") |
| 3178 | apt-getscip-shell system . . apt-get. upgrade $APT_KEEP_OPT |
| 3179 | ;; |
| 3180 | "urpmi") |
| 3181 | # backup the original skip.list |
| 3182 | [scip-shell system . . `[`. -f /etc/urpmi/skip.listscip-shell filesystem . . `/etc/urpmi/skip.list`. ] && mvscip-shell system . . mv. -f /etc/urpmi/skip.listscip-shell filesystem . . `/etc/urpmi/skip.list`. /etc/urpmi/skip.list.drblsavescip-shell filesystem . . `/etc/urpmi/skip.list.drblsave`. |
| 3183 | # generate the skip list, we want to keep drbl |
| 3184 | catscip-shell system . . cat. <<EOF > /etc/urpmi/skip.listscip-shell filesystem . . `/etc/urpmi/skip.list`. |
| 3185 | drbl |
| 3186 | EOF |
| 3187 | urpmi --auto-select |
| 3188 | |
| 3189 | [scip-shell system . . `[`. -f /etc/urpmi/skip.list.drblsavescip-shell filesystem . . `/etc/urpmi/skip.list.drblsave`. ] && mvscip-shell system . . mv. -f /etc/urpmi/skip.list.drblsavescip-shell filesystem . . `/etc/urpmi/skip.list.drblsave`. /etc/urpmi/skip.listscip-shell filesystem . . `/etc/urpmi/skip.list`. |
| 3190 | ;; |
| 3191 | esac |
| 3192 | } # end of do_upgrade_system_for_MDK |
| 3193 | |
| 3194 | # |
| 3195 | do_upgrade_system_for_DBNscip-shell shell shell-project 0.0.0 do_upgrade_system_for_DBN().() { |
| 3196 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3197 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3198 | echoscip-shell system . . echo. "$msg_upgrade_whole_system" |
| 3199 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3200 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3201 | # do it |
| 3202 | [scip-shell system . . `[`. "$installer" = "apt" ] && apt-getscip-shell system . . apt-get. -y dist-upgrade |
| 3203 | } # end of do_upgrade_system_for_RH |
| 3204 | |
| 3205 | # For Debian |
| 3206 | install_drbl_DBNscip-shell shell shell-project 0.0.0 install_drbl_DBN().() { |
| 3207 | # function to install Debian DRBL |
| 3208 | # /etc/-release is like: |
| 3209 | # DISTRIB_ID=Ubuntu |
| 3210 | # DISTRIB_RELEASE=6.06 |
| 3211 | # DISTRIB_CODENAME=dapper |
| 3212 | # DISTRIB_DESCRIPTION="Ubuntu 6.06 LTS" |
| 3213 | [scip-shell system . . `[`. -e /etc/lsb-releasescip-shell filesystem . . `/etc/lsb-release`. ] && . /etc/lsb-releasescip-shell source . . `/etc/lsb-release`. |
| 3214 | #case "$OS_Version" in |
| 3215 | # DBN-TU) |
| 3216 | # # Ubuntu breezy, Debian Etch, Sid or... |
| 3217 | # # Force to set LC_ALL=C, otherwise in Ubuntu, it will show a lot warning messages in debconf like |
| 3218 | # # perl: warning: Setting locale failed. |
| 3219 | # # perl: warning: Please check that your locale settings: |
| 3220 | # # LANGUAGE = "zh_TW:zh:en_US:en", |
| 3221 | # # LC_ALL = "zh_TW.Big5", |
| 3222 | # # LANG = "zh_TW.UTF-8" |
| 3223 | # # are supported and installed on your system. |
| 3224 | # # perl: warning: Falling back to the standard locale ("C"). |
| 3225 | # export LC_ALL=C |
| 3226 | # ;; |
| 3227 | #esac |
| 3228 | |
| 3229 | # Some checkings: |
| 3230 | # It seems sarge running kernel 2.4 will have NFS problem... |
| 3231 | case "$OS_Version" in |
| 3232 | DBN3.1) |
| 3233 | if [scip-shell system . . `[`. -n "$(unamescip-shell system . . uname. -r | grepscip-shell system . . grep. -E "^2\.4\.*")" ]; then |
| 3234 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3235 | echoscip-shell system . . echo. "Kernel 2.4 is too old in DRBL environment for Debian Sarge, you have to run kernel 2.6. Please install kernel 2.6 and use it." |
| 3236 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3237 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3238 | exit 1 |
| 3239 | fi |
| 3240 | ;; |
| 3241 | esac |
| 3242 | # clean the stale files and make necessary directories |
| 3243 | [scip-shell system . . `[`. -f $drbl_pkgdir/dev.tgz ] && rmscip-shell system . . rm. -f $drbl_pkgdir/dev.tgz |
| 3244 | # create the directory for diskless image |
| 3245 | [scip-shell system . . `[`. ! -d "/tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`." ] && mkdirscip-shell system . . mkdir. -p /tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`. |
| 3246 | |
| 3247 | # 1. |
| 3248 | # User has to setup apt/yum first by them self, so skip this. |
| 3249 | |
| 3250 | # ask some setting for client, such as SMP, serial console... |
| 3251 | ask_and_parse_client_extra_settingscip-shell shell shell-project 0.0.0 ask_and_parse_client_extra_setting(). |
| 3252 | |
| 3253 | # |
| 3254 | parse_client_archi_settingscip-shell shell shell-project 0.0.0 parse_client_archi_setting(). |
| 3255 | |
| 3256 | # In Debian, the installer is apt. |
| 3257 | inst_prog="apt-get" |
| 3258 | inst_opt="-y $apt_extra_opt" |
| 3259 | inst_action="install" |
| 3260 | |
| 3261 | # 2. |
| 3262 | # It's important to remove the cache of apt, otherwise maybe something like |
| 3263 | # the RPM::Architecture will not take effect. check this: |
| 3264 | # http://distro2.conectiva.com.br/pipermail/apt-rpm/2003-November/002015.html |
| 3265 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3266 | echoscip-shell system . . echo. "$msg_clean_apt_cache" |
| 3267 | for ifile in /var/cache/apt/*.bin; do |
| 3268 | rmscip-shell system . . rm. -f /var/cache/apt/$ifile |
| 3269 | done |
| 3270 | |
| 3271 | # Update the apt data with repository. |
| 3272 | $inst_prog update |
| 3273 | |
| 3274 | # UGLY |
| 3275 | obsolete_pkgs="mkinitrd-net partimage-server knoppix-terminalserver" |
| 3276 | # mkinitrd-net is replaced by mkpxeinitrd-net in this version. Although |
| 3277 | # mkinitrd-net is set as one of the obsoletes in mkpxeinitrd-net.spec. |
| 3278 | # However, we use alien to convert drbl rpm to drbl deb, the obsolete is not |
| 3279 | # converted. |
| 3280 | # Same for partimage-server (The partimage released by DRBL containing partimaged), knoppix-terminalserver |
| 3281 | for i in $obsolete_pkgs; do |
| 3282 | if [scip-shell system . . `[`. -n "$(dpkgscip-shell system . . dpkg. -s $i 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -Ei "^Status: install ok installed")" ]; then |
| 3283 | dpkgscip-shell system . . dpkg. --purge $i |
| 3284 | fi |
| 3285 | done |
| 3286 | annoying_gnome_pkg="gnome-initial-setup" |
| 3287 | # We use YP for DRBL clients, so gnome-initial-setup is annoying and not required. |
| 3288 | for i in $annoying_gnome_pkg; do |
| 3289 | if [scip-shell system . . `[`. -n "$(dpkgscip-shell system . . dpkg. -s $i 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -Ei "^Status: install ok installed")" ]; then |
| 3290 | if [scip-shell system . . `[`. "$i" = "gnome-initial-setup" ]; then |
| 3291 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3292 | echoscip-shell system . . echo. "$msg_prompt_remove_gnome_initial_setup" |
| 3293 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3294 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 3295 | read |
| 3296 | fi |
| 3297 | echoscip-shell system . . echo. "Trying to remove package $i..." |
| 3298 | apt-getscip-shell system . . apt-get. purge $i |
| 3299 | echoscip-shell system . . echo. "Done." |
| 3300 | fi |
| 3301 | done |
| 3302 | |
| 3303 | # Shall We try to upgrade system first.? |
| 3304 | # Since there are many debian based distributions, it's might not be a good |
| 3305 | # idea to upgrade the system. So let user decided. |
| 3306 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3307 | if [scip-shell system . . `[`. -z "$upgrade_system_answer" ]; then |
| 3308 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3309 | echoscip-shell system . . echo. "$msg_upgrade_system_question" |
| 3310 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3311 | echoscip-shell system . . echo. -n "[y/N] " |
| 3312 | read upgrade_system_answer |
| 3313 | fi |
| 3314 | case "$upgrade_system_answer" in |
| 3315 | y|Y|[yY][eE][sS]) |
| 3316 | do_upgrade_system_for_DBNscip-shell shell shell-project 0.0.0 do_upgrade_system_for_DBN(). |
| 3317 | ;; |
| 3318 | esac |
| 3319 | |
| 3320 | # 3. |
| 3321 | # Install the necessary packages for DRBL |
| 3322 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3323 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3324 | echoscip-shell system . . echo. "$msg_install_DRBL_necesary_files" |
| 3325 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3326 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3327 | # package from Debian |
| 3328 | # mkinitrd is in initrd-tools |
| 3329 | # dos2unix is in sysutils |
| 3330 | # Supposed "udpcast" is put in the rpm spec's requirement of clonezilla. But |
| 3331 | # Alien fails to make that deps, so we add here. |
| 3332 | # We need gawk instead of mawk (the original awk) |
| 3333 | # $PKG_FROM_DBN, $PKG_TO_QUERY and $PKG_FROM_DRBL are loaded from conf/drbl.conf |
| 3334 | |
| 3335 | # Check if lvm2 is available, if so, add it, we need this for clonezilla to |
| 3336 | # save or restore LVM2 PV/VG/LV. |
| 3337 | PKG_ARCH="$(LC_ALL=C dpkgscip-shell system . . dpkg. --print-architecture)" |
| 3338 | |
| 3339 | # Check if any web server is already installed (Debian-based) |
| 3340 | web_server_installed="no" |
| 3341 | for ws in apache2 nginx lighttpd; do |
| 3342 | if chk_deb_installed "$ws"; then |
| 3343 | web_server_installed="yes" |
| 3344 | echoscip-shell system . . echo. "Found existing web server: $ws" |
| 3345 | break |
| 3346 | fi |
| 3347 | done |
| 3348 | |
| 3349 | if [scip-shell system . . `[`. "$web_server_installed" = "no" ]; then |
| 3350 | echoscip-shell system . . echo. "No web server (apache2, nginx, lighttpd) found. Adding lighttpd to installation list." |
| 3351 | PKG_TO_QUERY="$PKG_TO_QUERY lighttpd" |
| 3352 | fi |
| 3353 | |
| 3354 | echoscip-shell system . . echo. "Searching if the following packages with arch $PKG_ARCH available in the repository: $PKG_TO_QUERY ..." |
| 3355 | kea_available="no" |
| 3356 | if [scip-shell system . . `[`. -n "$(LC_ALL=C aptscip-shell system . . apt. list "kea-dhcp4-server" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -Ew "($PKG_ARCH|all)")" ]; then |
| 3357 | kea_available="yes" |
| 3358 | fi |
| 3359 | |
| 3360 | for ipkg in $PKG_TO_QUERY; do |
| 3361 | if [scip-shell system . . `[`. "$kea_available" = "yes" ]; then |
| 3362 | if [scip-shell system . . `[`. "$ipkg" = "isc-dhcp-server" ] || [scip-shell system . . `[`. "$ipkg" = "dhcp3-server" ]; then |
| 3363 | echoscip-shell system . . echo. "Skipping legacy $ipkg since kea-dhcp4-server is preferred and available." |
| 3364 | continue |
| 3365 | fi |
| 3366 | fi |
| 3367 | |
| 3368 | if [scip-shell system . . `[`. -n "$(LC_ALL=C aptscip-shell system . . apt. list "$ipkg" 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -Ew "($PKG_ARCH|all)")" ]; then |
| 3369 | echoscip-shell system . . echo. "Found $ipkg." |
| 3370 | PKG_FROM_DBN="$PKG_FROM_DBN $ipkg" |
| 3371 | fi |
| 3372 | done |
| 3373 | # Detect if discover/discover1 is installed or not, if installed, |
| 3374 | # do not install it. If not, we need discover (not discover1) for clients. |
| 3375 | # The package name "discover" exists both in woody and sarge. |
| 3376 | # The reason we have to check is that we prefer to keep the installed package, maybe discover or discover1. |
| 3377 | if ! chk_deb_installed discover && ! chk_deb_installed discover1; then |
| 3378 | PKG_FROM_DBN="$PKG_FROM_DBN discover" |
| 3379 | fi |
| 3380 | # For Breezy, Etch, udev is necessary ? not hotplug ? udev and hotplug conflict.# For Breezy, Etch, we just won't touch the server, if hotplug is unstalled (breezy), ust that, if udev is installed (ethc), use that. |
| 3381 | case "$OS_Version" in |
| 3382 | DBN3.1|DBN3.0) |
| 3383 | # Genuine Debian sarge/woody |
| 3384 | PKG_FROM_DBN="$PKG_FROM_DBN hotplug" |
| 3385 | ;; |
| 3386 | esac |
| 3387 | |
| 3388 | # For Ubuntu 9.10, xz-utils conflicts with lzma, and lzma is essential |
| 3389 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "Ubuntu" -a "$DISTRIB_RELEASE" = "9.10" ]; then |
| 3390 | if [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $PKG_FROM_DBN | grepscip-shell system . . grep. -Ew "lzma")" -a \ |
| 3391 | -n "$(echoscip-shell system . . echo. $PKG_FROM_DBN | grepscip-shell system . . grep. -Ew "xz-utils")" ]; then |
| 3392 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3393 | echoscip-shell system . . echo. "In Ubuntu 9.10, xz-utils conflicts with lzma, and lzma is essential. Exclude installing xz-utils!" |
| 3394 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3395 | PKG_FROM_DBN="$(echoscip-shell system . . echo. $PKG_FROM_DBN | sedscip-shell system . . sed. -e "s/xz-utils//g")" |
| 3396 | fi |
| 3397 | fi |
| 3398 | |
| 3399 | # For Ubuntu 14.04 or Debian Wheezy, there is no package "init" because it still uses upstart. |
| 3400 | # Remove it from list. |
| 3401 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "Ubuntu" -a "$DISTRIB_RELEASE" = "14.04" ] || |
| 3402 | [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. "$OS_Version" | grepscip-shell system . . grep. -Ew "DBN7.*")" ] ; then |
| 3403 | PKG_FROM_DBN="$(echoscip-shell system . . echo. $PKG_FROM_DBN | sedscip-shell system . . sed. -r -e "s/\<init\>//g")" |
| 3404 | fi |
| 3405 | |
| 3406 | # From ntfs-3g 1:2011.4.12AR.4-2, it will provide all the files of ntfsprogs. |
| 3407 | # Package: ntfs-3g |
| 3408 | # Version: 1:2011.4.12AR.4-2 |
| 3409 | # Installed-Size: 1492 |
| 3410 | # Maintainer: Daniel Baumann <[email protected]> |
| 3411 | # Architecture: i386 |
| 3412 | # Replaces: libntfs-3g75, libntfs-3g804, ntfsprogs |
| 3413 | # Provides: ntfsprogs |
| 3414 | # Therefore we do not have to install ntfsprogs. Otherwise we should. |
| 3415 | # 2012/10/17, ntfs-3g package info does not show "Provides: ntfsprogs" on Debian Sid, therefore we have to check if it exists on repository before adding it to PKG_FROM_DBN. |
| 3416 | if [scip-shell system . . `[`. -z "$(LC_ALL=C apt-cachescip-shell system . . apt-cache. show ntfs-3g | grepscip-shell system . . grep. -E "^Provides:.*ntfsprogs")" -a \ |
| 3417 | -n "$(LC_ALL=C apt-cachescip-shell system . . apt-cache. search ntfsprogs | grepscip-shell system . . grep. -Ew "^ntfsprogs")" ]; then |
| 3418 | echoscip-shell system . . echo. "Package ntfs-3g does not provide the files of old package ntfsprogs, so ntfsprogs will be installed." |
| 3419 | PKG_FROM_DBN="$PKG_FROM_DBN ntfsprogs" |
| 3420 | fi |
| 3421 | |
| 3422 | # package from DRBL, |
| 3423 | # $PKG_FROM_DRBL will be loaded from conf/drbl.conf |
| 3424 | |
| 3425 | # We need to preconfig some packages, such as dhcp3-server, tftpd-hpa, nis so |
| 3426 | # it will not ask user to configure. We will configure later in drblpush. |
| 3427 | deb_preconf_opt="" |
| 3428 | # Older Debian's package nis does not include file /etc/default/nis, we need to ask drbl-deb-preconf to generate that file. While Debian >=11, it's included. |
| 3429 | # For Ubuntu, Focal (20.04) and Groovy (20.10) use NIS version 3, no /etc/default/nis. While Ubuntu >=21, it's included. |
| 3430 | [scip-shell system . . `[`. -e /etc/lsb-releasescip-shell filesystem . . `/etc/lsb-release`. ] && . /etc/lsb-releasescip-shell source . . `/etc/lsb-release`. |
| 3431 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "Ubuntu" ]; then |
| 3432 | case "$DISTRIB_RELEASE" in |
| 3433 | 20.*) deb_preconf_opt="-s";; |
| 3434 | esac |
| 3435 | else |
| 3436 | case "$OS_Version" in |
| 3437 | DBN10.*|DBN9.*) deb_preconf_opt="-s";; |
| 3438 | esac |
| 3439 | fi |
| 3440 | drbl-deb-preconf $deb_preconf_opt |
| 3441 | |
| 3442 | # Install them |
| 3443 | $inst_prog $inst_opt $inst_action $PKG_FROM_DBN $PKG_FROM_DRBL |
| 3444 | rc_apt="$?" |
| 3445 | if [scip-shell system . . `[`. "$rc_apt" -gt 0 ]; then |
| 3446 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3447 | echoscip-shell system . . echo. "$msg_some_necessary_pkgs_not_installed" |
| 3448 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3449 | echoscip-shell system . . echo. -n "$msg_press_ctrl_c_stop Or $msg_press_enter_to_continue " |
| 3450 | read |
| 3451 | fi |
| 3452 | |
| 3453 | # |
| 3454 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3455 | # 4. dev for client machines |
| 3456 | # For Debian woody & B2D pureKDE20050603..It's necessary to make one before run |
| 3457 | # this... (Just create the tarball from some Debian machine) |
| 3458 | # It's ugly here... |
| 3459 | # The solution: Make udev as the 1st priority |
| 3460 | [scip-shell system . . `[`. ! -d $drbl_pkgdir ] && mkdirscip-shell system . . mkdir. -p $drbl_pkgdir |
| 3461 | |
| 3462 | # try to install udev... |
| 3463 | if ! chk_deb_installed udev; then |
| 3464 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3465 | echoscip-shell system . . echo. "Try to install udev..." |
| 3466 | $inst_prog $inst_opt $inst_action udev &>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 3467 | fi |
| 3468 | if ! chk_deb_installed udev; then |
| 3469 | # udev is not available, use tarball |
| 3470 | if [scip-shell system . . `[`. -f $drbl_setup_path/files/${OS_type}/${OS_Version}/dev.$OS_Version.tgz ]; then |
| 3471 | echoscip-shell system . . echo. "Udev is not available, use pre-packaged device files." |
| 3472 | cpscip-shell system . . cp. -f $drbl_setup_path/files/${OS_type}/${OS_Version}/dev.$OS_Version.tgz $drbl_pkgdir/dev.tgz |
| 3473 | else |
| 3474 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3475 | echoscip-shell system . . echo. "No udev, and no pre-packaged device files!" |
| 3476 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3477 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3478 | exit 1 |
| 3479 | fi |
| 3480 | fi |
| 3481 | |
| 3482 | # 5. |
| 3483 | # ugly...might be not my fault... |
| 3484 | # for some distribution some version, we have to force upgrading some packages. |
| 3485 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3486 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3487 | echoscip-shell system . . echo. "$msg_try_to_update_some_pkgs" |
| 3488 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3489 | case "$OS_Version" in |
| 3490 | DBN3.0) |
| 3491 | # We need "grep -o", and the grep in woody does not have that option. |
| 3492 | # so use the one from backports. |
| 3493 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 3494 | echoscip-shell system . . echo. "$msg_force_to_upgrade_some_pkgs" |
| 3495 | apt-getscip-shell system . . apt-get. $inst_opt $inst_action grep |
| 3496 | ;; |
| 3497 | esac |
| 3498 | |
| 3499 | # 6. |
| 3500 | # netinstall |
| 3501 | if [scip-shell system . . `[`. "$DRBL_NETINSTALL" = "yes" ]; then |
| 3502 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3503 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 3504 | echoscip-shell system . . echo. "$msg_install_net_install_images" |
| 3505 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3506 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3507 | drbl-netinstall -i all -s -v |
| 3508 | fi |
| 3509 | |
| 3510 | # 7. |
| 3511 | # Force to install all the kernel selected. |
| 3512 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3513 | echoscip-shell system . . echo. "$msg_search_kernel_in_ayo ${SMP_OPTION:1} kernel ..." |
| 3514 | |
| 3515 | # Install the kernel |
| 3516 | # Note! This must be done after gawk is installed, since we need gawk to parse |
| 3517 | # the latest kernel. |
| 3518 | if [scip-shell system . . `[`. "$client_archi_set" = "best_optimization" ]; then |
| 3519 | # same CPU archi with server, maybe for i686, or i386 (for AMD K7 ?) |
| 3520 | KARCH_LIST="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 3521 | # KARCH_LIST will be nothing if we can not find the kernel config file, so we choose to use the same arch of server for client. |
| 3522 | [scip-shell system . . `[`. -z "$KARCH_LIST" ] && KARCH_LIST="$(unamescip-shell system . . uname. -m)" |
| 3523 | # convert the arch name from server to client, |
| 3524 | # This is the lists for Debian Sarge: |
| 3525 | # ----------------------------------------------- |
| 3526 | # kernel-image-2.6.8-3-686-smp 2.6.8-16sarge2 |
| 3527 | # kernel-image-2.6.8-3-686 2.6.8-16sarge2 |
| 3528 | # kernel-image-2.6.8-3-386 2.6.8-16sarge2 |
| 3529 | # kernel-image-2.6.8-2-k7-smp 2.6.8-16sarge1 |
| 3530 | # kernel-image-2.6.8-2-k7 2.6.8-16sarge1 |
| 3531 | # kernel-image-2.6.8-12-em64t-p4-smp 2.6.8-16sarge2 |
| 3532 | # kernel-image-2.6.8-12-em64t-p4 2.6.8-16sarge2 |
| 3533 | # kernel-image-2.6.8-12-amd64-k8-smp 2.6.8-16sarge2 |
| 3534 | # kernel-image-2.6.8-12-amd64-k8 2.6.8-16sarge2 |
| 3535 | # kernel-image-2.6.8-12-amd64-generic 2.6.8-16sarge2 |
| 3536 | # kernel-image-2.6.8-11-em64t-p4-smp 2.6.8-16sarge1 |
| 3537 | # kernel-image-2.6.8-11-em64t-p4 2.6.8-16sarge1 |
| 3538 | # kernel-image-2.6.8-11-amd64-k8-smp 2.6.8-16sarge1 |
| 3539 | # kernel-image-2.6.8-11-amd64-k8 2.6.8-16sarge1 |
| 3540 | # kernel-image-2.6.8-11-amd64-generic 2.6.8-16sarge1 |
| 3541 | # ----------------------------------------------- |
| 3542 | # i386/i486/i586 -> i686 since only i686-smp and k7-smp exists in Debian |
| 3543 | # For k7, keep what it is. |
| 3544 | # If found nothing, let KARCH_LIST=i686 |
| 3545 | # TODO: How about em64t ? Can drbl-check-kernel-cpu-arch show correct messages ? |
| 3546 | # ----------------------------------------------- |
| 3547 | # Updated on 2006/10/28, for Ubuntu 6.10, there is no name tag for 686 or amd64-k8, they are like: |
| 3548 | # ----------------------------------------------- |
| 3549 | # linux-image-2.6.17-10-386_2.6.17-10.33_i386.deb |
| 3550 | # linux-image-2.6.17-10-generic_2.6.17-10.33_amd64.deb |
| 3551 | # linux-image-2.6.17-10-generic_2.6.17-10.33_i386.deb |
| 3552 | # linux-image-2.6.17-10-powerpc-smp_2.6.17-10.33_powerpc.deb |
| 3553 | # linux-image-2.6.17-10-powerpc64-smp_2.6.17-10.33_powerpc.deb |
| 3554 | # linux-image-2.6.17-10-powerpc_2.6.17-10.33_powerpc.deb |
| 3555 | # linux-image-2.6.17-10-server-bigiron_2.6.17-10.33_i386.deb |
| 3556 | # linux-image-2.6.17-10-server_2.6.17-10.33_amd64.deb |
| 3557 | # linux-image-2.6.17-10-server_2.6.17-10.33_i386.deb |
| 3558 | # linux-image-2.6.17-10-sparc64-smp_2.6.17-10.33_sparc.deb |
| 3559 | # ----------------------------------------------- |
| 3560 | # and "apt-cache pkgnames linux-image | grep -E "^linux-image-[0-9]+\.[0-9]+\.[0-9]+" | sort" will give: |
| 3561 | # linux-image-2.6.15-23-386 <-- forget the stale one |
| 3562 | # linux-image-2.6.15-23-686 <-- forget the stale one |
| 3563 | # linux-image-2.6.15-23-k7 <-- forget the stale one |
| 3564 | # linux-image-2.6.15-27-686 <-- forget the stale one |
| 3565 | # linux-image-2.6.17-10-386 |
| 3566 | # linux-image-2.6.17-10-generic |
| 3567 | # linux-image-2.6.17-10-server |
| 3568 | # linux-image-2.6.17-10-server-bigiron |
| 3569 | # Hence now basically only linux-image-2.6.17-10-386 (for i386) or linux-image-2.6.17-10-generic (for i586/686) |
| 3570 | # ----------------------------------------------- |
| 3571 | # However, for Debian etch in testing (on 2006/10/28), it's like: |
| 3572 | # linux-image-2.6-486_2.6.18+3_i386.deb |
| 3573 | # linux-image-2.6-686-bigmem_2.6.18+3_i386.deb |
| 3574 | # linux-image-2.6-686-smp_2.6.18+3_i386.deb |
| 3575 | # linux-image-2.6-686_2.6.18+3_i386.deb |
| 3576 | # linux-image-2.6-alpha-generic_2.6.18+3_alpha.deb |
| 3577 | # linux-image-2.6-alpha-legacy_2.6.18+3_alpha.deb |
| 3578 | # linux-image-2.6-alpha-smp_2.6.18+3_alpha.deb |
| 3579 | # linux-image-2.6-amd64-generic_2.6.18+3_amd64.deb |
| 3580 | # linux-image-2.6-amd64-k8-smp_2.6.18+3_amd64.deb |
| 3581 | # linux-image-2.6-amd64-k8_2.6.18+3_amd64.deb |
| 3582 | # linux-image-2.6-amd64_2.6.18+3_amd64.deb |
| 3583 | # linux-image-2.6-em64t-p4-smp_2.6.18+3_amd64.deb |
| 3584 | # linux-image-2.6-em64t-p4_2.6.18+3_amd64.deb |
| 3585 | case "$KARCH_LIST" in |
| 3586 | arm64|aarch64) |
| 3587 | KARCH_LIST="arm64" |
| 3588 | client_archi=${KARCH_LIST} |
| 3589 | ;; |
| 3590 | *) |
| 3591 | KARCH_LIST="amd64" |
| 3592 | client_archi=${KARCH_LIST} |
| 3593 | ;; |
| 3594 | esac |
| 3595 | # UGLY! Any better method ? |
| 3596 | # For Ubuntu 6.10 or later, there is no name tag for 686 or amd64-k8, |
| 3597 | # it's generic, for earlier version, it uses 386, 686 or amd64-k8 |
| 3598 | # We will not use this for Debian etch. |
| 3599 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "Ubuntu" ]; then |
| 3600 | case "$client_archi" in |
| 3601 | arm64|aarch64) |
| 3602 | # E.g., linux-image-6.17.0-1018-nvidia or linux-image-6.17.0-1018-nvidia-64k |
| 3603 | echoscip-shell system . . echo. "The kernel image in Ubuntu $DISTRIB_RELEASE \"uses generic\" for ARM64 CPU." |
| 3604 | KARCH_LIST="nvidia" |
| 3605 | client_archi="nvidia" |
| 3606 | ;; |
| 3607 | amd64) |
| 3608 | echoscip-shell system . . echo. "The kernel image in Ubuntu $DISTRIB_RELEASE \"uses generic\" for amd64/x86-64 CPU." |
| 3609 | KARCH_LIST="generic" |
| 3610 | client_archi="generic" |
| 3611 | ;; |
| 3612 | esac |
| 3613 | fi |
| 3614 | # For Linux Mint, by Ceasar Sun |
| 3615 | if [scip-shell system . . `[`. "$DISTRIB_ID" = "LinuxMint" -a -z "$(echoscip-shell system . . echo. "$DISTRIB_DESCRIPTION" | grepscip-shell system . . grep. -iE '^LMDE')" ]; then |
| 3616 | # LinuxMint follow Ubuntu policy exclude LMDE |
| 3617 | echoscip-shell system . . echo. "The kernel image in Ubuntu $DISTRIB_RELEASE \"uses generic\" for amd64 CPU." |
| 3618 | KARCH_LIST="generic" |
| 3619 | client_archi="generic" |
| 3620 | fi |
| 3621 | fi |
| 3622 | cpu_filter="grep -iE $client_archi" |
| 3623 | |
| 3624 | if [scip-shell system . . `[`. -n "$SMP_OPTION" ]; then |
| 3625 | # enable SMP filter |
| 3626 | smp_filter="grep -i smp" |
| 3627 | else |
| 3628 | # "NOT SMP" filter |
| 3629 | smp_filter="grep -iv smp" |
| 3630 | fi |
| 3631 | |
| 3632 | # This is for Debian etch, to make thing easier, we exclude some kernel |
| 3633 | # linux-image-2.6.17-2-486 |
| 3634 | # linux-image-2.6.17-2-686 |
| 3635 | # linux-image-2.6.17-2-686-bigmem <-- |
| 3636 | # linux-image-2.6.17-2-k7 |
| 3637 | # linux-image-2.6.17-2-vserver-686 <-- |
| 3638 | # linux-image-2.6.17-2-vserver-k7 <-- |
| 3639 | # linux-image-2.6.17-2-xen-686 <-- |
| 3640 | # linux-image-2.6.17-2-xen-k7 <-- |
| 3641 | # For Lenny, openvz: |
| 3642 | # linux-image-2.6.26-2-openvz-686 <-- |
| 3643 | # i.e. exclude: xen, vserver, openvz, rt, dbg... |
| 3644 | # drbl_client_debian_exclude_kernels is from drbl.conf. |
| 3645 | seldom_kernel_filter="grep -E -v -- $drbl_client_debian_exclude_kernels" |
| 3646 | |
| 3647 | # Ugly!!! |
| 3648 | # There is no SMP tag kernel image from Ubuntu Dapper (6.06), so we force to set not smp |
| 3649 | # Actually this is useless, since in ask_and_parse_client_extra_setting(), for DBN-TU, we will not ask SMP or not. Therefore maybe we should remove this! |
| 3650 | if [scip-shell system . . `[`. -n "$SMP_OPTION" -a "$DISTRIB_ID" = "Ubuntu" ]; then |
| 3651 | if [scip-shell system . . `[`. "$DISTRIB_RELEASE" != "5.10" ]; then |
| 3652 | echoscip-shell system . . echo. "Since all the kernel images in Ubuntu $DISTRIB_RELEASE support SMP, we do not have to specify the kernel with SMP tag for clients." |
| 3653 | smp_filter="grep -iv smp" |
| 3654 | fi |
| 3655 | fi |
| 3656 | |
| 3657 | # The kernel image name: linux-iamge (such as Etch) or kernel-image (such as Sarge) |
| 3658 | # Kernel package name before (<=) Debian Wheezy (7.0) is like: linux-image-3.2.0-4-amd64 |
| 3659 | # While for >= Debian jessie (8.0) is like: linux-image-3.8-1-amd64 |
| 3660 | # For Debian >= 13 (Trixie), it's like: 6.12.43+deb13-amd64 |
| 3661 | for ikmg in linux-image kernel-image; do |
| 3662 | latest_drbl_kernel_in_rep="$(apt-cachescip-shell system . . apt-cache. pkgnames $ikmg | grepscip-shell system . . grep. -E "$ikmg-[0-9\.]+([-_+][0-9a-zA-Z]+)?" |\ |
| 3663 | $cpu_filter | $smp_filter | $seldom_kernel_filter | pkg-ver-latest)" |
| 3664 | if [scip-shell system . . `[`. -n "$latest_drbl_kernel_in_rep" ]; then |
| 3665 | kernel_img_name="$ikmg" |
| 3666 | break |
| 3667 | fi |
| 3668 | done |
| 3669 | echoscip-shell system . . echo. "$msg_latest_kernel_in_ayo $latest_drbl_kernel_in_rep" |
| 3670 | |
| 3671 | # Get the selected kernel arch (i686/i386/i486) |
| 3672 | # Ex: |
| 3673 | # linux-image-2.6.12-10-686 -> 686 |
| 3674 | # linux-image-2.6.12-10-686-smp -> 686 |
| 3675 | # linux-image-2.6.12-10-amd64-xeon -> x86_64 |
| 3676 | # linux-image-2.6.12-10-amd64-k8-smp -> x86_64 |
| 3677 | # linux-image-2.6.12-10-amd64-k8 -> x86_64 |
| 3678 | # linux-image-2.6.12-10-amd64-generic -> x86_64 |
| 3679 | # For Etch or Dapper, there is an issue in Dapper, check |
| 3680 | # https://lists.ubuntu.com/archives/ubuntu-devel/2006-May/018185.html |
| 3681 | # for more details. |
| 3682 | # linux-image-2.6.16-1-486_2.6.16-12_i386.deb (Etch) -> 486, there is a "486", not "386", to show this is for i486 arch. |
| 3683 | # linux-image-2.6.15-23-386_2.6.15-23.39_i386.deb (Dapper beta) -> the name implies 386, but actually it's 486... Ha... |
| 3684 | case "$latest_drbl_kernel_in_rep" in |
| 3685 | *-[0-9]86*) |
| 3686 | KARCH="$(echoscip-shell system . . echo. $latest_drbl_kernel_in_rep | sedscip-shell system . . sed. -e "s/.*-\([0-9]86\).*$/i\1/" | sedscip-shell system . . sed. -e "s/-smp//g")" |
| 3687 | ;; |
| 3688 | *-amd64-*|*-em64t-*) |
| 3689 | KARCH=x86_64 |
| 3690 | ;; |
| 3691 | esac |
| 3692 | |
| 3693 | # UGLY!!! For Ubuntu Dapper, about the issue mentioned above, we have to use the ugly rule! Since although the name is 386, but actually it's 486. |
| 3694 | # Actually from Ubuntu dapper (6.06) or later (not only 6.06), as mentioned above, the kernel image name is like linux-headers-2.6.20-12_2.6.20-12.20_i386.deb (7.04 still), but actually it's 486 (CONFIG_M486=y) |
| 3695 | # Maybe it will change in the future... |
| 3696 | if [scip-shell system . . `[`. "$KARCH" = "i386" -a \ |
| 3697 | "$DISTRIB_ID" = "Ubuntu" -a \ |
| 3698 | "$DISTRIB_RELEASE" != "5.10" ] |
| 3699 | then |
| 3700 | KARCH="i486" |
| 3701 | fi |
| 3702 | |
| 3703 | # Another available kernel maybe is from server, check it: |
| 3704 | running_karch="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 3705 | running_kernel_in_server="$(echoscip-shell system . . echo. $(unamescip-shell system . . uname. -r) $running_karch | $cpu_filter | $smp_filter)" |
| 3706 | |
| 3707 | use_kernel_from= |
| 3708 | if [scip-shell system . . `[`. -n "$running_kernel_in_server" ]; then |
| 3709 | # Server running kernel matches client's requirement |
| 3710 | if [scip-shell system . . `[`. -z "$chosen_client_kernel_from" ]; then |
| 3711 | echoscip-shell system . . echo. "$msg_2_kernel_availables" |
| 3712 | echoscip-shell system . . echo. "[1]: kernel $running_kernel_in_server ($msg_from_this_drbl_server)" |
| 3713 | echoscip-shell system . . echo. "[2]: $latest_drbl_kernel_in_rep ($msg_from_apt_repository)" |
| 3714 | echoscip-shell system . . echo. -n "[1] " |
| 3715 | read chosen_client_kernel_from |
| 3716 | fi |
| 3717 | case "$chosen_client_kernel_from" in |
| 3718 | 2) |
| 3719 | echoscip-shell system . . echo. "Clients will use the kernel $latest_drbl_kernel_in_rep from apt repository." |
| 3720 | use_kernel_from="apt-repository" |
| 3721 | ;; |
| 3722 | *) |
| 3723 | echoscip-shell system . . echo. "Clients will use the kernel $running_kernel_in_server from server." |
| 3724 | use_kernel_from="local" |
| 3725 | ;; |
| 3726 | esac |
| 3727 | else |
| 3728 | # Use the kernel in the repository |
| 3729 | echoscip-shell system . . echo. "Use the kernel $latest_drbl_kernel_in_rep from apt repository!" |
| 3730 | use_kernel_from="apt-repository" |
| 3731 | fi |
| 3732 | |
| 3733 | rc_install_kernel=1 |
| 3734 | case "$use_kernel_from" in |
| 3735 | "apt-repository") |
| 3736 | # use with client_kernel_install_mode and client_kernel_tmp_dir |
| 3737 | client_kernel_install_mode="from_downloaded_pkg" |
| 3738 | |
| 3739 | # get the version and release of kernel, strip the kernel[#-] or kernel-smp[#-] |
| 3740 | # $drbl_kernel_ver will be like "2.6.8-2-386", "2.6.8-2-686", or "2.6.8-2-686-smp" |
| 3741 | drbl_kernel_ver="$(echoscip-shell system . . echo. $latest_drbl_kernel_in_rep | sedscip-shell system . . sed. -e s/$kernel_img_name-//g)" |
| 3742 | if [scip-shell system . . `[`. -z "$drbl_kernel_ver" ]; then |
| 3743 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3744 | echoscip-shell system . . echo. "Linux kernel $kernel_img_name not available!" |
| 3745 | echoscip-shell system . . echo. "You can run this program $0 again, and try to choose different CPU architecture (such as i386, i686, no SMP...)!" |
| 3746 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3747 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3748 | exit 1 |
| 3749 | fi |
| 3750 | |
| 3751 | # download it |
| 3752 | apt-getscip-shell system . . apt-get. $inst_opt --reinstall --download-only install $latest_drbl_kernel_in_rep |
| 3753 | rc_get_kernel=$? |
| 3754 | if [scip-shell system . . `[`. $rc_get_kernel -gt 0 ]; then |
| 3755 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3756 | echoscip-shell system . . echo. "Failed to download $latest_drbl_kernel_in_rep." |
| 3757 | echoscip-shell system . . echo. "Maybe you should check /etc/apt/sources.list or remove the unnecessary kernel block in /var/lib/dpkg/status so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." |
| 3758 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3759 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3760 | exit 1 |
| 3761 | fi |
| 3762 | # Download the restricted modules for Ubuntu, here we assume if server use that, then client should use that. |
| 3763 | drblsrv_offline_extra_opt="" |
| 3764 | if [scip-shell system . . `[`. -x /etc/init.d/linux-restricted-modules-commonscip-shell filesystem . . `/etc/init.d/linux-restricted-modules-common`. ]; then |
| 3765 | apt-getscip-shell system . . apt-get. $inst_opt --reinstall --download-only install linux-restricted-modules-$drbl_kernel_ver |
| 3766 | # find the restricted kernel |
| 3767 | # The "_" is important, since the file names in the cache dir are like |
| 3768 | # linux-restricted-modules-2.6.17-10-386_2.6.17.5-11_i386.deb |
| 3769 | # linux-restricted-modules-2.6.17-10-generic_2.6.17.5-11_i386.deb |
| 3770 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. /var/cache/apt/archives/linux-restricted-modules-${drbl_kernel_ver}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 3771 | latest_drbl_restricted_kernel_in_rep_deb="$(unalias ls 2>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. /var/cache/apt/archives/linux-restricted-modules-${drbl_kernel_ver}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`. | pkg-ver-latest)" |
| 3772 | drblsrv_offline_extra_opt="$drblsrv_offline_extra_opt -e $latest_drbl_restricted_kernel_in_rep_deb" |
| 3773 | fi |
| 3774 | fi |
| 3775 | |
| 3776 | # Download the linux-image-extra package from Ubuntu. This is for Ubuntu 12.04 or later (12.10, 13.04...) |
| 3777 | # Ref: https://lists.ubuntu.com/archives/kernel-team/2012-May/020448.html |
| 3778 | # Older Ubuntu linux (12.04-17.10) use linux-image-extra |
| 3779 | # Newer Ubuntu linux (>=18.04) use linux-modules and linux-modules-extra |
| 3780 | kernel_mod_extra_prefix_list="linux-modules linux-modules-extra linux-image-extra" |
| 3781 | for ik in $kernel_mod_extra_prefix_list; do |
| 3782 | if [scip-shell system . . `[`. -n "$(apt-cachescip-shell system . . apt-cache. search ${ik}-$drbl_kernel_ver)" ]; then |
| 3783 | apt-getscip-shell system . . apt-get. $inst_opt --reinstall --download-only install ${ik}-$drbl_kernel_ver |
| 3784 | # find the ubuntu kernel |
| 3785 | # The "_" is important, since the file names in the cache dir are like |
| 3786 | # linux-image-extra-3.5.0-17-generic_3.5.0-17.28_i386.deb |
| 3787 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. /var/cache/apt/archives/${ik}-${drbl_kernel_ver}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 3788 | latest_drbl_ubuntu_kernel_in_rep_deb="$(unalias ls 2>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. /var/cache/apt/archives/${ik}-${drbl_kernel_ver}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`. | pkg-ver-latest)" |
| 3789 | drblsrv_offline_extra_opt="$drblsrv_offline_extra_opt -e $latest_drbl_ubuntu_kernel_in_rep_deb" |
| 3790 | fi |
| 3791 | fi |
| 3792 | done |
| 3793 | |
| 3794 | # The "_" is important, since the file names in the cache dir are like |
| 3795 | # kernel-image-2.6.8-2-386_2.6.8-16_i386.deb, |
| 3796 | # kernel-image-2.6.8-2-686_2.6.8-16_i386.deb, |
| 3797 | # kernel-image-2.6.8-2-686-smp_2.6.8-16_i386.deb |
| 3798 | if [scip-shell system . . `[`. -n "$(unalias ls 2>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. /var/cache/apt/archives/${latest_drbl_kernel_in_rep}_*.deb 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 3799 | client_kernel_tmp_dir="/var/cache/apt/archivesscip-shell filesystem . . `/var/cache/apt/archives`." |
| 3800 | fi |
| 3801 | ;; |
| 3802 | "local") |
| 3803 | echoscip-shell system . . echo. "$msg_install_kernel_might_take_several_minutes" |
| 3804 | drbl_kernel_ver="$(unamescip-shell system . . uname. -r)" |
| 3805 | # Since local is chosen, here we force to use the KARCH from the server, otherwise maybe the kernel in the repository has different CPU arch. |
| 3806 | # KARCH="$running_karch" |
| 3807 | |
| 3808 | client_kernel_install_mode="from_server" |
| 3809 | client_kernel_ver="$drbl_kernel_ver" |
| 3810 | echoscip-shell system . . echo. "$msg_done!" |
| 3811 | ;; |
| 3812 | esac |
| 3813 | |
| 3814 | # 8. |
| 3815 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3816 | # Force to install all the kernel selected. |
| 3817 | echoscip-shell system . . echo. "$msg_install_kernel_for_clients ..." |
| 3818 | echoscip-shell system . . echo. "$msg_search_kernel_in_ayo kernel${SMP_OPTION} ..." |
| 3819 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3820 | run_drblsrv_offlinescip-shell shell shell-project 0.0.0 run_drblsrv_offline(). |
| 3821 | |
| 3822 | } # end of install_drbl_DBN |
| 3823 | |
| 3824 | # |
| 3825 | install_drbl_SUSEscip-shell shell shell-project 0.0.0 install_drbl_SUSE().() { |
| 3826 | # function to install SuSE Linux |
| 3827 | # Now the installer is only apt, maybe someday we will find a way to use yast. |
| 3828 | # Note: Here we use apt instead of "apt-get" since apt can accept "--no-checksig" |
| 3829 | case "$installer" in |
| 3830 | "yum") |
| 3831 | inst_prog="yum" |
| 3832 | inst_opt="-y" |
| 3833 | inst_action="install" |
| 3834 | ;; |
| 3835 | "zypper") |
| 3836 | # zypper [--global-opts] <command> [--command-opts] [command-arguments] |
| 3837 | # E.g. zypper --non-interactive install foo |
| 3838 | # --non-interactive (or -n) is in --global-opts |
| 3839 | inst_prog="zypper" |
| 3840 | inst_opt="-n" |
| 3841 | inst_action="install" |
| 3842 | ;; |
| 3843 | *) |
| 3844 | # Default is apt |
| 3845 | inst_prog="apt" |
| 3846 | inst_opt="-y --no-checksig $apt_extra_opt" |
| 3847 | inst_action="install" |
| 3848 | ;; |
| 3849 | esac |
| 3850 | |
| 3851 | # Check the running kernel |
| 3852 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3853 | # ugly...might be not my fault... |
| 3854 | # for some distribution some version, we have to force upgrading some packages. |
| 3855 | |
| 3856 | # SuSE/OpenSuSE 10.0 with kernel 2.6.13-15-default is BUGGY |
| 3857 | # in DRBL server!!! Since it's a kernel upgrade, we wont' do that for |
| 3858 | # user, just prompt them |
| 3859 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -r)" = "2.6.13-15-default" ]; then |
| 3860 | echoscip-shell system . . echo. "$msg_OS_version: $OS_Version." |
| 3861 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3862 | echoscip-shell system . . echo. "$msg_kernel_2_6_13_15_defaul_is_buggy." |
| 3863 | echoscip-shell system . . echo. "$msg_u_have_to_upgrade_kernel_in_this_machine" |
| 3864 | case "$ARCH" in |
| 3865 | i386) |
| 3866 | echoscip-shell system . . echo. "rpm -ivh http://free.nchc.org.tw/SuSE/SuSE/i386/update/10.0/rpm/i586/kernel-default-2.6.13-15.7.i586.rpm" |
| 3867 | ;; |
| 3868 | x86_64) |
| 3869 | echoscip-shell system . . echo. "rpm -ivh http://free.nchc.org.tw/SuSE/SuSE/i386/update/10.0/rpm/x86_64/kernel-default-2.6.13-15.7.x86_64.rpm" |
| 3870 | ;; |
| 3871 | esac |
| 3872 | echoscip-shell system . . echo. "$msg_then_reboot_this_server" |
| 3873 | echoscip-shell system . . echo. "Ref: https://bugzilla.novell.com/show_bug.cgi?id=128784" |
| 3874 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3875 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3876 | exit 1 |
| 3877 | fi |
| 3878 | |
| 3879 | # check if installer exists |
| 3880 | if [scip-shell system . . `[`. "$installer" = "apt" ] && ! rpm -q apt &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 3881 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3882 | echoscip-shell system . . echo. "You must install apt4rpm first in this SuSE server!" |
| 3883 | echoscip-shell system . . echo. "Check http://linux01.gwdg.de/apt4rpm for more details!" |
| 3884 | echoscip-shell system . . echo. "Or run 'rpm -Uvh http://linux01.gwdg.de/~scorot/install-apt4suse.rpm', then run install-apt4suse to setup it." |
| 3885 | echoscip-shell system . . echo. "Remeber to add the following line in /etc/apt/sources.list" |
| 3886 | echoscip-shell system . . echo. "rpm http://free.nchc.org.tw/drbl-core i386 drbl-unstable drbl-testing drbl-stable" |
| 3887 | echoscip-shell system . . echo. "Note: drbl-unstable or drbl-testing is optional, use at your own risk!" |
| 3888 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3889 | exit 1 |
| 3890 | fi |
| 3891 | if [scip-shell system . . `[`. "$installer" = "yum" ] && ! rpm -q yum &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 3892 | # From SuSE 10.0, yum is available |
| 3893 | if [scip-shell system . . `[`. "$OS_Version" != "SUSE9.3" ]; then |
| 3894 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3895 | echoscip-shell system . . echo. "Try to install yum first..." |
| 3896 | yast2 -i yum |
| 3897 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3898 | if ! rpm -q yum &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 3899 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3900 | echoscip-shell system . . echo. "You must manually install yum first in this SuSE server!" |
| 3901 | echoscip-shell system . . echo. "Use yast2 to install that, and remember to set the yum repository in /etc/yum.repos.d/" |
| 3902 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3903 | exit 1 |
| 3904 | fi |
| 3905 | fi |
| 3906 | fi |
| 3907 | if [scip-shell system . . `[`. "$installer" = "zypper" ] && ! rpm -q zypper &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 3908 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3909 | echoscip-shell system . . echo. "Try to install zypper first..." |
| 3910 | yast2 -i zypper |
| 3911 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3912 | if ! rpm -q zypper &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 3913 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3914 | echoscip-shell system . . echo. "You must manually install package 'zypper' first!" |
| 3915 | echoscip-shell system . . echo. "Use yast2 to install that, and remember to set the zypper repository!" |
| 3916 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3917 | exit 1 |
| 3918 | fi |
| 3919 | fi |
| 3920 | |
| 3921 | # clean the stale files and make necessary directories |
| 3922 | [scip-shell system . . `[`. -f $drbl_pkgdir/dev.tgz ] && rmscip-shell system . . rm. -f $drbl_pkgdir/dev.tgz |
| 3923 | # create the directory for diskless image |
| 3924 | [scip-shell system . . `[`. ! -d $pxecfg_pd ] && mkdirscip-shell system . . mkdir. -p $pxecfg_pd |
| 3925 | [scip-shell system . . `[`. ! -d $drbl_common_root ] && mkdirscip-shell system . . mkdir. -p $drbl_common_root |
| 3926 | [scip-shell system . . `[`. ! -d $drblroot ] && mkdirscip-shell system . . mkdir. -p -m 700 $drblroot |
| 3927 | |
| 3928 | # Setup yum respository |
| 3929 | if [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 3930 | find_yum_repos_dir_path_for_opensusescip-shell shell shell-project 0.0.0 find_yum_repos_dir_path_for_opensuse(). |
| 3931 | # Backup the old repo file, since 1.6.4-7, we will use opensuse-${OS_VER_NO}.repo instead of opensuse.repo |
| 3932 | [scip-shell system . . `[`. -f $yum_conf_dir_path/opensuse.repo ] && mvscip-shell system . . mv. -fv $yum_conf_dir_path/opensuse.repo $yum_conf_dir_path/opensuse.repo.drblsave |
| 3933 | [scip-shell system . . `[`. -f $yum_conf_dir_path/opensuse-nonoss.repo ] && mvscip-shell system . . mv. -fv $yum_conf_dir_path/opensuse-nonoss.repo $yum_conf_dir_path/opensuse-nonoss.repo.drblsave |
| 3934 | if [scip-shell system . . `[`. ! -f $yum_conf_dir_path/drbl.repo -o ! -f $yum_conf_dir_path/opensuse-${OS_VER_NO}.repo ]; then |
| 3935 | echoscip-shell system . . echo. "Try to backup the original yum repository settings if they exist..." |
| 3936 | # we won't touch the existing one, just copied by drbl. |
| 3937 | repo_lists="$drbl_yum_repo_list opensuse-${OS_VER_NO}.repo opensuse-updates-${OS_VER_NO}.repo" |
| 3938 | for ifile in $repo_lists; do |
| 3939 | [scip-shell system . . `[`. -f "$yum_conf_dir_path/$ifile" ] && mvscip-shell system . . mv. -v $yum_conf_dir_path/$ifile $yum_conf_dir_path/$ifile.drblsave |
| 3940 | done |
| 3941 | if [scip-shell system . . `[`. ! -f $DRBL_SCRIPT_PATH/setup/yum-repos/opensuse-${OS_VER_NO}.repo ]; then |
| 3942 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 3943 | echoscip-shell system . . echo. "$DRBL_SCRIPT_PATH/setup/yum-repos/opensuse-${OS_VER_NO}.repo does NOT exist!" |
| 3944 | echoscip-shell system . . echo. "Maybe this is NOT a supported version!" |
| 3945 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 3946 | echoscip-shell system . . echo. "$msg_program_stop" |
| 3947 | exit 1 |
| 3948 | fi |
| 3949 | cpscip-shell system . . cp. -f $DRBL_SCRIPT_PATH/setup/yum-repos/{drbl*.repo,opensuse*-${OS_VER_NO}.repo} $yum_conf_dir_path/ |
| 3950 | fi |
| 3951 | # ask some RPM repository options, such as drbl-testing, drbl-unstable |
| 3952 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 3953 | # turn on some branches if set |
| 3954 | if [scip-shell system . . `[`. -n "$DRBL_STABLE" ]; then |
| 3955 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" $yum_conf_dir_path/drbl.repo |
| 3956 | else |
| 3957 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" $yum_conf_dir_path/drbl.repo |
| 3958 | fi |
| 3959 | if [scip-shell system . . `[`. -n "$DRBL_TEST" ]; then |
| 3960 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" $yum_conf_dir_path/drbl-testing.repo |
| 3961 | else |
| 3962 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" $yum_conf_dir_path/drbl-testing.repo |
| 3963 | fi |
| 3964 | if [scip-shell system . . `[`. -n "$DRBL_UNSTABLE" ]; then |
| 3965 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=1/gi" $yum_conf_dir_path/drbl-unstable.repo |
| 3966 | else |
| 3967 | perlscip-shell system . . perl. -pi -e "s/^[[:space:]]*enabled=.*/enabled=0/gi" $yum_conf_dir_path/drbl-unstable.repo |
| 3968 | fi |
| 3969 | fi |
| 3970 | |
| 3971 | # Setup zypper respository |
| 3972 | if [scip-shell system . . `[`. "$installer" = "zypper" ]; then |
| 3973 | # Ask some RPM repository options, such as drbl-testing, drbl-unstable |
| 3974 | ask_and_parse_rpm_ayo_repo_optionsscip-shell shell shell-project 0.0.0 ask_and_parse_rpm_ayo_repo_options(). |
| 3975 | |
| 3976 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3977 | # Remove DRBL branches first. |
| 3978 | echoscip-shell system . . echo. "Removing existing drbl repository if exists..." |
| 3979 | for i in drbl drbl-testing drbl-unstable; do |
| 3980 | if [scip-shell system . . `[`. -n "$(LANG=C zypper lr | awkscip-shell system . . awk. -F "|" '{print $2}' | grepscip-shell system . . grep. -iEw "$i[[:space:]]")" ]; then |
| 3981 | zypper rr $i |
| 3982 | fi |
| 3983 | done |
| 3984 | # Add drbl branches |
| 3985 | zypper ar $rpm_md_conf_dir_path/drbl.repo |
| 3986 | [scip-shell system . . `[`. -n "$DRBL_TEST" ] && zypper ar $rpm_md_conf_dir_path/drbl-testing.repo |
| 3987 | [scip-shell system . . `[`. -n "$DRBL_UNSTABLE" ] && zypper ar $rpm_md_conf_dir_path/drbl-unstable.repo |
| 3988 | zypper refresh |
| 3989 | echoscip-shell system . . echo. "Zypper reopsitory:" |
| 3990 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3991 | zypper lr |
| 3992 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 3993 | fi |
| 3994 | |
| 3995 | # ask some setting for client, such as SMP, serial console... |
| 3996 | ask_and_parse_client_extra_settingscip-shell shell shell-project 0.0.0 ask_and_parse_client_extra_setting(). |
| 3997 | |
| 3998 | # parse the setting of client archi. |
| 3999 | parse_client_archi_settingscip-shell shell shell-project 0.0.0 parse_client_archi_setting(). |
| 4000 | |
| 4001 | # It's important to remove the cache of apt, otherwise |
| 4002 | # the RPM::Architecture will not take effect. check this: |
| 4003 | # http://distro2.conectiva.com.br/pipermail/apt-rpm/2003-November/002015.html |
| 4004 | # ... RPM::Architecture, is what he's looking for. His problem was that the cache was built before he set the architecture. Doing "rm -f /var/cache/apt/*.bin; apt-get update" would make it work. |
| 4005 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 4006 | echoscip-shell system . . echo. "$msg_clean_apt_cache" |
| 4007 | $inst_prog clean |
| 4008 | for ifile in /var/cache/apt/*.bin; do |
| 4009 | rmscip-shell system . . rm. -f /var/cache/apt/$ifile |
| 4010 | done |
| 4011 | fi |
| 4012 | |
| 4013 | # If user specifies the client CPU arch is i586, we must put the setting in |
| 4014 | # apt so that different arch program will NOT be upgraded. |
| 4015 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 4016 | if [scip-shell system . . `[`. "$client_archi_set" = "i586" ]; then |
| 4017 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4018 | echoscip-shell system . . echo. "Setting the \"Architecture "i586"\" in apt config file /etc/apt/apt.conf.d/drbl-arch.conf." |
| 4019 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4020 | catscip-shell system . . cat. <<-APTCFG_END > /etc/apt/apt.conf.d/drbl-arch.confscip-shell filesystem . . `/etc/apt/apt.conf.d/drbl-arch.conf`. |
| 4021 | // necessary for DRBL client |
| 4022 | RPM |
| 4023 | { |
| 4024 | Architecture "i586"; |
| 4025 | } |
| 4026 | APTCFG_END |
| 4027 | fi |
| 4028 | fi |
| 4029 | |
| 4030 | # Update the apt data with repository. |
| 4031 | # if it's yum, skip this, later yum will do it. Because yum update will also |
| 4032 | # do upgrade... |
| 4033 | [scip-shell system . . `[`. "$installer" = "apt" ] && $inst_prog update |
| 4034 | |
| 4035 | # 2. |
| 4036 | # check if apt is integrity... Ex: original MDK 9.2 is buggy... |
| 4037 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 4038 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4039 | echoscip-shell system . . echo. "$msg_check_apt_integrity" |
| 4040 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4041 | check_apt_integrityscip-shell shell shell-project 0.0.0 check_apt_integrity(). |
| 4042 | fi |
| 4043 | |
| 4044 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4045 | # 3. |
| 4046 | # We will upgrade system first. |
| 4047 | # Try to find if the i386 glibc and openssl are installed or not |
| 4048 | # If they are installed, hold them not to be upgraded to i686 |
| 4049 | if [scip-shell system . . `[`. -z "$upgrade_system_answer" ]; then |
| 4050 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4051 | echoscip-shell system . . echo. "$msg_upgrade_system_question" |
| 4052 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4053 | echoscip-shell system . . echo. -n "[y/N] " |
| 4054 | read upgrade_system_answer |
| 4055 | fi |
| 4056 | |
| 4057 | case "$upgrade_system_answer" in |
| 4058 | y|Y|[yY][eE][sS]) |
| 4059 | [scip-shell system . . `[`. "$installer" = "apt" ] && $inst_prog $inst_opt dist-upgrade |
| 4060 | [scip-shell system . . `[`. "$installer" = "yum" ] && yum upgrade |
| 4061 | [scip-shell system . . `[`. "$installer" = "zypper" ] && zypper update |
| 4062 | ;; |
| 4063 | esac |
| 4064 | |
| 4065 | # 4. |
| 4066 | # lftp & curl are necessary here, we install it first |
| 4067 | if ! rpm -q --quiet lftp || ! rpm -q --quiet curl || ! rpm -q --quiet wget ; then |
| 4068 | echoscip-shell system . . echo. "lftp and curl are necessary so that we can find some programs in apt or yum repository. Install them now if not installed..." |
| 4069 | # we need lftp to parse the repo setting if it's in ftp:// |
| 4070 | if [scip-shell system . . `[`. "$ARCH" = "x86_64" -a "$installer" = "yum" ]; then |
| 4071 | lftp_curl_etc="lftp.x86_64 curl.x86_64 wget.x86_64" |
| 4072 | else |
| 4073 | lftp_curl_etc="lftp curl wget" |
| 4074 | fi |
| 4075 | $inst_prog $inst_opt install $lftp_curl_etc |
| 4076 | fi |
| 4077 | # After the dist upgrade, check the ARCH for glibc, db... which are different |
| 4078 | # from i586 and are found in ftp://ftp.twaren.net/Linux/SuSE/i386/9.3/suse/i686 |
| 4079 | for ipkg in $i686_pkg_check_list_SUSE; do |
| 4080 | # i686_pkg_check_list_SUSE is: glibc glibc-devel db db-devel... |
| 4081 | # since "-" can not ba a variable name, replace it as "_" |
| 4082 | ipkg_arch_var="$(echoscip-shell system . . echo. $ipkg | sedscip-shell system . . sed. -e "s/-/_/g")" |
| 4083 | rpm -q --qf '%{ARCH}' $ipkg > /dev/nullscip-shell filesystem . . `/dev/null`. && eval ${ipkg_arch_var}_ARCH="$(rpm -q --qf '%{ARCH}' $ipkg)" |
| 4084 | done |
| 4085 | # We need to get url_os os_ayo_path url_os_coreroot if it's yum. |
| 4086 | if [scip-shell system . . `[`. "$installer" = "yum" ]; then |
| 4087 | url_tmp="$(find-url-in-yum-set $yum_conf_dir_path/opensuse-${OS_VER_NO}.repo $OS_VER_NO $ARCH 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 4088 | if [scip-shell system . . `[`. -n "$url_tmp" ]; then |
| 4089 | url_os="$(echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $1}')" |
| 4090 | # We have to remove the last "/" in the path, |
| 4091 | # Ex: fedora/linux/releases/ -> fedora/linux/releases |
| 4092 | # otherwise for example, this command will have problem: |
| 4093 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases//../updates/7/i386 |
| 4094 | # The place "//../" is the key problem. It should be |
| 4095 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases/../updates/7/i386 |
| 4096 | os_ayo_path="$(echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $2}' | sedscip-shell system . . sed. -e "s|/$||g")" |
| 4097 | url_os_coreroot=$url_os/$os_ayo_path |
| 4098 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4099 | echoscip-shell system . . echo. "Use yum repository in $url_os_coreroot" |
| 4100 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4101 | fi |
| 4102 | url_update_tmp="$(find-url-in-yum-set $yum_conf_dir_path/opensuse-updates-${OS_VER_NO}.repo $OS_VER_NO $ARCH 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 4103 | if [scip-shell system . . `[`. -n "$url_update_tmp" ]; then |
| 4104 | # Ex: |
| 4105 | # url_updates_root will be like: |
| 4106 | # http://opensource.nchc.org.tw/suse/SuSE/update |
| 4107 | # Then the updates RPM will be in http://opensource.nchc.org.tw/suse/SuSE/update/10.0/rpm/i586/ |
| 4108 | url_updates="$(echoscip-shell system . . echo. $url_update_tmp | awkscip-shell system . . awk. -F' ' '{print $1}')" |
| 4109 | # We have to remove the last "/" in the path, |
| 4110 | # Ex: fedora/linux/releases/ -> fedora/linux/releases |
| 4111 | # otherwise for example, this command will have problem: |
| 4112 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases//../updates/7/i386 |
| 4113 | # The place "//../" is the key problem. It should be |
| 4114 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases/../updates/7/i386 |
| 4115 | updates_ayo_path="$(echoscip-shell system . . echo. $url_update_tmp | awkscip-shell system . . awk. -F' ' '{print $2}' | sedscip-shell system . . sed. -e "s|/$||g")" |
| 4116 | url_updates_root=$url_updates/$updates_ayo_path |
| 4117 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4118 | echoscip-shell system . . echo. "Use yum updates repository in $url_updates_root" |
| 4119 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4120 | fi |
| 4121 | elif [scip-shell system . . `[`. "$installer" = "zypper" ]; then |
| 4122 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4123 | # We have to export the zypper repository to rpm-md format. |
| 4124 | opensuse_rpm_md_repo="$(mktempscip-shell system . . mktemp. /tmp/rpm_md_repo.XXXXXXscip-shell filesystem . . `/tmp/rpm_md_repo.XXXXXX`.)" |
| 4125 | # //NOTE// The output file is ${opensuse_rpm_md_repo}.repo |
| 4126 | LC_ALL=C zypper lr -e $opensuse_rpm_md_repo |
| 4127 | # Modify the output rpm md repo file, since some blocks might come with "space" # E.g. |
| 4128 | # [openSUSE 11.1-0] <--- replace " " with "-" so that we can use find-url-in-rpm-md-set to parse the url. find-url-in-rpm-md-set can only work with the block name without "space" |
| 4129 | # name=openSUSE 11.1-0 |
| 4130 | # enabled=1 |
| 4131 | # autorefresh=1 |
| 4132 | # baseurl=http://free.nchc.org.tw/opensuse/distribution/11.1/repo/oss |
| 4133 | # path=/ |
| 4134 | # type=yast2 |
| 4135 | # keeppackages=0 |
| 4136 | lines="$(grepscip-shell system . . grep. -E -n "^\[.*\]" ${opensuse_rpm_md_repo}.repo | cutscip-shell system . . cut. -d":" -f1)" |
| 4137 | for i in $lines; do |
| 4138 | begin_line="$i" |
| 4139 | end_line="$i" |
| 4140 | sub_cmd="if ($begin_line..$end_line) {s/ /-/g}" |
| 4141 | LC_ALL=C perlscip-shell system . . perl. -pi -e "$sub_cmd" ${opensuse_rpm_md_repo}.repo |
| 4142 | done |
| 4143 | |
| 4144 | # Find the possible blocks |
| 4145 | # We will get something like: |
| 4146 | # [drbl] |
| 4147 | # [drbl-testing] |
| 4148 | # [drbl-unstable] |
| 4149 | # [openSUSE-11.1-0] |
| 4150 | # [openSUSE-11.1-Non-Oss] |
| 4151 | # [openSUSE-11.1-Oss] |
| 4152 | # [repo-debug] |
| 4153 | # [repo-source] |
| 4154 | # [repo-update] |
| 4155 | |
| 4156 | possible_blks="$(LC_ALL=C grepscip-shell system . . grep. -E "^\[.*\]" ${opensuse_rpm_md_repo}.repo | sedscip-shell system . . sed. -e "s/\[//g" -e "s/\]//g")" |
| 4157 | |
| 4158 | # The export file is ${opensuse_rpm_md_repo}.repo |
| 4159 | # (1) Find release repo |
| 4160 | for ib in $possible_blks; do |
| 4161 | # skip drbl-related, source, debug repos |
| 4162 | [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $ib | grepscip-shell system . . grep. -iE "(drbl|debug|source|update)")" ] && continue |
| 4163 | url_tmp="$(find-url-in-rpm-md-set ${opensuse_rpm_md_repo}.repo $ib $OS_VER_NO 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 4164 | # Sometimes maybe the update list is shown in the higer priority, so we might get this: |
| 4165 | # ======================== |
| 4166 | # [http-download.opensuse.org-adb379f6] |
| 4167 | # name=Updates for openSUSE 11.2-0 |
| 4168 | # enabled=1 |
| 4169 | # autorefresh=1 |
| 4170 | # baseurl=http://download.opensuse.org/update/11.2/ |
| 4171 | # path=/ |
| 4172 | # type=rpm-md |
| 4173 | # keeppackages=0 |
| 4174 | # ======================== |
| 4175 | # In this case, we will get: |
| 4176 | # url_tmp='http://download.opensuse.org update' |
| 4177 | # we should skip this one, and find the next one. |
| 4178 | [scip-shell system . . `[`. -n "$(echoscip-shell system . . echo. $url_tmp | grepscip-shell system . . grep. -Ew "update")" ] && continue |
| 4179 | if [scip-shell system . . `[`. -n "$url_tmp" ]; then |
| 4180 | url_os="$(echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $1}')" |
| 4181 | # We have to remove the last "/" in the path, |
| 4182 | # Ex: fedora/linux/releases/ -> fedora/linux/releases |
| 4183 | # otherwise for example, this command will have problem: |
| 4184 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases//../updates/7/i386 |
| 4185 | # The place "//../" is the key problem. It should be |
| 4186 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases/../updates/7/i386 |
| 4187 | os_ayo_path="$(LC_ALL=C echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $2}' | sedscip-shell system . . sed. -e "s|/$||g")" |
| 4188 | url_os_coreroot=$url_os/$os_ayo_path |
| 4189 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4190 | echoscip-shell system . . echo. "Use zypper repository in $url_os_coreroot" |
| 4191 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4192 | break |
| 4193 | fi |
| 4194 | done |
| 4195 | # (2) Find update repo |
| 4196 | for ib in $possible_blks; do |
| 4197 | url_update_tmp="$(find-url-in-rpm-md-set ${opensuse_rpm_md_repo}.repo $ib $OS_VER_NO 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 4198 | # Only update-related, e.g. |
| 4199 | # ======================== |
| 4200 | # [http-download.opensuse.org-adb379f6] |
| 4201 | # name=Updates for openSUSE 11.2-0 |
| 4202 | # enabled=1 |
| 4203 | # autorefresh=1 |
| 4204 | # baseurl=http://download.opensuse.org/update/11.2/ |
| 4205 | # path=/ |
| 4206 | # type=rpm-md |
| 4207 | # keeppackages=0 |
| 4208 | # ======================== |
| 4209 | # In this case, we will get: |
| 4210 | # url_tmp='http://download.opensuse.org update' |
| 4211 | [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $url_update_tmp | grepscip-shell system . . grep. -Ew "update")" ] && continue |
| 4212 | if [scip-shell system . . `[`. -n "$url_update_tmp" ]; then |
| 4213 | # Ex: |
| 4214 | # url_updates_root will be like: |
| 4215 | # http://opensource.nchc.org.tw/suse/SuSE/update |
| 4216 | # Then the updates RPM will be in http://opensource.nchc.org.tw/suse/SuSE/update/10.0/rpm/i586/ |
| 4217 | url_updates="$(echoscip-shell system . . echo. $url_update_tmp | awkscip-shell system . . awk. -F' ' '{print $1}')" |
| 4218 | # We have to remove the last "/" in the path, |
| 4219 | # Ex: fedora/linux/releases/ -> fedora/linux/releases |
| 4220 | # otherwise for example, this command will have problem: |
| 4221 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases//../updates/7/i386 |
| 4222 | # The place "//../" is the key problem. It should be |
| 4223 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases/../updates/7/i386 |
| 4224 | updates_ayo_path="$(LC_ALL=C echoscip-shell system . . echo. $url_update_tmp | awkscip-shell system . . awk. -F' ' '{print $2}' | sedscip-shell system . . sed. -e "s|/$||g")" |
| 4225 | url_updates_root=$url_updates/$updates_ayo_path |
| 4226 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4227 | echoscip-shell system . . echo. "Use zypper updates repository in $url_updates_root" |
| 4228 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4229 | break |
| 4230 | fi |
| 4231 | done |
| 4232 | [scip-shell system . . `[`. -e "$opensuse_rpm_md_repo" ] && rmscip-shell system . . rm. -f $opensuse_rpm_md_repo |
| 4233 | [scip-shell system . . `[`. -e "${opensuse_rpm_md_repo}.repo" ] && rmscip-shell system . . rm. -f ${opensuse_rpm_md_repo}.repo |
| 4234 | fi |
| 4235 | |
| 4236 | if [scip-shell system . . `[`. -z "$url_os_coreroot" ]; then |
| 4237 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4238 | echoscip-shell system . . echo. "SuSE RPM release repository NOT found!" |
| 4239 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4240 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 4241 | read |
| 4242 | fi |
| 4243 | if [scip-shell system . . `[`. -z "$url_updates_root" ]; then |
| 4244 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4245 | echoscip-shell system . . echo. "SuSE RPM updates repository NOT found!" |
| 4246 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4247 | echoscip-shell system . . echo. -n "$msg_press_enter_to_continue" |
| 4248 | read |
| 4249 | fi |
| 4250 | |
| 4251 | install_client_archi_glibc_etc_SUSEscip-shell shell shell-project 0.0.0 install_client_archi_glibc_etc_SUSE(). |
| 4252 | |
| 4253 | # 5. prepare the kernel for clients. |
| 4254 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4255 | echoscip-shell system . . echo. "$msg_prepare_kernel_for_clients" |
| 4256 | prepare_install_client_kernel_in_SUSEscip-shell shell shell-project 0.0.0 prepare_install_client_kernel_in_SUSE(). |
| 4257 | |
| 4258 | # 6. |
| 4259 | # wget maybe not installed, we will check it is installed only when apt is not installed, so if apt/yum is installed while wget is not installed, get_inst_rpm() will failed! Add wget here. |
| 4260 | # Note, for SUSE, nfs-utils is kernel nfs server, nfs-server is user space. |
| 4261 | # $PKG_FROM_SUSE, $PKG_TO_QUERY and $PKG_FROM_DRBL are loaded from conf/drbl.conf |
| 4262 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4263 | echoscip-shell system . . echo. "Searching if $PKG_TO_QUERY available... " |
| 4264 | case "$installer" in |
| 4265 | zypper) |
| 4266 | for ipkg in $PKG_TO_QUERY; do |
| 4267 | if [scip-shell system . . `[`. -n "$(LC_ALL=C zypper search $ipkg 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -iEw "$ipkg")" ]; then |
| 4268 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 4269 | PKG_FROM_SUSE="$PKG_FROM_SUSE $ipkg" |
| 4270 | fi |
| 4271 | done |
| 4272 | ;; |
| 4273 | yum) |
| 4274 | for ipkg in $PKG_TO_QUERY; do |
| 4275 | if [scip-shell system . . `[`. -n "$(yum list $ipkg 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -E "^$ipkg")" ]; then |
| 4276 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 4277 | PKG_FROM_SUSE="$PKG_FROM_SUSE $ipkg" |
| 4278 | fi |
| 4279 | done |
| 4280 | ;; |
| 4281 | apt) |
| 4282 | for ipkg in $PKG_TO_QUERY; do |
| 4283 | if [scip-shell system . . `[`. -n "$(apt-cachescip-shell system . . apt-cache. pkgnames $ipkg 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -i "^${ipkg}$")" ]; then |
| 4284 | echoscip-shell system . . echo. "Package $ipkg exists in repository." |
| 4285 | PKG_FROM_SUSE="$PKG_FROM_SUSE $ipkg" |
| 4286 | fi |
| 4287 | done |
| 4288 | ;; |
| 4289 | esac |
| 4290 | |
| 4291 | # Since the repodata in yum repository of opensuse include all the arch, they do not separate them, so we have to put the specific arch, especially for x86_64. Otherwise the i586 will be always the first priority, that will case the problem: |
| 4292 | # http://sourceforge.net/mailarchive/forum.php?thread_id=9549930&forum_id=41969 |
| 4293 | if [scip-shell system . . `[`. "$ARCH" = "x86_64" -a "$installer" = "yum" ]; then |
| 4294 | PKG_TO_INSTALL="" |
| 4295 | for ipkgs in $PKG_FROM_SUSE; do |
| 4296 | PKG_TO_INSTALL="$PKG_TO_INSTALL ${ipkgs}.x86_64" |
| 4297 | done |
| 4298 | else |
| 4299 | PKG_TO_INSTALL="$PKG_FROM_SUSE" |
| 4300 | fi |
| 4301 | $inst_prog $inst_opt install $PKG_TO_INSTALL $PKG_FROM_DRBL |
| 4302 | |
| 4303 | # TODO |
| 4304 | RETVAL=$? |
| 4305 | check_apt_installscip-shell shell shell-project 0.0.0 check_apt_install(). $RETVAL |
| 4306 | |
| 4307 | # 7. |
| 4308 | # Creat dev tarball in $drbl_pkgdir, |
| 4309 | # which will be copied to /tftpboot/node_root/etc/diskless-image |
| 4310 | # in deploy script |
| 4311 | [scip-shell system . . `[`. ! -d $drbl_pkgdir ] && mkdirscip-shell system . . mkdir. -p $drbl_pkgdir |
| 4312 | |
| 4313 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4314 | # get dev |
| 4315 | echoscip-shell system . . echo. "The DRBL client will use udev..." |
| 4316 | # we must install udev... |
| 4317 | if ! rpm -q --quiet udev; then |
| 4318 | echoscip-shell system . . echo. -n "Try to install udev..." |
| 4319 | $inst_prog $inst_opt install udev |
| 4320 | echoscip-shell system . . echo. "done!" |
| 4321 | fi |
| 4322 | if ! rpm -q --quiet udev; then |
| 4323 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 4324 | echoscip-shell system . . echo. "No udev, and no pre-packaged devices file!" |
| 4325 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4326 | echoscip-shell system . . echo. "$msg_program_stop" |
| 4327 | exit 1 |
| 4328 | fi |
| 4329 | |
| 4330 | # 8. |
| 4331 | # netinstall |
| 4332 | if [scip-shell system . . `[`. "$DRBL_NETINSTALL" = "yes" ]; then |
| 4333 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4334 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4335 | echoscip-shell system . . echo. "$msg_install_net_install_images" |
| 4336 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4337 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4338 | drbl-netinstall -i all -s -v |
| 4339 | fi |
| 4340 | |
| 4341 | # 9. |
| 4342 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4343 | run_drblsrv_offlinescip-shell shell shell-project 0.0.0 run_drblsrv_offline(). |
| 4344 | |
| 4345 | } # end of install_drbl_SUSE |
| 4346 | |
| 4347 | get_url_ocs_then_install_curl_etc_via_yum_if_necessaryscip-shell shell shell-project 0.0.0 get_url_ocs_then_install_curl_etc_via_yum_if_necessary().() { |
| 4348 | # we need $url_os, "$os_ayo_path"and "$url_os_coreroot for kernel and dev |
| 4349 | # try to parse the yum config in the system |
| 4350 | # We will search CentOS-base.repo, $FC_CORE_REPO in /etc/yum.repos.d/ |
| 4351 | # TODO: maybe search all the *.repo in /etc/yum.repos.d/ ? |
| 4352 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4353 | echoscip-shell system . . echo. "Try to find yum repository url..." |
| 4354 | for i in CentOS-Base fedora-core fedora; do |
| 4355 | if [scip-shell system . . `[`. -f "/etc/yum.repos.d/${i}.repo" ]; then |
| 4356 | if ! rpm -q --quiet curl || ! rpm -q --quiet lftp || ! rpm -q --quiet wget; then |
| 4357 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4358 | echoscip-shell system . . echo. "$msg_need_curl_etc_to_parse_config" |
| 4359 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4360 | # we need lftp to parse the yum repo config if the repo is in ftp:// |
| 4361 | $installer -y install lftp curl wget |
| 4362 | fi |
| 4363 | # Once we have curl, we can get url_os, os_ayo_path... |
| 4364 | if [scip-shell system . . `[`. "$i" = "CentOS-Base" ]; then |
| 4365 | # CentOS 4.3 uses the new method to get the mirrorlist system. |
| 4366 | # Ref: http://lists.centos.org/pipermail/centos/2006-April/063312.html |
| 4367 | # We can only query releasever=4 for 4.3 |
| 4368 | # Since earlier version 4.2/4.1 is no more, forget about them. |
| 4369 | # Actually, for CentOS, the latest version in 4.x is linked to 4, so use 4 is the latest release. |
| 4370 | #QUERY_OS_VER="$(echo ${OS_Version:2} | sed -e "s/\.[[:digit:]]*//g")" |
| 4371 | # Note by Steven Shiau on 2006/10/10, now we should query releasever=4.4 for 4.4, then this will be consistent with find-url-in-yum-set. |
| 4372 | # Now with ?release=4 |
| 4373 | # curl 'http://mirrorlist.centos.org/?release=4&arch=i386&repo=os' |
| 4374 | # We got: |
| 4375 | # http://ftp2.tnc.edu.tw/pub1/centos/4.4/os/i386/ |
| 4376 | # http://ftp.cs.pu.edu.tw/Linux/CentOS/4.4/os/i386/ |
| 4377 | # It's not consistent, then "find-url-in-yum-set /etc/yum.repos.d/CentOS-Base.repo 4 i386" will have problem, it will give "http://ftp2.tnc.edu.tw pub1/centos/4." (extra "." in the end, since we are replacing "4" (release=4 is what we assign), not 4.4) |
| 4378 | QUERY_OS_VER="${OS_Version:2}" |
| 4379 | else |
| 4380 | QUERY_OS_VER="${OS_Version:2}" |
| 4381 | fi |
| 4382 | url_tmp="$(find-url-in-yum-set /etc/yum.repos.d/${i}.repo $QUERY_OS_VER $ARCH 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" |
| 4383 | if [scip-shell system . . `[`. -n "$url_tmp" ]; then |
| 4384 | url_os="$(echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $1}')" |
| 4385 | # We have to remove the last "/" in the path, |
| 4386 | # Ex: fedora/linux/releases/ -> fedora/linux/releases |
| 4387 | # otherwise for example, this command will have problem: |
| 4388 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases//../updates/7/i386 |
| 4389 | # The place "//../" is the key problem. It should be |
| 4390 | # list_available_rpm http://free.nchc.org.tw/fedora/linux/releases/../updates/7/i386 |
| 4391 | os_ayo_path="$(echoscip-shell system . . echo. $url_tmp | awkscip-shell system . . awk. -F' ' '{print $2}' | sedscip-shell system . . sed. -e "s|/$||g")" |
| 4392 | url_os_coreroot=$url_os/$os_ayo_path |
| 4393 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4394 | echoscip-shell system . . echo. "Use yum repository in $url_os_coreroot" |
| 4395 | check_if_repository_in_blacklistscip-shell shell shell-project 0.0.0 check_if_repository_in_blacklist(). $url_os |
| 4396 | break |
| 4397 | fi |
| 4398 | fi |
| 4399 | done |
| 4400 | } # end of get_url_ocs_then_install_curl_etc_via_yum_if_necessary |
| 4401 | # |
| 4402 | install_curl_etc_via_apt_if_necessaryscip-shell shell shell-project 0.0.0 install_curl_etc_via_apt_if_necessary().() { |
| 4403 | # we need $url_os, "$os_ayo_path"and "$url_os_coreroot for kernel and dev |
| 4404 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4405 | if ! rpm -q --quiet curl || ! rpm -q --quiet lftp || ! rpm -q --quiet wget; then |
| 4406 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4407 | echoscip-shell system . . echo. "$msg_need_curl_etc_to_parse_config" |
| 4408 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4409 | apt-getscip-shell system . . apt-get. update |
| 4410 | # we need lftp to parse the repo config if the repo is in ftp:// |
| 4411 | # wget is already installed when setup apt, but who cares, add it in case |
| 4412 | apt-getscip-shell system . . apt-get. -y install lftp curl wget |
| 4413 | fi |
| 4414 | } # end of install_curl_etc_via_apt_if_necessary |
| 4415 | |
| 4416 | # |
| 4417 | prepare_install_client_kernel_in_SUSEscip-shell shell shell-project 0.0.0 prepare_install_client_kernel_in_SUSE().() { |
| 4418 | # Prepare to install the kernel of clients in SuSE |
| 4419 | # |
| 4420 | local pkg_name pkg_ver pkg_2_be_inst_for_cli suse_rpm_list_tmp pkg_2_be_inst_for_cli_ver |
| 4421 | if [scip-shell system . . `[`. "$client_archi_set" = "best_optimization" ]; then |
| 4422 | # same CPU archi with server, maybe for i686, or i386 (for AMD K7 ?) |
| 4423 | [scip-shell system . . `[`. -z "$KARCH" ] && KARCH="$(unamescip-shell system . . uname. -m)" |
| 4424 | KARCH="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 4425 | # KARCH will be nothing if we can not find the kernel config file, so we choose to use the same arch of server for client. |
| 4426 | [scip-shell system . . `[`. -z "$KARCH" ] && KARCH="$(unamescip-shell system . . uname. -m)" |
| 4427 | # convert the arch name from server to client, |
| 4428 | # Note: |
| 4429 | # "KARCH_RPM_URL_PATH" is for RPM repository PATH use only, like |
| 4430 | # http://opensource.nchc.org.tw/opensuse/distribution/SL-10.1/inst-source/suse/i586/ |
| 4431 | # of |
| 4432 | # http://opensource.nchc.org.tw/opensuse/distribution/SL-10.1/inst-source/suse/x86_64/ |
| 4433 | case "$KARCH" in |
| 4434 | i[0-9]86) |
| 4435 | KARCH="i686" |
| 4436 | # skip the leading "i" |
| 4437 | client_archi=${KARCH:1} |
| 4438 | KARCH_RPM_URL_PATH="i586" |
| 4439 | ;; |
| 4440 | x86_64) |
| 4441 | KARCH="x86_64" |
| 4442 | client_archi=${KARCH} |
| 4443 | KARCH_RPM_URL_PATH="x86_64" |
| 4444 | ;; |
| 4445 | *) |
| 4446 | KARCH="i686" |
| 4447 | # skip the leading "i" |
| 4448 | client_archi=${KARCH:1} |
| 4449 | KARCH_RPM_URL_PATH="i586" |
| 4450 | ;; |
| 4451 | esac |
| 4452 | else |
| 4453 | # For SuSE, only i586 is available we decided. Maybe in the future, we |
| 4454 | # will add K7 ? |
| 4455 | KARCH="i586" |
| 4456 | # skip the leading "i" |
| 4457 | client_archi=${KARCH:1} |
| 4458 | KARCH_RPM_URL_PATH="i586" |
| 4459 | fi |
| 4460 | cpu_filter="grep -i $client_archi" |
| 4461 | if [scip-shell system . . `[`. -n "$SMP_OPTION" ]; then |
| 4462 | # enable SMP filter |
| 4463 | smp_filter="grep -i smp" |
| 4464 | kernel_img_name="kernel-smp" |
| 4465 | else |
| 4466 | # Before OpenSuSE 11.1, only one kernel package (e.g. kernel-default-2.6.25.5-1.1.i586.rpm or kernel-pae-2.6.25.5-1.1.i586.rpm). |
| 4467 | # From OpenSuSE 11.1 or later, we need more kernel packages, e.g.: |
| 4468 | # ----------- |
| 4469 | # kernel-default-2.6.27.7-9.1.i586.rpm (modules) |
| 4470 | # kernel-default-base-2.6.27.7-9.1.i586.rpm (vmlinuz and base modules) |
| 4471 | # kernel-default-extra-2.6.27.7-9.1.i586.rpm (old modules ?) |
| 4472 | # ----------- |
| 4473 | # Or |
| 4474 | # PAE (Physical Address Extension) kernel (PAE kernel is available from OpenSuSE 11.0 or later): |
| 4475 | # ----------- |
| 4476 | # kernel-pae-2.6.27.7-9.1.i586.rpm |
| 4477 | # kernel-pae-base-2.6.27.7-9.1.i586.rpm |
| 4478 | # kernel-pae-extra-2.6.27.7-9.1.i586.rpm |
| 4479 | # ----------- |
| 4480 | # "NOT SMP" filter |
| 4481 | smp_filter="grep -iv smp" |
| 4482 | # Here we test on the server to see if kernel-pae is available. If yes, use it. |
| 4483 | for i in kernel-pae kernel-default; do |
| 4484 | if rpm -q $i &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 4485 | kernel_img_name="$i" |
| 4486 | break |
| 4487 | fi |
| 4488 | done |
| 4489 | # If we can not find the name we want, use the default one "kernel-default" |
| 4490 | [scip-shell system . . `[`. -z "$kernel_img_name" ] && kernel_img_name="kernel-default" |
| 4491 | fi |
| 4492 | # Since there is only i586 kernel for SuSE, we do not have to filter KARCH here |
| 4493 | # latest_drbl_kernel_in_rep is (1) package name with .i586.rpm, like: kernel-default-2.6.16.21-0.13.i586.rpm when the installer is yum (2) name without i586.rpm, like kernel-default-2.6.16.21-0.13 when the installer is apt |
| 4494 | |
| 4495 | # Flag to download kernel-pae-base or kernel-default-base: |
| 4496 | download_suse_kernel_base="no" |
| 4497 | drblsrv_offline_extra_opt="" |
| 4498 | if rpm -q ${kernel_img_name}-base &>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 4499 | echoscip-shell system . . echo. "Kernel package ${kernel_img_name}-base exists..." |
| 4500 | download_suse_kernel_base="yes" |
| 4501 | fi |
| 4502 | suse_rpm_list_tmp="$(mktempscip-shell system . . mktemp. /tmp/suse_rpm_list.XXXXXXscip-shell filesystem . . `/tmp/suse_rpm_list.XXXXXX`.)" |
| 4503 | if [scip-shell system . . `[`. "$installer" = "apt" ]; then |
| 4504 | latest_drbl_kernel_in_rep="$(apt-cachescip-shell system . . apt-cache. pkgnames $kernel_img_name | grepscip-shell system . . grep. -E "\-default$" | pkg-ver-latest)" |
| 4505 | elif [scip-shell system . . `[`. "$installer" = "yum" -o "$installer" = "zypper" ]; then |
| 4506 | # Find the latest kernel in updates first (like http://opensource.nchc.org.tw/suse/SuSE/update/10.0/rpm/i586/) |
| 4507 | list_available_rpm $url_updates_root/$OS_VER_NO/rpm/$KARCH_RPM_URL_PATH/ > $suse_rpm_list_tmp |
| 4508 | latest_drbl_kernel_in_rep="$(catscip-shell system . . cat. $suse_rpm_list_tmp | grepscip-shell system . . grep. -E "${kernel_img_name}-[0-9]+" | pkg-ver-latest)" |
| 4509 | if [scip-shell system . . `[`. -n "$latest_drbl_kernel_in_rep" ]; then |
| 4510 | # Keep the url, we will use it to download |
| 4511 | suse_latest_kernel_url="$url_updates_root/$OS_VER_NO/rpm/$KARCH_RPM_URL_PATH/$latest_drbl_kernel_in_rep" |
| 4512 | # elif [ -z "$latest_drbl_kernel_in_rep" ]; then |
| 4513 | else |
| 4514 | list_available_rpm $url_os_coreroot/$OS_PATH_IN_YUM_REPO/$REPO_PATH/suse/$KARCH_RPM_URL_PATH/ > $suse_rpm_list_tmp |
| 4515 | # If we can not find it in updates, use the one in release (like http://opensource.nchc.org.tw/opensuse/distribution/SL-10.0-OSS/inst-source/suse/i586/) |
| 4516 | latest_drbl_kernel_in_rep="$(catscip-shell system . . cat. $suse_rpm_list_tmp | grepscip-shell system . . grep. -E "${kernel_img_name}-[0-9]+" | pkg-ver-latest)" |
| 4517 | suse_latest_kernel_url="$url_os_coreroot/$OS_PATH_IN_YUM_REPO/$REPO_PATH/suse/$KARCH_RPM_URL_PATH/$latest_drbl_kernel_in_rep" |
| 4518 | fi |
| 4519 | fi |
| 4520 | suse_latest_kernel_base_url="" |
| 4521 | if [scip-shell system . . `[`. "$download_suse_kernel_base" = "yes" ]; then |
| 4522 | # For kernel like "kernel-default-base-2.6.27.7-9.1.i586.rpm" |
| 4523 | suse_latest_kernel_base_url="$(echoscip-shell system . . echo. $suse_latest_kernel_url | sedscip-shell system . . sed. -e "s|$kernel_img_name|${kernel_img_name}-base|g")" |
| 4524 | fi |
| 4525 | |
| 4526 | echoscip-shell system . . echo. "$msg_latest_kernel_in_ayo $latest_drbl_kernel_in_rep" |
| 4527 | |
| 4528 | # Another available kernel maybe is from server, check it: |
| 4529 | running_karch="$(drbl-check-kernel-cpu-arch `unamescip-shell system . . uname. -r`)" |
| 4530 | running_kernel_in_server="$(echoscip-shell system . . echo. $(unamescip-shell system . . uname. -r) $running_karch | $cpu_filter | $smp_filter)" |
| 4531 | |
| 4532 | use_kernel_from= |
| 4533 | if [scip-shell system . . `[`. -n "$running_kernel_in_server" ]; then |
| 4534 | # Server running kernel matches client's requirement |
| 4535 | if [scip-shell system . . `[`. -z "$chosen_client_kernel_from" ]; then |
| 4536 | echoscip-shell system . . echo. "$msg_2_kernel_availables" |
| 4537 | echoscip-shell system . . echo. "[1]: kernel $running_kernel_in_server ($msg_from_this_drbl_server)" |
| 4538 | echoscip-shell system . . echo. "[2]: $latest_drbl_kernel_in_rep ($msg_from_ayo_repository)" |
| 4539 | echoscip-shell system . . echo. -n "[1] " |
| 4540 | read chosen_client_kernel_from |
| 4541 | fi |
| 4542 | case "$chosen_client_kernel_from" in |
| 4543 | 2) |
| 4544 | echoscip-shell system . . echo. "Clients will use the kernel $latest_drbl_kernel_in_rep from ayo repository." |
| 4545 | use_kernel_from="ayo-repository" |
| 4546 | ;; |
| 4547 | *) |
| 4548 | echoscip-shell system . . echo. "Clients will use the kernel $running_kernel_in_server from server." |
| 4549 | use_kernel_from="local" |
| 4550 | ;; |
| 4551 | esac |
| 4552 | else |
| 4553 | # Use the kernel in the repository |
| 4554 | echoscip-shell system . . echo. "Use the kernel $latest_drbl_kernel_in_rep from ayo repository!" |
| 4555 | use_kernel_from="ayo-repository" |
| 4556 | fi |
| 4557 | |
| 4558 | case "$use_kernel_from" in |
| 4559 | "ayo-repository") |
| 4560 | case "$installer" in |
| 4561 | apt) |
| 4562 | # use with client_kernel_install_mode and client_kernel_tmp_dir |
| 4563 | client_kernel_install_mode="from_downloaded_pkg" |
| 4564 | |
| 4565 | # Before download it, clean the kernel-image in the cache dir so that we can fin |
| 4566 | # the download one by ls. |
| 4567 | rmscip-shell system . . rm. -f /var/cache/apt/archives/${latest_drbl_kernel_in_rep}*.rpm 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 4568 | |
| 4569 | # download it |
| 4570 | $inst_prog $inst_opt --reinstall --download-only install $latest_drbl_kernel_in_rep |
| 4571 | RC=$? |
| 4572 | if [scip-shell system . . `[`. $RC -gt 0 ]; then |
| 4573 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 4574 | echoscip-shell system . . echo. "Failed to download $latest_drbl_kernel_in_rep" |
| 4575 | echoscip-shell system . . echo. "Maybe you should check /etc/apt/sources.list so that "apt-cache pkgnames $kernel_img_name" can get the downloadable kernel! Then try to run this program again." |
| 4576 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4577 | echoscip-shell system . . echo. "$msg_program_stop" |
| 4578 | exit 1 |
| 4579 | fi |
| 4580 | |
| 4581 | # The "_" is important, since the file names in the cache dir are like |
| 4582 | # kernel-default_2.6.11.4-21.7_i586.rpm |
| 4583 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. /var/cache/apt/archives/${latest_drbl_kernel_in_rep}_*.rpm 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 4584 | # Note! Do not put / in the end, we will use it to compare something. |
| 4585 | client_kernel_tmp_dir="/var/cache/apt/archivesscip-shell filesystem . . `/var/cache/apt/archives`." |
| 4586 | fi |
| 4587 | ;; |
| 4588 | yum|zypper) |
| 4589 | # use with client_kernel_install_mode and client_kernel_tmp_dir |
| 4590 | client_kernel_install_mode="from_downloaded_pkg" |
| 4591 | client_kernel_tmp_dir=`mktempscip-shell system . . mktemp. -d /tmp/SuSE_RPM.XXXXXXXscip-shell filesystem . . `/tmp/SuSE_RPM.XXXXXXX`.` |
| 4592 | echoscip-shell system . . echo. "Downloading the kernel from $suse_latest_kernel_url..." |
| 4593 | wget --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$client_kernel_tmp_dir" $suse_latest_kernel_url |
| 4594 | if [scip-shell system . . `[`. -n "$suse_latest_kernel_base_url" ]; then |
| 4595 | echoscip-shell system . . echo. "Downloading the ${kernel_img_name}-base rpm from $suse_latest_kernel_base_url..." |
| 4596 | wget --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$client_kernel_tmp_dir" $suse_latest_kernel_base_url |
| 4597 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. "$client_kernel_tmp_dir/$(basenamescip-shell system . . basename. $suse_latest_kernel_base_url)" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 4598 | drblsrv_offline_extra_opt="$drblsrv_offline_extra_opt -e $client_kernel_tmp_dir/$(basenamescip-shell system . . basename. $suse_latest_kernel_base_url)" |
| 4599 | fi |
| 4600 | fi |
| 4601 | # For OpenSuSE 11.2 or later, some kernel packages are not inside kernel package, they are separate, like: |
| 4602 | # compcache-kmp-default-0.5.3_2.6.31.5_0.1-4.4.i586.rpm |
| 4603 | # compcache-kmp-desktop-0.5.3_2.6.31.5_0.1-4.4.i586.rpm |
| 4604 | # preload-kmp-default-1.1_2.6.31.5_0.1-6.8.1.i586.rpm |
| 4605 | # preload-kmp-desktop-1.1_2.6.31.5_0.1-6.8.1.i586.rpm |
| 4606 | # So if the client kernel is either: |
| 4607 | # kernel-default-2.6.31.5-0.1.1.i586.rpm |
| 4608 | # or |
| 4609 | # kernel-desktop-2.6.31.5-0.1.1.i586.rpm |
| 4610 | # We have to find it's "default" or "desktop" |
| 4611 | suse_client_kernel_tag="$(echoscip-shell system . . echo. ${kernel_img_name} | grepscip-shell system . . grep. -Eo "(desktop|default)")" |
| 4612 | # First we find those installed on the server. |
| 4613 | install_kmp_flag="" |
| 4614 | pkg_2_be_inst_for_cli_url="" |
| 4615 | kmp_list="$(LC_ALL=C rpm -qa | grepscip-shell system . . grep. -E "\-kmp-")" |
| 4616 | suse_latest_kernel_url_path="$(dirnamescip-shell system . . dirname. $suse_latest_kernel_url)" |
| 4617 | for ipkg in $kmp_list; do |
| 4618 | # E.g: package: preload-kmp-desktop-1.1_2.6.31.5_0.1-6.8.1.i586 |
| 4619 | # pkg_name=preload-kmp-desktop |
| 4620 | # For "pkg_ver" we have to use the version number same with kernel of client |
| 4621 | pkg_name="$(LC_ALL=C rpm -q --qf '%{NAME}\n' $ipkg)" |
| 4622 | echoscip-shell system . . echo. "Found $pkg_name installed on the server, will try to install it with client's kernel version for clients later..." |
| 4623 | # The version should be consistent with kernel |
| 4624 | pkg_ver="$(LC_ALL=C rpm -qp --qf '%{VERSION}\n' $client_kernel_tmp_dir/$(basenamescip-shell system . . basename. $suse_latest_kernel_url))" |
| 4625 | pkg_2_be_inst_for_cli="$(echoscip-shell system . . echo. $pkg_name | sedscip-shell system . . sed. -r -e "s/(-desktop|-default)/-${suse_client_kernel_tag}/g")" |
| 4626 | if [scip-shell system . . `[`. -n "$pkg_2_be_inst_for_cli" ]; then |
| 4627 | # Find the kernel module package on the repository... |
| 4628 | pkg_2_be_inst_for_cli_ver="$(catscip-shell system . . cat. $suse_rpm_list_tmp | grepscip-shell system . . grep. -E "${pkg_2_be_inst_for_cli}" | grepscip-shell system . . grep. -E "${pkg_ver}" | pkg-ver-latest)" |
| 4629 | if [scip-shell system . . `[`. -n "$pkg_2_be_inst_for_cli_ver" ]; then |
| 4630 | pkg_2_be_inst_for_cli_url="$pkg_2_be_inst_for_cli_url $(dirnamescip-shell system . . dirname. $suse_latest_kernel_url)/$pkg_2_be_inst_for_cli_ver" |
| 4631 | install_kmp_flag="yes" |
| 4632 | fi |
| 4633 | fi |
| 4634 | done |
| 4635 | if [scip-shell system . . `[`. "$install_kmp_flag" = "yes" ]; then |
| 4636 | for i in $pkg_2_be_inst_for_cli_url; do |
| 4637 | echoscip-shell system . . echo. "Downloading the kernel module package $i .." |
| 4638 | wget --passive-ftp -e robots=off -q -nd --retr-symlinks -P "$client_kernel_tmp_dir" $i |
| 4639 | if [scip-shell system . . `[`. -n "$(lsscip-shell system . . ls. "$client_kernel_tmp_dir/$(basenamescip-shell system . . basename. $i)" 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then |
| 4640 | drblsrv_offline_extra_opt="$drblsrv_offline_extra_opt -e $client_kernel_tmp_dir/$(basenamescip-shell system . . basename. $i)" |
| 4641 | else |
| 4642 | echoscip-shell system . . echo. "$i does not exist. Will skip installing it for clients." |
| 4643 | fi |
| 4644 | done |
| 4645 | fi |
| 4646 | ;; |
| 4647 | esac |
| 4648 | ;; |
| 4649 | "local") |
| 4650 | # kernel for client already exists in /tftpboot/node_root. |
| 4651 | client_kernel_install_mode="from_server" |
| 4652 | client_kernel_ver="$(unamescip-shell system . . uname. -r)" |
| 4653 | ;; |
| 4654 | esac |
| 4655 | [scip-shell system . . `[`. -e "$suse_rpm_list_tmp" ] && rmscip-shell system . . rm. -f $suse_rpm_list_tmp |
| 4656 | |
| 4657 | } # end of prepare_install_client_kernel_in_SUSE |
| 4658 | |
| 4659 | # |
| 4660 | Usagescip-shell shell shell-project 0.0.0 Usage().() { |
| 4661 | echoscip-shell system . . echo. "Usage:" |
| 4662 | echoscip-shell system . . echo. "$0 [Option]" |
| 4663 | echoscip-shell system . . echo. "Option:" |
| 4664 | echoscip-shell system . . echo. "-f, --force-yes: force yes, only for Debian-like distribution. It should not be used except in very special situations. Using force-yes can potentially destroy your system!" |
| 4665 | echoscip-shell system . . echo. "-i, --install: install DRBL." |
| 4666 | echoscip-shell system . . echo. "-u, --uninstall: uninstall DRBL." |
| 4667 | echoscip-shell system . . echo. "-v, --verbose: verbose mode." |
| 4668 | echoscip-shell system . . echo. "-t, --testing [y/n]: use packages in testing branch or not." |
| 4669 | echoscip-shell system . . echo. "-a, --unstable [y/n]: use packages in unstable branch or not." |
| 4670 | echoscip-shell system . . echo. "-n, --netinstall [y/n]: install the network installation program or not." |
| 4671 | echoscip-shell system . . echo. "-m, --smp-client [y/n]: use SMP kernel for DRBL clients or not." |
| 4672 | echoscip-shell system . . echo. "-x, --set-proxy [y/n]: set proxy or not." |
| 4673 | echoscip-shell system . . echo. "-c, --console-output [y/n]: set console output for client or not." |
| 4674 | echoscip-shell system . . echo. "-g, --upgrade_system [y/n]: upgrade system or not." |
| 4675 | echoscip-shell system . . echo. "-k, --client_archi [0/1/2]: set the client's CPU arch, 0 for i386, 1 for i586, 2 for same level with DRBL server (for x86_64, use 2)." |
| 4676 | echoscip-shell system . . echo. "-o, --client_kernel_from [1/2]: choose client's kernel image from, 1 from DRBL server running kernel (if available), 2 from ayo repository." |
| 4677 | echoscip-shell system . . echo. "-s, --skip-select-repository: skip the question for selecting repository." |
| 4678 | echoscip-shell system . . echo. "-l, --language N Set the language to be shown, where N:" |
| 4679 | echoscip-shell system . . echo. " 0: English," |
| 4680 | echoscip-shell system . . echo. " 1: Traditional Chinese (Big5) - Taiwan," |
| 4681 | echoscip-shell system . . echo. " 2: Traditional Chinese (UTF-8, Unicode) - Taiwan." |
| 4682 | } |
| 4683 | |
| 4684 | ############# |
| 4685 | ### main #### |
| 4686 | ############# |
| 4687 | check_if_root |
| 4688 | |
| 4689 | # main |
| 4690 | while [scip-shell system . . `[`. $# -gt 0 ]; do |
| 4691 | case "$1" in |
| 4692 | -f|--force-yes) |
| 4693 | shift; apt_extra_opt="--force-yes" |
| 4694 | ;; |
| 4695 | -l|--language) |
| 4696 | shift; specified_lang="$1" |
| 4697 | shift;; |
| 4698 | -i|--install) |
| 4699 | shift; mode="install" |
| 4700 | ;; |
| 4701 | -u|--uninstall) |
| 4702 | shift; mode="uninstall" |
| 4703 | ;; |
| 4704 | -t|--testing) |
| 4705 | shift; drbl_test_answer="$1" |
| 4706 | shift;; |
| 4707 | -a|--unstable) |
| 4708 | shift; drbl_unstable_answer="$1" |
| 4709 | shift;; |
| 4710 | -n|--netinstall) |
| 4711 | shift; drbl_netinstall_answer="$1" |
| 4712 | shift;; |
| 4713 | -m|--smp-client) |
| 4714 | shift; drbl_SMP_answer="$1" |
| 4715 | shift;; |
| 4716 | -s|--skip-select-repository) |
| 4717 | shift; select_repository="no" |
| 4718 | ;; |
| 4719 | -x|--set-proxy) |
| 4720 | shift; set_proxy_answer="$1" |
| 4721 | shift;; |
| 4722 | -c|--console-output) |
| 4723 | shift; console_output_answer="$1" |
| 4724 | shift;; |
| 4725 | -g|--upgrade_system) |
| 4726 | shift; upgrade_system_answer="$1" |
| 4727 | shift;; |
| 4728 | -k|--client_archi) |
| 4729 | shift; client_archi_ans="$1" |
| 4730 | shift;; |
| 4731 | -o|--client_kernel_from) |
| 4732 | shift; chosen_client_kernel_from="$1" |
| 4733 | shift;; |
| 4734 | -y|--yum) |
| 4735 | shift; preferred_installer="yum" |
| 4736 | ;; |
| 4737 | -d|--apt) |
| 4738 | shift; preferred_installer="apt" |
| 4739 | ;; |
| 4740 | -p|--urpmi) |
| 4741 | shift; preferred_installer="urpmi" |
| 4742 | ;; |
| 4743 | -v|--verbose) |
| 4744 | verbose="on" |
| 4745 | verbose_opt="-v" |
| 4746 | shift ;; |
| 4747 | *) |
| 4748 | Usagescip-shell shell shell-project 0.0.0 Usage(). |
| 4749 | exit 1 |
| 4750 | esac |
| 4751 | done |
| 4752 | |
| 4753 | # mode is essential |
| 4754 | [scip-shell system . . `[`. -z "$mode" ] && Usagescip-shell shell shell-project 0.0.0 Usage(). && exit 1 |
| 4755 | |
| 4756 | # |
| 4757 | ask_and_load_lang_set $specified_lang |
| 4758 | |
| 4759 | # |
| 4760 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4761 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4762 | echoscip-shell system . . echo. "$msg_hint_for_answer" |
| 4763 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4764 | |
| 4765 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4766 | # get the distribution name and type: OS_Version and OS_type |
| 4767 | check_distribution_name |
| 4768 | echoscip-shell system . . echo. "$msg_delimiter_star_line" |
| 4769 | |
| 4770 | # |
| 4771 | case "$OS_Version" in |
| 4772 | RH*) |
| 4773 | # For RH/FC, $client_archi_set will be decided by user or system. |
| 4774 | installer="apt" |
| 4775 | ARCH="i386" |
| 4776 | ;; |
| 4777 | FC*|CO*) |
| 4778 | # For RH/FC, $client_archi_set will be decided by user or system. |
| 4779 | # Yum is better is FC3 then that in FC2/FC1, we can use it as one of our |
| 4780 | # installer. |
| 4781 | case "$OS_Version" in |
| 4782 | FC[3-9]|FC[12][0123456789]|CO*) |
| 4783 | # TODO x86_64: CPU arch -> rpm package, which one is real ? |
| 4784 | # "uname -m" or "rpm -q --qf '%{arch\n}' kernel..." |
| 4785 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -m)" = "x86_64" ]; then |
| 4786 | ARCH="x86_64" |
| 4787 | else |
| 4788 | ARCH="i386" |
| 4789 | fi |
| 4790 | # |
| 4791 | if [scip-shell system . . `[`. "$preferred_installer" = "apt" ]; then |
| 4792 | installer="apt" |
| 4793 | else |
| 4794 | installer="yum" |
| 4795 | fi |
| 4796 | ;; |
| 4797 | *) |
| 4798 | # we only support x86 version and use apt for FC2/FC1 |
| 4799 | ARCH="i386" |
| 4800 | installer="apt" |
| 4801 | ;; |
| 4802 | esac |
| 4803 | ;; |
| 4804 | MDK*|MDV*) |
| 4805 | # default installer is urpmi now, no more apt |
| 4806 | installer="urpmi" |
| 4807 | # For MDK, the arch is only i586 or x86_64 |
| 4808 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -m)" = "x86_64" ]; then |
| 4809 | ARCH="x86_64" |
| 4810 | else |
| 4811 | ARCH="i586" |
| 4812 | fi |
| 4813 | ;; |
| 4814 | DBN*) |
| 4815 | # For Debian, $client_archi_set will be decided by user or system. |
| 4816 | installer="apt" |
| 4817 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -m)" = "x86_64" ]; then |
| 4818 | ARCH="amd64" |
| 4819 | else |
| 4820 | ARCH="i386" |
| 4821 | fi |
| 4822 | ;; |
| 4823 | SUSE*) |
| 4824 | # |
| 4825 | case "$OS_Version" in |
| 4826 | SUSE9.3) |
| 4827 | installer="apt" |
| 4828 | ;; |
| 4829 | SUSE10.[0123]|SUSE11.0) |
| 4830 | # For SuSE 10.0 or later, let yum be the default installer |
| 4831 | if [scip-shell system . . `[`. "$preferred_installer" = "apt" ]; then |
| 4832 | installer="apt" |
| 4833 | else |
| 4834 | installer="yum" |
| 4835 | fi |
| 4836 | ;; |
| 4837 | *) # From OpenSuSE 11.1, yum is not available any more. We use zypper. |
| 4838 | installer="zypper" |
| 4839 | ;; |
| 4840 | esac |
| 4841 | |
| 4842 | if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -m)" = "x86_64" ]; then |
| 4843 | ARCH="x86_64" |
| 4844 | else |
| 4845 | ARCH="i386" |
| 4846 | fi |
| 4847 | # Get the version no, OS_Version is like "SUSE10.0", then OS_VER_NO=10.0 |
| 4848 | OS_VER_NO=${OS_Version:4} |
| 4849 | # For OpenSuSE 10.0, the path in yum repo is like |
| 4850 | # http://opensource.nchc.org.tw/opensuse/distribution/SL-10.0-OSS/inst-source/suse/ |
| 4851 | # For OpenSuSE 10.1, it's like (no -OSS): |
| 4852 | # http://opensource.nchc.org.tw/opensuse/distribution/SL-10.1/inst-source/suse/ |
| 4853 | # For OpenSuSE 10.2, it's like (no SL-): |
| 4854 | # http://opensource.nchc.org.tw/opensuse/distribution/10.2/repo/oss/suse/i586/ |
| 4855 | # Hope SuSE will keep this rule. |
| 4856 | # For SuSE 9,3 this variable $OS_PATH_IN_YUM_REPO is useless. |
| 4857 | case "$OS_VER_NO" in |
| 4858 | 10.0) |
| 4859 | OS_PATH_IN_YUM_REPO="SL-${OS_VER_NO}-OSS" |
| 4860 | REPO_PATH="inst-source" |
| 4861 | ;; |
| 4862 | 10.1) |
| 4863 | OS_PATH_IN_YUM_REPO="SL-${OS_VER_NO}" |
| 4864 | REPO_PATH="inst-source" |
| 4865 | ;; |
| 4866 | *) |
| 4867 | OS_PATH_IN_YUM_REPO="${OS_VER_NO}" |
| 4868 | REPO_PATH="repo/oss" |
| 4869 | ;; |
| 4870 | esac |
| 4871 | ;; |
| 4872 | *) |
| 4873 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 4874 | echoscip-shell system . . echo. "This version in this distribution is NOT supported by DRBL, maybe you can try to use the drbl in testing or unstable repository." |
| 4875 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4876 | echoscip-shell system . . echo. "$msg_program_stop" |
| 4877 | exit 1 |
| 4878 | esac |
| 4879 | |
| 4880 | # |
| 4881 | case "$installer" in |
| 4882 | "apt") inst_prog="apt-get" ;; |
| 4883 | "yum") inst_prog="yum" ;; |
| 4884 | "urpmi") inst_prog="urpmi" ;; |
| 4885 | "zypper") inst_prog="zypper" ;; |
| 4886 | *) |
| 4887 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
| 4888 | echoscip-shell system . . echo. "Unknown installer!" |
| 4889 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4890 | echoscip-shell system . . echo. "$msg_program_stop" |
| 4891 | exit 1 |
| 4892 | ;; |
| 4893 | esac |
| 4894 | |
| 4895 | # select_repository is for RH-like and CentOS repository selection. |
| 4896 | # for CentOS, we force to make select_repository="no", we will not put centos |
| 4897 | # yum config in this file |
| 4898 | # for some distributions, we have to force user select the repository |
| 4899 | # for FC3-6, the question is open. For FC7 and later, make select_repository="no". i.e. let use handle the yum repository by himself. Otherwise it's too complicated, it's better to use the one in the system. |
| 4900 | # in the future, maybe we will set all the distribution select_repository="no" |
| 4901 | case "$OS_Version" in |
| 4902 | RH*|FC[1-2]|MD[KV]*) select_repository="yes" ;; |
| 4903 | FC[3456]) select_repository="" ;; |
| 4904 | *) select_repository="no" ;; # for CO, FC7 or later... |
| 4905 | esac |
| 4906 | |
| 4907 | # do it |
| 4908 | case "$mode" in |
| 4909 | install) |
| 4910 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4911 | eval msg=\$msg_install_${OS_type} |
| 4912 | echoscip-shell system . . echo. $msg |
| 4913 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4914 | install_drbl_${OS_type} |
| 4915 | ;; |
| 4916 | uninstall) |
| 4917 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 4918 | eval msg=\$msg_uninstalling_DRBL_${OS_type} |
| 4919 | echoscip-shell system . . echo. $msg |
| 4920 | echoscip-shell system . . echo. "$msg_analyzing_rpm_info" |
| 4921 | [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 4922 | uninstall_drbl_${OS_type} |
| 4923 | ;; |
| 4924 | *) |
| 4925 | Usagescip-shell shell shell-project 0.0.0 Usage(). |
| 4926 | exit 1 |
| 4927 | esac |