Repository 32bit  Forum
Repository 64bit  Wiki

Slackware Chroot AutoBuilder: differenze tra le versioni

Da Slacky.eu.
(Script)
m (Script)
 
(4 revisioni intermedie di un utente non mostrate)
Riga 82: Riga 82:
exit 1
exit 1
fi
fi
if [ "$min_ver" -gt "2" ]; then
+
if [ "$min_ver" -gt "2" ] && [ "$main_ver" != "13" ]; then
echo -e " \E[31mThis version is not exist\E[0m"
echo -e " \E[31mThis version is not exist\E[0m"
exit 1
exit 1
Riga 89: Riga 89:
echo -e " \E[31mThis version is not supported\E[0m"
echo -e " \E[31mThis version is not supported\E[0m"
exit 1
exit 1
  +
fi
  +
if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
  +
continue
fi
fi
elif [ $(uname -m) = x86_64 ]; then
elif [ $(uname -m) = x86_64 ]; then
Riga 104: Riga 107:
exit 1
exit 1
fi
fi
  +
if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
  +
continue
  +
fi
  +
elif [ $arch = 2 ]; then
elif [ $arch = 2 ]; then
if [ "$main_ver" -lt "13" ]; then
if [ "$main_ver" -lt "13" ]; then
Riga 113: Riga 120:
exit 1
exit 1
fi
fi
if [ "$min_ver" -gt "2" ]; then
+
if [ "$min_ver" -gt "2" ] && [ "$main_ver" != "13" ]; then
echo -e " \E[31mThis version is not exist\E[0m"
echo -e " \E[31mThis version is not exist\E[0m"
exit 1
exit 1
  +
fi
  +
if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
  +
continue
fi
fi
fi
fi
Riga 281: Riga 291:
echo
echo
echo " Installation was aborted"
echo " Installation was aborted"
  +
rm -rf $chrootdir
exit 1
exit 1
;;
;;
Riga 292: Riga 303:
echo
echo
echo -n " Downloading $DISTRO... "
echo -n " Downloading $DISTRO... "
wget -c -r --exclude-directories=/$SLACK-$version/slackware/kdei --cut-dirs=2 ftp://$URL/$SLACK-$version/slackware/* > /dev/null 2>&1
+
wget -c -r --exclude-directories=/$SLACK-$version/$SLACK/kdei --cut-dirs=2 ftp://$URL/$SLACK-$version/$SLACK/* > /dev/null 2>&1
mv ftp.slackware.at/* /tmp/$SLACKDIR
mv ftp.slackware.at/* /tmp/$SLACKDIR
rm -rf ftp.slackware.at
rm -rf ftp.slackware.at
Riga 305: Riga 316:
echo
echo
echo -n " Downloading core packages... "
echo -n " Downloading core packages... "
wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/slackware/a/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/$SLACK/a/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/slackware/ap/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/$SLACK/ap/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/slackware/d/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/$SLACK/d/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/slackware/e/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/$SLACK/e/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/slackware/f/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/$SLACK/f/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/slackware/k/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/$SLACK/k/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/slackware/l/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/$SLACK/l/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/slackware/n/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/$SLACK/n/*.t?z > /dev/null 2>&1
echo -e "\E[32mDONE\E[32m"
echo -e "\E[32mDONE\E[32m"
;;
;;
Riga 322: Riga 333:
mkdir -p $DIRPKGS
mkdir -p $DIRPKGS
echo -n " Downloading core packages... "
echo -n " Downloading core packages... "
wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/slackware/a/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/$SLACK/a/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/slackware/ap/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/$SLACK/ap/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/slackware/d/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/$SLACK/d/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/slackware/e/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/$SLACK/e/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/slackware/f/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/$SLACK/f/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/slackware/k/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/$SLACK/k/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/slackware/l/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/$SLACK/l/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/slackware/n/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/$SLACK/n/*.t?z > /dev/null 2>&1
echo "\E[32mDONE\E[0m"
echo "\E[32mDONE\E[0m"
echo -n " Downloading extras... "
echo -n " Downloading extras... "
wget -c --directory-prefix=/tmp/$SLACKDIR/T ftp://$URL/$SLACK-$version/slackware/t/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/T ftp://$URL/$SLACK-$version/$SLACK/t/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/TCL ftp://$URL/$SLACK-$version/slackware/tcl/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/TCL ftp://$URL/$SLACK-$version/$SLACK/tcl/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/X ftp://$URL/$SLACK-$version/slackware/x/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/X ftp://$URL/$SLACK-$version/$SLACK/x/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/XAP ftp://$URL/$SLACK-$version/slackware/xap/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/XAP ftp://$URL/$SLACK-$version/$SLACK/xap/*.t?z > /dev/null 2>&1
wget -c --directory-prefix=/tmp/$SLACKDIR/Y ftp://$URL/$SLACK-$version/slackware/y/*.t?z > /dev/null 2>&1
+
wget -c --directory-prefix=/tmp/$SLACKDIR/Y ftp://$URL/$SLACK-$version/$SLACK/y/*.t?z > /dev/null 2>&1
echo "\E[32mDONE\E[0m"
echo "\E[32mDONE\E[0m"
;;
;;
Riga 351: Riga 362:
if [ $type = F -o $type = f ]; then
if [ $type = F -o $type = f ]; then
mkdir -p /tmp/$SLACKDIR/kdei
mkdir -p /tmp/$SLACKDIR/kdei
cd /tmp/Slack_$version/kdei
+
cd /tmp/$SLACKDIR/kdei
echo
echo
echo -e "\E[1;34m>\E[0;0m \E[1mKDE SC and KOffice localization\E[0m"
echo -e "\E[1;34m>\E[0;0m \E[1mKDE SC and KOffice localization\E[0m"
Riga 758: Riga 769:
if [ $lang != 0 ] && [ $lang != 59 ]; then
if [ $lang != 0 ] && [ $lang != 59 ]; then
echo -n " Downloading language pack... "
echo -n " Downloading language pack... "
wget -c ftp://$URL/$SLACK-$version/slackware/kdei/*$KDEI*.t?z > /dev/null 2>&1
+
wget -c ftp://$URL/$SLACK-$version/$SLACK/kdei/*$KDEI*.t?z > /dev/null 2>&1
elif [ $lang = 59 ]; then
elif [ $lang = 59 ]; then
echo -n " Downloading KDEI... "
echo -n " Downloading KDEI... "
wget -c ftp://$URL/$SLACK-$version/slackware/kdei/*.t?z > /dev/null 2>&1
+
wget -c ftp://$URL/$SLACK-$version/$SLACK/kdei/*.t?z > /dev/null 2>&1
fi
fi
if [ $lang != 0 ]; then
if [ $lang != 0 ]; then
Riga 779: Riga 790:
echo " This step provide to install security patches automatically."
echo " This step provide to install security patches automatically."
echo " If you choose Basic installation isn't recommended to install"
echo " If you choose Basic installation isn't recommended to install"
echo " them automatically because some of patches is part of X,XAP"
+
echo " them automatically because some of patches are part of X,XAP"
echo " or another section wich you don't installed."
echo " or another section wich you don't installed."
echo " In this case it's recommended to download them manually."
echo " In this case it's recommended to download them manually."
Riga 820: Riga 831:
# Copy host name and host partition table
# Copy host name and host partition table
  +
echo
echo -ne "\E[1;34m>\E[0;0m \E[1mConfiguring $DISTRO... \E[0m"
echo -ne "\E[1;34m>\E[0;0m \E[1mConfiguring $DISTRO... \E[0m"
cp -a $HOSTFILE $chrootdir/etc/hosts
cp -a $HOSTFILE $chrootdir/etc/hosts

Versione attuale delle 15:03, 3 giu 2011

Indice

[modifica] Introduzione

Lo Slackware Chroot Environment AutoBuilder è uno script che permette di effettuare un'installazione della distribuzione Slackware GNU/Linux in un ambiente di chroot. Per capire di questo script è necessario avere almeno conoscenze basilari sul chroot. Per avere informazioni al riguardo rimando a man chroot.

[modifica] Vantaggi di un chroot rispetto ad una Macchina Virtuale

Molti usano le macchine virtuali per poter utilizzare due o più sistemi operativi contemporaneamente. Ma questo comporta notevoli cali prestazionali in quanto il Sistema Operativo ospitante (host) deve dividere le risorse hardware con i sistemi virtualizzati (guest). Con il chroot invece si ha la possibilità di eseguire più distribuzioni sulla stessa macchina senza perdita di prestazioni. Questo è utile se come me siete dei packager che usano una Slackware -current per l'uso quotidiano e devono avere una stabile full e pulita per i pacchetti. Questo script però è pensato anche per usi diversi dal packagement. Ad esempio, chi volesse usare Apache in un ambiente chiuso per ragioni di sicurezza può farlo tranquillamente utilizzando l'ambiente di chroot. Proprio per questo lo script vi da la possibilità di scegliere il tipo di installazione da effettuare.

[modifica] Lo script

[modifica] Requisiti

Per utilizzare lo script è necessario essere root ed avere almeno 7 GiB di spazio libero sulla vostra / (ovviamente lo spazio occupato sarà inferiore in quanto verrà successivamente eliminata la cache e inoltre lo spazio occupato varierà in base al tipo di installazione richiesta). È richiesto un emulatore di terminale dalle dimensioni minime di 80x24 (se usate la console di sistema non ci sono problemi).

[modifica] Distribuzioni supportate

Lo script supporta solo Slackware Linux e può essere usato solo in ambiente Slackware. Le versioni ufficialmente supportate sono: 10.2 e successive, compresa -current. Supporta anche Slackware64 (tutte le versioni compresa -current) ---> NOTA: Il supporto a x86_64 non è stato testato, in quanto possiedo un i686, pertanto se avete una CPU 64 bit vi sarei grato se testaste questa funzionalità e inviaste i commenti nel topic: http://www.slacky.eu/forum/viewtopic.php?f=1&t=32951

[modifica] Script

#!/bin/sh
# Thanks to conraid, zoros, Ansa89, kobaiachi and metrofox for improvements
#
# <Chroot Environment AutoBuilder for Slackware Stable and -current x86/x86_64>
#     Copyright (C) <2010>  <Luca De Pandis>  <http://www.slacky.eu>           
#                                                                              
#     This program is free software: you can redistribute it and/or modify     
#     it under the terms of the GNU General Public License as published by     
#     the Free Software Foundation, either version 3 of the License, or        
#     (at your option) any later version.                                      
# 									      
#     This program is distributed in the hope that it will be useful,          
#     but WITHOUT ANY WARRANTY; without even the implied warranty of           
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
#     GNU General Public License for more details.                             
# 									      
#     You should have received a copy of the GNU General Public License        
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.    

# Exit on most errors
set -e

# Set variables
HOSTFILE=${HOSTFILE:-/etc/hosts}
FSTABFILE=${FSTABFILE:-/etc/fstab}
SPACE_REQUIRED=7 # GByte

# Set functions
space_check()
{
     SPACE=$(df -P -m /tmp 2> /dev/null | tr -s ' ' | cut -f4 -d' ' | tail -1)
     if [ -z "$SPACE" ]; then
       echo 2 #error
     elif [ $(expr $SPACE - $SPACE_REQUIRED) -gt 0 ]; then
       echo 1
     else
       echo 0
     fi
}

connection_check()
{
     if ping -c2 ftp.slackware.at > /dev/null 2>&1 ; then
        echo -e "\E[32mOK\E[0m"
        URL=${URL:-ftp.slackware.at}
     elif ping -c2 ftp.slackware.hu > /dev/null 2>&1 ; then
        echo -e "\E[32mOK\E[0m"
        URL=${URL:-ftp.slackware.hu}
     else
        ERRNUM=$?
        echo -e "\E[31mFAIL\E[0m"
        exit $ERRNUM
     fi
}

version_check()
{
    version=$main_ver.$min_ver
    if [ $(uname -m) = i486 -o $(uname -m) = i586 -o $(uname -m) = i686 ]; then
         if [ "$main_ver" -lt "10" ]; then
             echo -e "    \E[31mThis version is not supported\E[0m"
             exit 1
         fi
         if [ "$min_ver" -gt "2" ] && [ "$main_ver" != "13" ]; then
             echo -e "    \E[31mThis version is not exist\E[0m"
             exit 1
         fi
         if [ "$min_ver" -lt "2" ] && [ "$main_ver" -le "10" ]; then
             echo -e "    \E[31mThis version is not supported\E[0m"
             exit 1
         fi
         if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
             continue
         fi
    elif [ $(uname -m) = x86_64 ]; then
        if [ $arch = 1 ]; then
             if [ "$main_ver" -lt "10" ]; then
                 echo -e "    \E[31mThis version is not supported\E[0m"
                 exit 1
             fi
             if [ "$min_ver" -lt "2" ] && [ "$main_ver" -le "10" ]; then
                 echo -e "    \E[31mThis version is not supported\E[0m"
                 exit 1
             fi
             if [ "$min_ver" -gt "2" ]; then
                 echo -e "    \E[31mThis version is not exist\E[0m"
                 exit 1
             fi
             if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
                 continue
             fi
                 
        elif [ $arch = 2 ]; then
             if [ "$main_ver" -lt "13" ]; then
                 echo -e "    \E[31mThis version is not exist\E[0m"
                 exit 1
             fi
             if [ "$min_ver" -lt "0" ] && [ "$main_ver" -le "13" ]; then
                 echo -e "    \E[31mThis version is not exist\E[0m"
                 exit 1
             fi
             if [ "$min_ver" -gt "2" ] && [ "$main_ver" != "13" ]; then
             echo -e "    \E[31mThis version is not exist\E[0m"
             exit 1
             fi
             if [ "$main_ver" = "13"] && [ "$min_ver" = "37" ]; then
                 continue
             fi
        fi
    fi
}

architecture_check()
{
     if [ $(uname -m) = i386 ]; then
          echo -e "    \E[31mThis architecture is not more supported\E[0m"
          exit 1
     elif [ $(uname -m) = i486 -o $(uname -m) = i586 -o $(uname -m) = i686 ]; then
         SLACK=slackware
         DISTRO=Slackware
     elif [ $(uname -m) = x86_64 ]; then
         echo
         echo -e "\E[1;34m>\E[0;0m \E[1mSelect the architecture for Slackware\E[0m"
         echo
         echo "    [1] x86"
         echo "    [2] x86_64"
         echo
         echo -n "    Option: "
         read arch

         case "$arch" in

             "1" )
             SLACK=slackware
             DISTRO=Slackware
             ;;

             "2" )
             SLACK=slackware64
             DISTRO=Slackware64
             ;;

         esac    
      fi
}

user_check()
{
     if [ $(whoami) != "root" ]; then
       echo -e "\E[31mThis script need root privileges\E[0m"
       exit 1
     fi
}

pkgdir_set()
{
     if [ $(uname -m) = i486 -o $(uname -m) = i586 -o $(uname -m) = i686 ]; then
         SLACKDIR=Slack_$version
     elif [ $(uname -m) = x86_64 ]; then
         if [ $arch = 1 ]; then
             SLACKDIR=Slack_$version
         elif [ $arch = 2 ]; then
             SLACKDIR=Slack64_$version
         fi
     fi
}

capability_check()
{
     if [ $(uname -m) = x86_64 ]; then
         if [ $arch = 2 ]; then
             if [ -d /lib64 ]; then
                 continue
             else
                 echo -e "\E[31m    You can't chroot Slackware64 on a Slackware x86.\E[0m"
                 echo -e "\E[31m    If you want to use this version, install Slackware64\E[0m"
                 echo -e "\E[31m    as host OS or use Virtual Machine.\E[0m"
                 exit 1
             fi
         fi
     fi
}

# Main Script
user_check
clear
echo
echo -e "\E[36m+----------------------------------+\E[0m"
echo -e "\E[36m|  StArTiNg ChRoOt AuToBuIlDeR...  |\E[0m"
echo -e "\E[36m+----------------------------------+\E[0m"
architecture_check
capability_check
echo
echo
echo -e "\E[1;34m>\E[0;0m \E[1mSelect your chroot directory\E[0m"
echo
echo "    Write a path for your chroot"
echo
echo -n "    Path: "
read chrootdir
echo
echo -e "\E[1;34m>\E[0;0m \E[1mSelect your $DISTRO\E[0m"
echo
echo "    Please choose the version of $DISTRO wich you want to chroot." 
echo "    For example: if you want to chroot a $DISTRO -current you must"
echo "    write current. Select first the main version"
echo "    (For example: 13) and later select the minor version (For example:"
echo "    1). If you choose $DISTRO -current you can't choose the minor"
echo "    version. (CTRL+D for exit)."
echo
echo -n "    Main version: "
read main_ver
if [ $main_ver != current ]; then
    echo -n "    Minor version: " 
    read min_ver
    version_check
elif [ $main_ver = current ]; then
    version=$main_ver
fi
pkgdir_set
echo
echo
echo "This script will install $DISTRO $version in a chroot environment."
echo "The estimated time for completion of the transaction is 80 minutes,"
echo "but it may vary depending on the configuration of the computer."
echo
echo -e "\E[33m[WARNING] you'll need about ${SPACE_REQUIRED} GiB in / to run this script [WARNING]\E[0m"
echo -e "\E[33m[WARNING] it's recommended a fast internet connection for download [WARNING]\E[0m"

# Remove directories if that is necessary
echo
echo -ne "\E[1;34m>\E[0;0m \E[1mChecking for directories... \E[0m"
rm -rf /tmp/Slack_*
rm -rf $chrootdir
mkdir -p /tmp/$SLACKDIR
mkdir -p $chrootdir
echo -e "\E[32mDONE\E[0m"

# Check available space on hard disk
echo -ne "\E[1;34m>\E[0;0m \E[1mChecking for space... \E[0m"
CHECK=$(space_check)
if [ $CHECK = 0 -o $CHECK = 2 ]; then
  echo -e "\E[31mFAIL\E[0m"
  exit 1
else
  echo -e "\E[32mOK\E[0m"
fi

# Ping Mirror
echo -ne "\E[1;34m>\E[0;0m \E[1mChecking for mirror... \E[0m"
connection_check

# Choose your installation type
cd /tmp/$SLACKDIR/
echo
echo -e "\E[1;34m>\E[0;0m \E[1m$DISTRO Linux $version Setup\E[0m"
echo
echo "    Choose installation type"
echo
echo "    [F] Full Installation (Standard + KDE)"
echo "    [B] Basic (Only A,AP,D,E,F,K,L and N package series)"
echo "    [S] Standard (Basic + T,TCL,X,XAP,Y)"
echo "    [E] Exit"
echo
echo -n "    Installation type: "
read type

case "$type" in
  
  "E" | "e" )
  echo
  echo "    Installation was aborted"
  rm -rf $chrootdir
  exit 1
  ;;
  
  "F" | "f" )
  echo
  echo "    Full installation mode selected"
  echo
  echo -e "    \E[33m[WARNING] The full mode installation may take several minutes.[WARNING]\E[0m"
  echo -e "    \E[33m[WARNING] So please wait until the operation completes. [WARNING]\E[0m"
  echo
  echo -n "    Downloading $DISTRO... "
  wget -c -r --exclude-directories=/$SLACK-$version/$SLACK/kdei --cut-dirs=2 ftp://$URL/$SLACK-$version/$SLACK/* > /dev/null 2>&1 
  mv ftp.slackware.at/* /tmp/$SLACKDIR
  rm -rf ftp.slackware.at
  echo -e "\E[32mDONE\E[0m"
  ;;

  "B" | "b" )
  DIRPKGS="A AP D E F K L N"
  echo
  echo "    Basic installation mode selected"
  mkdir -p $DIRPKGS
  echo
  echo -n "    Downloading core packages... "
  wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/$SLACK/a/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/$SLACK/ap/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/$SLACK/d/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/$SLACK/e/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/$SLACK/f/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/$SLACK/k/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/$SLACK/l/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/$SLACK/n/*.t?z > /dev/null 2>&1
  echo -e "\E[32mDONE\E[32m"
  ;;

  "S" | "s" )
  DIRPKGS="A AP D E F K L N T TCL X XAP Y"
  echo
  echo "    Standard installation mode selected"
  mkdir -p $DIRPKGS
  echo -n "    Downloading core packages... "
  wget -c --directory-prefix=/tmp/$SLACKDIR/A ftp://$URL/$SLACK-$version/$SLACK/a/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/AP ftp://$URL/$SLACK-$version/$SLACK/ap/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/D ftp://$URL/$SLACK-$version/$SLACK/d/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/E ftp://$URL/$SLACK-$version/$SLACK/e/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/F ftp://$URL/$SLACK-$version/$SLACK/f/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/K ftp://$URL/$SLACK-$version/$SLACK/k/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/L ftp://$URL/$SLACK-$version/$SLACK/l/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/N ftp://$URL/$SLACK-$version/$SLACK/n/*.t?z > /dev/null 2>&1
  echo "\E[32mDONE\E[0m"
  echo -n "    Downloading extras... "
  wget -c --directory-prefix=/tmp/$SLACKDIR/T ftp://$URL/$SLACK-$version/$SLACK/t/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/TCL ftp://$URL/$SLACK-$version/$SLACK/tcl/*.t?z > /dev/null 2>&1 
  wget -c --directory-prefix=/tmp/$SLACKDIR/X ftp://$URL/$SLACK-$version/$SLACK/x/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/XAP ftp://$URL/$SLACK-$version/$SLACK/xap/*.t?z > /dev/null 2>&1
  wget -c --directory-prefix=/tmp/$SLACKDIR/Y ftp://$URL/$SLACK-$version/$SLACK/y/*.t?z > /dev/null 2>&1
  echo "\E[32mDONE\E[0m"
  ;;

esac

echo -n "    Installing $DISTRO... "
installpkg -root $chrootdir */*.t?z > /dev/null 2>&1
echo -e "\E[32mDONE\E[0m"
echo
echo "    $DISTRO $version was installed successfully"

# Choose localization
if [ $type = F -o $type = f ]; then
  mkdir -p /tmp/$SLACKDIR/kdei
  cd /tmp/$SLACKDIR/kdei
  echo
  echo -e "\E[1;34m>\E[0;0m \E[1mKDE SC and KOffice localization\E[0m"
  echo
  echo "    if you selected Full mode installation you can choose"
  echo "    to install the kdei section"   
  echo
  echo -e "    [0] I don't want kdei\t\t[1] Arabic"
  echo -e "    [2] Bulgarian\t\t\t[3] Catalan"
  echo -e "    [4] Catalan (Valencian)\t\t[5] Czech"
  echo -e "    [6] Kashubian\t\t\t[7] Danish"
  echo -e "    [8] German\t\t\t\t[9] Greek"
  echo -e "    [10] English (UK)\t\t\t[11] Esperanto"
  echo -e "    [12] Spanish\t\t\t[13] Estonian"
  echo -e "    [14] Basque\t\t\t\t[15] Finnish"
  echo -e "    [16] French\t\t\t\t[17] Abkhasysk"
  echo -e "    [18] Irish\t\t\t\t[19] Galician"
  echo -e "    [20] Gujarati\t\t\t[21] Hebrew"
  echo -e "    [22] Hindi\t\t\t\t[23] Croatian"
  echo -e "    [24] Hungarian\t\t\t[25] Indonesian"
  echo -e "    [26] Icelandic\t\t\t[27] Italian"
  echo -e "    [28] Japanese\t\t\t[29] Kazakh"
  echo -e "    [30] Khmer\t\t\t\t[31] Kannada"
  echo -e "    [32] Korean\t\t\t\t[33] Lithuanian"
  echo -e "    [34] Latvian\t\t\t[35] Maithili"
  echo -e "    [36] Macedonian\t\t\t[37] Malayam"
  echo -e "    [38] Norwegian (Bokmaal)\t\t[39] Low Saxon"
  echo -e "    [40] Dutch\t\t\t\t[41] Norwegian (Nynorsk)"
  echo -e "    [42] Punjabi\t\t\t[43] Polish"
  echo -e "    [44] Portuguese\t\t\t[45] Brasil"
  echo -e "    [46] Romanian\t\t\t[47] Russian"
  echo -e "    [48] Sinhala\t\t\t[49] Slovak"
  echo -e "    [50] Slovenian\t\t\t[51] Serbian"
  echo -e "    [52] Swedish\t\t\t[53] Tajik"
  echo -e "    [54] Turkish\t\t\t[55] Ukrainan"
  echo -e "    [56] Walloon\t\t\t[57] Simplified Chinese"
  echo -e "    [58] Chinese\t\t\t[59] All kdei packages"
  echo
  echo -n "    Language n.: "
  read lang

  case "$lang" in

    "0" )
    echo
    echo "    Skip kdei installation"
    rm -rf /tmp/$SLACKDIR/kdei
    continue
    ;;

    "1" )
    echo
    echo "    Arabic selected"
    KDEI=ar
    ;;
   
    "2" )
    echo
    echo "    Bulgarian selected"
    KDEI=bg
    ;;
   
    "3" )
    echo
    echo "    Catalan selected"
    KDEI=ca
    ;;

    "4" )
    echo
    echo "    Catalan (Valencian) selected"
    KDEI=ca@valencia
    ;;
   
    "5" )
    echo
    echo "    Czech selected"
    KDEI=cs
    ;;

    "6" )
    echo
    echo "    Kashubian selected"
    KDEI=csb
    ;;
   
    "7" )
    echo
    echo "    Danish selected"
    KDEI=da
    ;;

    "8" )
    echo
    echo "    German selected"
    KDEI=de
    ;;
   
    "9" )
    echo
    echo "    Greek selected"
    KDEI=el
    ;;

    "10" )
    echo
    echo "    English (UK) selected"
    KDEI=en_GB
    ;;
   
    "11" )
    echo
    echo "    Esperanto selected"
    KDEI=eo
    ;;

    "12" )
    echo
    echo "    Spanish selected"
    KDEI=es
    ;;
   
    "13" )
    echo
    echo "    Estonian selected"
    kdei=et
    ;;

    "14" )
    echo
    echo "    Basque selected"
    KDEI=eu
    ;;
   
    "15" )
    echo
    echo "    Finnish selected"
    KDEI=fi
    ;;

    "16" )
    echo
    echo "    French selected"
    KDEI=fr
    ;;
   
    "17" )
    echo
    echo "    Abkhasysk selected"
    KDEI=fy
    ;;

    "18" )
    echo
    echo "    Irish selected"
    KDEI=ga
    ;;
   
    "19" )
    echo
    echo "    Galician selected"
    KDEI=gl
    ;;

    "20" )
    echo
    echo "    Gujarati selected"
    KDEI=gu
    ;;
   
    "21" )
    echo
    echo "    Hebrew selected"
    KDEI=he
    ;;

    "22" )
    echo
    echo "    Hindi selected"
    KDEI=hi
    ;;
   
    "23" )
    echo
    echo "    Croatian selected"
    KDEI=hr
    ;;

    "24" )
    echo
    echo "    Hungarian selected"
    KDEI=hu
    ;;
   
    "25" )
    echo
    echo "    Indonesian selected"
    KDEI=id
    ;;

    "26" )
    echo
    echo "    Icelandic selected"
    KDEI=is
    ;;
   
    "27" )
    echo
    echo "    Italian selected"
    KDEI=it
    ;;

    "28" )
    echo
    echo "    Japanese selected"
    KDEI=ja
    ;;
   
    "29" )
    echo
    echo "    Kazakh selected"
    KDEI=kk
    ;;

    "30" )
    echo
    echo "    Khmer selected"
    KDEI=km
    ;;
   
    "31" )
    echo
    echo "    Kannada selected"
    KDEI=kn
    ;;

    "32" )
    echo
    echo "    Korean selected"
    KDEI=ko
    ;;
   
    "33" )
    echo
    echo "    Lithuanian selected"
    KDEI=lt
    ;;

    "34" )
    echo
    echo "    Latvian selected"
    KDEI=lv
    ;;
   
    "35" )
    echo
    echo "    Maithili selected"
    KDEI=mai
    ;;

    "36" )
    echo
    echo "    Macedonian selected"
    KDEI=mk
    ;;
   
    "37" )
    echo
    echo "    Malayam selected"
    KDEI=ml
    ;;

    "38" )
    echo
    echo "    Norwegian (Bokmaal) selected"
    KDEI=nb
    ;;
   
    "39" )
    echo
    echo "    Low Saxon selected"
    KDEI=nds
    ;;

    "40" )
    echo
    echo "    Dutch selected"
    KDEI=nl
    ;;
   
    "41" )
    echo
    echo "    Norwegian (Nynorsk) selected"
    KDEI=nn
    ;;

    "42" )
    echo
    echo "    Punjabi selected"
    KDEI=pa
    ;;
   
    "43" )
    echo
    echo "    Polish selected"
    KDEI=pl
    ;;

    "44" )
    echo
    echo "    Portuguese selected"
    KDEI=pt
    ;;
   
    "45" )
    echo
    echo "    Brasil selected"
    KDEI=pt_BR
    ;;

    "46" )
    echo
    echo "    Romanian selected"
    KDEI=ro
    ;;
   
    "47" )
    echo
    echo "    Russian selected"
    KDEI=ru
    ;;

    "48" )
    echo
    echo "    Sinhala selected"
    KDEI=si
    ;;
   
    "49" )
    echo
    echo "    Slovak selected"
    KDEI=sk
    ;;

    "50" )
    echo
    echo "    Slovenian selected"
    KDEI=sl
    ;;
   
    "51" )
    echo
    echo "    Serbian selected"
    KDEI=sr
    ;;

    "52" )
    echo
    echo "    Swedish selected"
    KDEI=sv
    ;;
   
    "53" )
    echo
    echo "    Tajik selected"
    KDEI=tg
    ;;

    "54" )
    echo
    echo "    Turkish selected"
    KDEI=tr
    ;;
   
    "55" )
    echo
    echo "    Ukrainan selected"
    KDEI=uk
    ;;

    "56" )
    echo
    echo "    Walloon selected"
    KDEI=wa
    ;;

    "57" )
    echo
    echo "    Simplified Chinese selected"
    KDEI=zh_CN
    ;;
   
    "58" )
    echo
    echo "    Chinese selected"
    KDEI=zh_TW
    ;;

    "59" )
    echo
    echo "    All kdei packages selcted"
    ;;

  esac

  if [ $lang != 0 ] && [ $lang != 59 ]; then
    echo -n "    Downloading language pack... "
    wget -c ftp://$URL/$SLACK-$version/$SLACK/kdei/*$KDEI*.t?z > /dev/null 2>&1
  elif [ $lang = 59 ]; then
    echo -n "    Downloading KDEI... "
    wget -c ftp://$URL/$SLACK-$version/$SLACK/kdei/*.t?z > /dev/null 2>&1
  fi
  if [ $lang != 0 ]; then
    echo -e "\E[32mDONE\E[0m"
    echo -n "    Installing localization... "
    installpkg -root $chrootdir *.t?z > /dev/null 2>&1
    echo -e "\E[32mDONE\E[0m"
  fi

fi

# Download and install patches
if [ $main_ver != current ]; then
  echo
  echo -e "\E[1;34m>\E[0;0m \E[1mSecurity patches for $DISTRO $version\E[0m"
  echo
  echo "    This step provide to install security patches automatically."
  echo "    If you choose Basic installation isn't recommended to install"
  echo "    them automatically because some of patches are part of X,XAP"
  echo "    or another section wich you don't installed."
  echo "    In this case it's recommended to download them manually."
  echo
  echo "    [Y] Yes download patches now"
  echo "    [N] No, i download patches manually later"
  echo
  echo -n "    Would you install slackware patches? "
  read patch

  case "$patch" in

    "Y" | "y" )
    echo
    echo -n "    Downloading patches... "
    mkdir -p /tmp/$SLACKDIR/patches
    cd /tmp/$SLACKDIR/patches
    wget -c -r --cut-dirs=3 ftp://$URL/$SLACK-$version/patches/packages/* > /dev/null 2>&1
    mv ftp.slackware.at/* /tmp/$SLACKDIR/patches
    rm -rf ftp.slackware.at
    echo -e "\E[32mDONE\E[0m"
    echo -n "    Patching $DISTRO... "
    ROOT=$chrootdir upgradepkg --reinstall --install-new *.t?z > /dev/null 2>&1
    if [ -d linux-* ]; then
        cd linux-*
        ROOT=$chrootdir upgradepkg --reinstall --install-new *.t?z > /dev/null 2>&1
    fi
    echo -e "\E[32mDONE\E[0m"
    ;;

    "N" | "n" )
    echo
    echo -n "Skip patches integration"
    continue
    ;;
   
  esac

fi

# Copy host name and host partition table
echo
echo -ne "\E[1;34m>\E[0;0m \E[1mConfiguring $DISTRO... \E[0m"
cp -a $HOSTFILE $chrootdir/etc/hosts
cp -a $FSTABFILE $chrootdir/etc/fstab
echo -e "\E[32mDONE\E[0m"

# Remove packages
echo -ne "\E[1;34m>\E[0;0m \E[1mCleaning Cache... \E[0m"
cd /tmp
rm -r /tmp/$SLACKDIR
echo -e "\E[32mDONE\E[0m"

# End script
echo
echo -e "\E[1;32mFinish!!!\E[0;0m"
echo
echo -e "\E[36m+----------------------------------+\E[0m"
echo -e "\E[36m|  Thank you for using my builder  |\E[0m"
echo -e "\E[36m+----------------------------------+\E[0m"
echo
echo "#####################################################"
echo " If you want to start this chroot environment:"
echo -e "\E[1m mount -o bind /proc $chrootdir/proc\E[0m"
echo -e "\E[1m mount -o bind /dev $chrootdir/dev\E[0m"
echo -e "\E[1m chroot $chrootdir /bin/bash\E[0m"
echo
echo " If you want have more info about chroot, read:"
echo -e "\E[1m man chroot\E[0m"
echo "#####################################################"

Salvatelo in un file chiamato autochroot.sh

--Atomix600 19:08, 22 set 2010 (UTC)

Strumenti personali
Namespace

Varianti