Repository 32bit  Forum
Repository 64bit  Wiki

Script per un chroot

Forum dedicato alla programmazione.

Moderatore: Staff

Regole del forum
1) Citare in modo preciso il linguaggio di programmazione usato.
2) Se possibile portare un esempio del risultato atteso.
3) Leggere attentamente le risposte ricevute.
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.

La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.

Re: Script per un chroot

Messaggioda hashbang » mar ago 24, 2010 11:09

Codice: Seleziona tutto
#!/bin/sh

# Chroot Environment AutoBuilder
# Copyright (C) 2010 Luca De Pandis aka atomix600
# All rights reserved.
# Contact me @ Slacky.eu ( http://www.slacky.eu )
#
# Heavily based on the Tom Newsom's Chroot Howto ( http://slackworld.berlios.de/2007/chroot_howto.html )
#
# Thanks to conraid, zoros, kobaiachi and metrofox for improvements
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Exit on most errors
set -e

# Set variables
CHROOTDIR=${CHROOTDIR:-/mnt/chroot}
MIRROR=${MIRROR:-ftp.slackware.at}
HOSTFILE=${HOSTFILE:-/etc/hosts}
FSTABFILE=${FSTABFILE:-/etc/fstab}
SPACE_REQUIRED=7 # GByte

# Set Functions
check_space_on_hd()
{
     SPACE=$(df -P -m $PKGDIR 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 $MIRROR > /dev/null 2>&1 ; then
   echo "OK"
else
        ERRNUM=$?
        echo "FAIL"
        exit $?
fi
}

# Main Script
echo "+----------------------------------+"
echo "|  StArTiNg ChRoOt AuToBuIlDeR...  |"
echo "+----------------------------------+"

echo
echo "Select your Slackware"
echo
echo "Please choose the version of Slackware wich you want to chroot."
echo "For example: if you want to chroot a Slackware-current you must"
echo "write current. (CTRL+D for exit)"
echo
echo -n "Slackware version: "
read version
echo "Slackware version is selected: $version"
echo
echo "This script will install Slackware $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 "[WARNING] you'll need about ${SPACE_REQUIRED} GiB in / to run this script [WARNING]"
echo "[WARNING] it's recommended a fast internet connection for download [WARNING]"

# Remove directories if that is necessary
echo
echo -n "Checking for directories... "
rm -rf /tmp/Slack_*
rm -rf $CHROOTDIR
mkdir -p /tmp/Slack_$version
echo "DONE"

# Check available space on hard disk
echo -n "Checking for space... "
CHECK=$(check_space_on_hd)
if [ $CHECK = 0 -o $CHECK = 2 ]; then
  echo "FAIL"
else
  echo "OK"
fi

# Ping Mirror
echo -n "Checking for mirror... "
connection_check

# Choose your installation type
echo
echo "Slackware Linux $version Setup"
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 "Exiting from installer..."
  exit 1
  ;;
 
  "F" | "f" )
  echo
  echo "Full installation mode selected"
  echo "[WARNING] The full mode installation may take several minutes. So please wait until the operation completes. [WARNING]"
  echo -n "Downloading Slackware... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 --exclude-directories=slackware-$version/slackware/kdei ftp://slackware.at/slackware-$version/slackware/* > /dev/null 2>&1
  echo "DONE"
  ;;

  "B" | "b" )
  echo
  echo "Basic installation mode selected"
  echo "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;

  "S" | "s" )
  echo
  echo "Standard installation mode selected"
  echo -n "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  echo "DONE"
  echo -n "Downloading extras... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/t/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/tcl/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/x/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/xap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/y/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;
 
esac

echo -n "Installing Slackware... "
cd /tmp/Slack_$version/slackware.at
installpkg -root $CHROOTDIR */*.t?z > /dev/null 2>&1
echo "DONE"
echo "Slackware $version was installed successfully"

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

  case "$lang" in

    "0" )
    echo
    echo "Skip kdei installation"
    rm -rf /tmp/Slack_$version/slackware.at/kdei
    continue
    ;;
 
    "1" )
    echo
    echo "Arabic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ar*.t?z > /dev/null 2>&1
    ;;
   
    "2" )
    echo
    echo "Bulgarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*bg*.t?z > /dev/null 2>&1
    ;;
   
    "3" )
    echo
    echo "Catalan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca*.t?z > /dev/null 2>&1
    ;;

    "4" )
    echo
    echo "Catalan (Valencian) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca@valencia*.t?z > /dev/null 2>&1
    ;;
   
    "5" )
    echo
    echo "Czech selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*cs*.t?z > /dev/null 2>&1
    ;;

    "6" )
    echo
    echo "Kashubian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*csb*.t?z > /dev/null 2>&1
    ;;
   
    "7" )
    echo
    echo "Danish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*da*.t?z > /dev/null 2>&1
    ;;

    "8" )
    echo
    echo "German selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*de*.t?z > /dev/null 2>&1
    installpkg *de*.t?z
    ;;
   
    "9" )
    echo
    echo "Greek selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*el*.t?z > /dev/null 2>&1
    ;;

    "10" )
    echo
    echo "English (UK) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*en_GB*.t?z > /dev/null 2>&1
    ;;
   
    "11" )
    echo
    echo "Esperanto selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eo*.t?z > /dev/null 2>&1
    ;;

    "12" )
    echo
    echo "Spanish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*es*.t?z > /dev/null 2>&1
    ;;
   
    "13" )
    echo
    echo "Estonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*et*.t?z > /dev/null 2>&1
    ;;

    "14" )
    echo
    echo "Basque selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eu*.t?z > /dev/null 2>&1
    ;;
   
    "15" )
    echo
    echo "Finnish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fi*.t?z > /dev/null 2>&1
    ;;

    "16" )
    echo
    echo "French selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fr*.t?z > /dev/null 2>&1
    ;;
   
    "17" )
    echo
    echo "Abkhasysk selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fy*.t?z > /dev/null 2>&1
    ;;

    "18" )
    echo
    echo "Irish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ga*.t?z > /dev/null 2>&1
    ;;
   
    "19" )
    echo
    echo "Galician selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gl*.t?z > /dev/null 2>&1
    ;;

    "20" )
    echo
    echo "Gujarati selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gu*.t?z > /dev/null 2>&1
    ;;
   
    "21" )
    echo
    echo "Hebrew selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*he*.t?z > /dev/null 2>&1
    ;;

    "22" )
    echo
    echo "Hindi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hi*.t?z > /dev/null 2>&1
    ;;
   
    "23" )
    echo
    echo "Croatian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hr*.t?z > /dev/null 2>&1
    ;;

    "24" )
    echo
    echo "Hungarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hu*.t?z > /dev/null 2>&1
    ;;
   
    "25" )
    echo
    echo "Indonesian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*id*.t?z > /dev/null 2>&1
    ;;

    "26" )
    echo
    echo "Icelandic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*is*.t?z > /dev/null 2>&1
    ;;
   
    "27" )
    echo
    echo "Italian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*it*.t?z > /dev/null 2>&1
    ;;

    "28" )
    echo
    echo "Japanese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ja*.t?z > /dev/null 2>&1
    ;;
   
    "29" )
    echo
    echo "Kazakh selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kk*.t?z > /dev/null 2>&1
    ;;

    "30" )
    echo
    echo "Khmer selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*km*.t?z > /dev/null 2>&1
    ;;
   
    "31" )
    echo
    echo "Kannada selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kn*.t?z > /dev/null 2>&1
    ;;

    "32" )
    echo
    echo "Korean selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ko*.t?z > /dev/null 2>&1
    ;;
   
    "33" )
    echo
    echo "Lithuanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lt*.t?z > /dev/null 2>&1
    ;;

    "34" )
    echo
    echo "Latvian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lv*.t?z > /dev/null 2>&1
    ;;
   
    "35" )
    echo
    echo "Maithili selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mai*.t?z > /dev/null 2>&1
    ;;

    "36" )
    echo
    echo "Macedonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mk*.t?z > /dev/null 2>&1
    ;;
   
    "37" )
    echo
    echo "Malayam selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ml*.t?z > /dev/null 2>&1
    ;;

    "38" )
    echo
    echo "Norwegian (Bokmaal) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nb*.t?z > /dev/null 2>&1
    ;;
   
    "39" )
    echo
    echo "Low Saxon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nds*.t?z > /dev/null 2>&1
    ;;

    "40" )
    echo
    echo "Dutch selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nl*.t?z > /dev/null 2>&1
    ;;
   
    "41" )
    echo
    echo "Norwegian (Nynorsk) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nn*.t?z > /dev/null 2>&1
    ;;

    "42" )
    echo
    echo "Punjabi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pa*.t?z > /dev/null 2>&1
    ;;
   
    "43" )
    echo
    echo "Polish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pl*.t?z > /dev/null 2>&1
    ;;

    "44" )
    echo
    echo "Portuguese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt*.t?z > /dev/null 2>&1
    ;;
   
    "45" )
    echo
    echo "Brasil selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt_BR*.t?z > /dev/null 2>&1
    ;;

    "46" )
    echo
    echo "Romanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ro*.t?z > /dev/null 2>&1
    ;;
   
    "47" )
    echo
    echo "Russian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ru*.t?z > /dev/null 2>&1
    ;;

    "48" )
    echo
    echo "Sinhala selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*si*.t?z > /dev/null 2>&1
    ;;
   
    "49" )
    echo
    echo "Slovak selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sk*.t?z > /dev/null 2>&1
    ;;

    "50" )
    echo
    echo "Slovenian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sl*.t?z > /dev/null 2>&1
    ;;
   
    "51" )
    echo
    echo "Serbian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sr*.t?z > /dev/null 2>&1
    ;;

    "52" )
    echo
    echo "Swedish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sv*.t?z > /dev/null 2>&1
    ;;
   
    "53" )
    echo
    echo "Tajik selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tg*.t?z > /dev/null 2>&1
    ;;

    "54" )
    echo
    echo "Turkish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tr*.t?z > /dev/null 2>&1
    ;;
   
    "55" )
    echo
    echo "Ukrainan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*uk*.t?z > /dev/null 2>&1
    ;;

    "56" )
    echo
    echo "Walloon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*wa*.t?z > /dev/null 2>&1
    ;;

    "57" )
    echo
    echo "Simplified Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_CN*.t?z > /dev/null 2>&1
    ;;
   
    "58" )
    echo
    echo "Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_TW*.t?z > /dev/null 2>&1
    ;;

    "59" )
    echo
    echo "All kdei packages selcted"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*.t?z
    ;;

  esac

  if [ $lang != 0 ]; then
    echo -n "Installing localization... "
    installpkg -root $CHROOTDIR *.t?z > /dev/null 2>&1
    echo "DONE"
  fi
fi

if [ $version != current ]; then
  # Download patches
  echo -n "Downloading patches... "
  mkdir -p /tmp/Slack_$version/slackware.at/patches
  cd /tmp/Slack_$version/slackware.at/patches
  wget -c ftp://ftp.slackware.at/slackware-$version/patches/packages/*.t?z > /dev/null 2>&1
  echo "DONE"

  # Install patches
  echo -n "Patching Slackware... "
  ROOT=$CHROOTDIR upgradepkg --reinstall --install-new *.t?z > /dev/null 2>&1
  echo "DONE"
fi

# Copy host name and host partition table
echo -n "Configuring hostname and partition table... "
cp -a $HOSTFILE $CHROOTDIR/etc/hosts
cp -a $FSTABFILE $CHROOTDIR/etc/fstab
echo "DONE"

# Remove Slackware Packages
echo -n "Cleaning Cache... "
cd /tmp
rm -r /tmp/Slack_$version
echo "DONE"

echo "Finish!!!"

echo "+----------------------------------+"
echo "|  Thank you for using my builder  |"
echo "+----------------------------------+"

echo "#####################################################"
echo " If you want to start this chroot environment:"
echo " mount -o bind /proc $CHROOTDIR/proc"
echo " mount -o bind /dev $CHROOTDIR/dev"
echo " chroot $CHROOTDIR /bin/bash"
echo "#####################################################"

ChangeLog mar 24 ago 2010 12:05:20
Risolti bug relativi alle installazioni "Standard e Basic"
Risolto bug relativo alla creazione della directory temporanea per il download dei pacchetti

UPGRADED ChangeLog (12:24:10)
Risolti bug che impedivano l'installazione
Aggiunto workaround per il download in installazione basic e standard

UPGRADED ChangeLog (13:53:30)
Risolto bug nell'installazione delle patch
sostituita condizione kdei: non è più legata alla ricerca della directory nella directory di download. ora è legata alla scelta full.
aggiunta condizione sulla versione nel download e nell'installazione delle patch
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda metrofox » mar ago 24, 2010 13:16

Codice: Seleziona tutto
        ERRNUM=$?
        echo "FAIL"
        exit $?


Nella connection check, e' sbagliato... exit $? ti da 0 perche' precedentemente c'e' l'echo che funziona, percio' avevo usato la variabile ERRNUM, cosi' ritorna quella... Altra cosa, quando devi scegliere la localizzazione, tutte quelle lingue messe una sopra l'altra magari sono fastidiose per un utente che legge da terminale, crea 3 tabelle e mettile li, ad esempio:

Codice: Seleziona tutto
1) Italiano        4) Inglese
2) Franese         5) Tedesco
3) Spagnolo        6)Portoghese
Avatar utente
metrofox
Linux 2.6
Linux 2.6
 
Messaggi: 758
Iscritto il: gio ago 07, 2008 11:29
Slackware: slackware64-current
Kernel: 3.4.4-ck3
Desktop: FluxBox-1.3.1
Distribuzione: FreeBSD-8.1(amd64)

Re: Script per un chroot

Messaggioda hashbang » ven ago 27, 2010 9:54

metrofox ha scritto:quando devi scegliere la localizzazione, tutte quelle lingue messe una sopra l'altra magari sono fastidiose per un utente che legge da terminale, crea 3 tabelle e mettile li, ad esempio:

Codice: Seleziona tutto
1) Italiano        4) Inglese
2) Franese         5) Tedesco
3) Spagnolo        6)Portoghese
Ho pensato la stessa cosa anche io....solo che non so come fare sto impazzendo ho girato mezzo google ma non riesco a proprio a venirne fuori :?
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda metrofox » ven ago 27, 2010 14:01

Usa lo switch case in bash... in pseudocodice

case 1)
kdei=MIRROR
case 2)
kdei=MIRROR
esac

supergiù dovrebbe essere una cosa del genere ;)
Avatar utente
metrofox
Linux 2.6
Linux 2.6
 
Messaggi: 758
Iscritto il: gio ago 07, 2008 11:29
Slackware: slackware64-current
Kernel: 3.4.4-ck3
Desktop: FluxBox-1.3.1
Distribuzione: FreeBSD-8.1(amd64)

Re: Script per un chroot

Messaggioda hashbang » ven ago 27, 2010 17:52

metrofox ha scritto:Usa lo switch case in bash... in pseudocodice

case 1)
kdei=MIRROR
case 2)
kdei=MIRROR
esac

supergiù dovrebbe essere una cosa del genere ;)
mmmm....non credo di aver capito io il case l'ho usato per l'installer e la scelta delle lingue....dovrei crearne un altro per ridurre la lista delle lingue disponibili? :-k potresti spiegarti meglio?
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda metrofox » ven ago 27, 2010 22:49

atomix600 ha scritto:
metrofox ha scritto:Usa lo switch case in bash... in pseudocodice

case 1)
kdei=MIRROR
case 2)
kdei=MIRROR
esac

supergiù dovrebbe essere una cosa del genere ;)
mmmm....non credo di aver capito io il case l'ho usato per l'installer e la scelta delle lingue....dovrei crearne un altro per ridurre la lista delle lingue disponibili? :-k potresti spiegarti meglio?


Ah no scusa, ho capito male... Dico potresti usare degli echo con dei tab(\t), oppure dei for annidati... Fai tu ;)
Avatar utente
metrofox
Linux 2.6
Linux 2.6
 
Messaggi: 758
Iscritto il: gio ago 07, 2008 11:29
Slackware: slackware64-current
Kernel: 3.4.4-ck3
Desktop: FluxBox-1.3.1
Distribuzione: FreeBSD-8.1(amd64)

Re: Script per un chroot

Messaggioda hashbang » mar ago 31, 2010 11:49

scusate l'attesa ma sto ancora lavorando per poter incolonnare quella miriade di lingue di kdei :D
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda hashbang » mar ago 31, 2010 12:12

comunque non so quando riprenderò il 2 ho l'esame all'università quindi non so uanto proptrò dedicarmi allo script
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda Ansa89 » sab set 11, 2010 21:50

Spezzata la scelta delle lingue su due colonne e aggiunto me stesso tra i ringraziamenti (previa consultazione di atomix600):
Codice: Seleziona tutto
#!/bin/sh

# Chroot Environment AutoBuilder
# Copyright (C) 2010 Luca De Pandis aka atomix600
# All rights reserved.
# Contact me @ Slacky.eu ( http://www.slacky.eu )
#
# Heavily based on the Tom Newsom's Chroot Howto ( http://slackworld.berlios.de/2007/chroot_howto.html )
#
# Thanks to conraid, zoros, kobaiachi, metrofox and Ansa89 for improvements
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Exit on most errors
set -e

# Set variables
CHROOTDIR=${CHROOTDIR:-/mnt/chroot}
MIRROR=${MIRROR:-ftp.slackware.at}
HOSTFILE=${HOSTFILE:-/etc/hosts}
FSTABFILE=${FSTABFILE:-/etc/fstab}
SPACE_REQUIRED=7 # GByte

# Set Functions
check_space_on_hd()
{
     SPACE=$(df -P -m $PKGDIR 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 $MIRROR > /dev/null 2>&1 ; then
   echo "OK"
else
        ERRNUM=$?
        echo "FAIL"
        exit $?
fi
}

# Main Script
echo "+----------------------------------+"
echo "|  StArTiNg ChRoOt AuToBuIlDeR...  |"
echo "+----------------------------------+"

echo
echo "Select your Slackware"
echo
echo "Please choose the version of Slackware wich you want to chroot."
echo "For example: if you want to chroot a Slackware-current you must"
echo "write current. (CTRL+D for exit)"
echo
echo -n "Slackware version: "
read version
echo "Slackware version is selected: $version"
echo
echo "This script will install Slackware $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 "[WARNING] you'll need about ${SPACE_REQUIRED} GiB in / to run this script [WARNING]"
echo "[WARNING] it's recommended a fast internet connection for download [WARNING]"

# Remove directories if that is necessary
echo
echo -n "Checking for directories... "
rm -rf /tmp/Slack_*
rm -rf $CHROOTDIR
mkdir -p /tmp/Slack_$version
echo "DONE"

# Check available space on hard disk
echo -n "Checking for space... "
CHECK=$(check_space_on_hd)
if [ $CHECK = 0 -o $CHECK = 2 ]; then
  echo "FAIL"
else
  echo "OK"
fi

# Ping Mirror
echo -n "Checking for mirror... "
connection_check

# Choose your installation type
echo
echo "Slackware Linux $version Setup"
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 "Exiting from installer..."
  exit 1
  ;;
 
  "F" | "f" )
  echo
  echo "Full installation mode selected"
  echo "[WARNING] The full mode installation may take several minutes. So please wait until the operation completes. [WARNING]"
  echo -n "Downloading Slackware... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 --exclude-directories=slackware-$version/slackware/kdei ftp://slackware.at/slackware-$version/slackware/* > /dev/null 2>&1
  echo "DONE"
  ;;

  "B" | "b" )
  echo
  echo "Basic installation mode selected"
  echo "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;

  "S" | "s" )
  echo
  echo "Standard installation mode selected"
  echo -n "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  echo "DONE"
  echo -n "Downloading extras... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/t/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/tcl/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/x/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/xap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/y/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;
 
esac

echo -n "Installing Slackware... "
cd /tmp/Slack_$version/slackware.at
installpkg -root $CHROOTDIR */*.t?z > /dev/null 2>&1
echo "DONE"
echo "Slackware $version was installed successfully"

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

  case "$lang" in

    "0" )
    echo
    echo "Skip kdei installation"
    rm -rf /tmp/Slack_$version/slackware.at/kdei
    continue
    ;;
 
    "1" )
    echo
    echo "Arabic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ar*.t?z > /dev/null 2>&1
    ;;
   
    "2" )
    echo
    echo "Bulgarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*bg*.t?z > /dev/null 2>&1
    ;;
   
    "3" )
    echo
    echo "Catalan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca*.t?z > /dev/null 2>&1
    ;;

    "4" )
    echo
    echo "Catalan (Valencian) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca@valencia*.t?z > /dev/null 2>&1
    ;;
   
    "5" )
    echo
    echo "Czech selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*cs*.t?z > /dev/null 2>&1
    ;;

    "6" )
    echo
    echo "Kashubian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*csb*.t?z > /dev/null 2>&1
    ;;
   
    "7" )
    echo
    echo "Danish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*da*.t?z > /dev/null 2>&1
    ;;

    "8" )
    echo
    echo "German selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*de*.t?z > /dev/null 2>&1
    installpkg *de*.t?z
    ;;
   
    "9" )
    echo
    echo "Greek selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*el*.t?z > /dev/null 2>&1
    ;;

    "10" )
    echo
    echo "English (UK) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*en_GB*.t?z > /dev/null 2>&1
    ;;
   
    "11" )
    echo
    echo "Esperanto selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eo*.t?z > /dev/null 2>&1
    ;;

    "12" )
    echo
    echo "Spanish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*es*.t?z > /dev/null 2>&1
    ;;
   
    "13" )
    echo
    echo "Estonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*et*.t?z > /dev/null 2>&1
    ;;

    "14" )
    echo
    echo "Basque selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eu*.t?z > /dev/null 2>&1
    ;;
   
    "15" )
    echo
    echo "Finnish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fi*.t?z > /dev/null 2>&1
    ;;

    "16" )
    echo
    echo "French selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fr*.t?z > /dev/null 2>&1
    ;;
   
    "17" )
    echo
    echo "Abkhasysk selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fy*.t?z > /dev/null 2>&1
    ;;

    "18" )
    echo
    echo "Irish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ga*.t?z > /dev/null 2>&1
    ;;
   
    "19" )
    echo
    echo "Galician selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gl*.t?z > /dev/null 2>&1
    ;;

    "20" )
    echo
    echo "Gujarati selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gu*.t?z > /dev/null 2>&1
    ;;
   
    "21" )
    echo
    echo "Hebrew selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*he*.t?z > /dev/null 2>&1
    ;;

    "22" )
    echo
    echo "Hindi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hi*.t?z > /dev/null 2>&1
    ;;
   
    "23" )
    echo
    echo "Croatian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hr*.t?z > /dev/null 2>&1
    ;;

    "24" )
    echo
    echo "Hungarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hu*.t?z > /dev/null 2>&1
    ;;
   
    "25" )
    echo
    echo "Indonesian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*id*.t?z > /dev/null 2>&1
    ;;

    "26" )
    echo
    echo "Icelandic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*is*.t?z > /dev/null 2>&1
    ;;
   
    "27" )
    echo
    echo "Italian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*it*.t?z > /dev/null 2>&1
    ;;

    "28" )
    echo
    echo "Japanese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ja*.t?z > /dev/null 2>&1
    ;;
   
    "29" )
    echo
    echo "Kazakh selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kk*.t?z > /dev/null 2>&1
    ;;

    "30" )
    echo
    echo "Khmer selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*km*.t?z > /dev/null 2>&1
    ;;
   
    "31" )
    echo
    echo "Kannada selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kn*.t?z > /dev/null 2>&1
    ;;

    "32" )
    echo
    echo "Korean selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ko*.t?z > /dev/null 2>&1
    ;;
   
    "33" )
    echo
    echo "Lithuanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lt*.t?z > /dev/null 2>&1
    ;;

    "34" )
    echo
    echo "Latvian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lv*.t?z > /dev/null 2>&1
    ;;
   
    "35" )
    echo
    echo "Maithili selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mai*.t?z > /dev/null 2>&1
    ;;

    "36" )
    echo
    echo "Macedonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mk*.t?z > /dev/null 2>&1
    ;;
   
    "37" )
    echo
    echo "Malayam selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ml*.t?z > /dev/null 2>&1
    ;;

    "38" )
    echo
    echo "Norwegian (Bokmaal) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nb*.t?z > /dev/null 2>&1
    ;;
   
    "39" )
    echo
    echo "Low Saxon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nds*.t?z > /dev/null 2>&1
    ;;

    "40" )
    echo
    echo "Dutch selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nl*.t?z > /dev/null 2>&1
    ;;
   
    "41" )
    echo
    echo "Norwegian (Nynorsk) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nn*.t?z > /dev/null 2>&1
    ;;

    "42" )
    echo
    echo "Punjabi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pa*.t?z > /dev/null 2>&1
    ;;
   
    "43" )
    echo
    echo "Polish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pl*.t?z > /dev/null 2>&1
    ;;

    "44" )
    echo
    echo "Portuguese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt*.t?z > /dev/null 2>&1
    ;;
   
    "45" )
    echo
    echo "Brasil selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt_BR*.t?z > /dev/null 2>&1
    ;;

    "46" )
    echo
    echo "Romanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ro*.t?z > /dev/null 2>&1
    ;;
   
    "47" )
    echo
    echo "Russian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ru*.t?z > /dev/null 2>&1
    ;;

    "48" )
    echo
    echo "Sinhala selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*si*.t?z > /dev/null 2>&1
    ;;
   
    "49" )
    echo
    echo "Slovak selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sk*.t?z > /dev/null 2>&1
    ;;

    "50" )
    echo
    echo "Slovenian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sl*.t?z > /dev/null 2>&1
    ;;
   
    "51" )
    echo
    echo "Serbian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sr*.t?z > /dev/null 2>&1
    ;;

    "52" )
    echo
    echo "Swedish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sv*.t?z > /dev/null 2>&1
    ;;
   
    "53" )
    echo
    echo "Tajik selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tg*.t?z > /dev/null 2>&1
    ;;

    "54" )
    echo
    echo "Turkish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tr*.t?z > /dev/null 2>&1
    ;;
   
    "55" )
    echo
    echo "Ukrainan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*uk*.t?z > /dev/null 2>&1
    ;;

    "56" )
    echo
    echo "Walloon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*wa*.t?z > /dev/null 2>&1
    ;;

    "57" )
    echo
    echo "Simplified Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_CN*.t?z > /dev/null 2>&1
    ;;
   
    "58" )
    echo
    echo "Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_TW*.t?z > /dev/null 2>&1
    ;;

    "59" )
    echo
    echo "All kdei packages selcted"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*.t?z
    ;;

  esac

  if [ $lang != 0 ]; then
    echo -n "Installing localization... "
    installpkg -root $CHROOTDIR *.t?z > /dev/null 2>&1
    echo "DONE"
  fi
fi

if [ $version != current ]; then
  # Download patches
  echo -n "Downloading patches... "
  mkdir -p /tmp/Slack_$version/slackware.at/patches
  cd /tmp/Slack_$version/slackware.at/patches
  wget -c ftp://ftp.slackware.at/slackware-$version/patches/packages/*.t?z > /dev/null 2>&1
  echo "DONE"

  # Install patches
  echo -n "Patching Slackware... "
  ROOT=$CHROOTDIR upgradepkg --reinstall --install-new *.t?z > /dev/null 2>&1
  echo "DONE"
fi

# Copy host name and host partition table
echo -n "Configuring hostname and partition table... "
cp -a $HOSTFILE $CHROOTDIR/etc/hosts
cp -a $FSTABFILE $CHROOTDIR/etc/fstab
echo "DONE"

# Remove Slackware Packages
echo -n "Cleaning Cache... "
cd /tmp
rm -r /tmp/Slack_$version
echo "DONE"

echo "Finish!!!"

echo "+----------------------------------+"
echo "|  Thank you for using my builder  |"
echo "+----------------------------------+"

echo "#####################################################"
echo " If you want to start this chroot environment:"
echo " mount -o bind /proc $CHROOTDIR/proc"
echo " mount -o bind /dev $CHROOTDIR/dev"
echo " chroot $CHROOTDIR /bin/bash"
echo "#####################################################"
Avatar utente
Ansa89
Iper Master
Iper Master
 
Messaggi: 2625
Iscritto il: mer ago 29, 2007 16:57
Località: Modena
Nome Cognome: Stefano Ansaloni
Slackware: 13.1
Kernel: 3.16.6-ck2
Desktop: XFCE 4.6.1

Re: Script per un chroot

Messaggioda hashbang » sab set 11, 2010 22:07

Codice: Seleziona tutto
#!/bin/sh

# Chroot Environment AutoBuilder Release Candidate 2
# Copyright (C) 2010 Luca De Pandis aka atomix600
# All rights reserved.
# Contact me @ Slacky.eu ( http://www.slacky.eu )
#
# Heavily based on the Tom Newsom's Chroot Howto ( http://slackworld.berlios.de/2007/chroot_howto.html )
#
# Thanks to conraid, zoros, Ansa89, kobaiachi and metrofox for improvements
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Exit on most errors
set -e

# Set variables
CHROOTDIR=${CHROOTDIR:-/mnt/chroot}
MIRROR=${MIRROR:-ftp.slackware.at}
HOSTFILE=${HOSTFILE:-/etc/hosts}
FSTABFILE=${FSTABFILE:-/etc/fstab}
SPACE_REQUIRED=7 # GByte

# Set Functions
check_space_on_hd()
{
     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 $MIRROR > /dev/null 2>&1 ; then
   echo "OK"
else
        ERRNUM=$?
        echo "FAIL"
        exit $?
fi
}

# Main Script
echo "+----------------------------------+"
echo "|  StArTiNg ChRoOt AuToBuIlDeR...  |"
echo "+----------------------------------+"

echo
echo "Select your Slackware"
echo
echo "Please choose the version of Slackware wich you want to chroot."
echo "For example: if you want to chroot a Slackware-current you must"
echo "write current. (CTRL+D for exit)"
echo
echo -n "Slackware version: "
read version
echo "Slackware version is selected: $version"
echo
echo "This script will install Slackware $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 "[WARNING] you'll need about ${SPACE_REQUIRED} GiB in / to run this script [WARNING]"
echo "[WARNING] it's recommended a fast internet connection for download [WARNING]"

# Remove directories if that is necessary
echo
echo -n "Checking for directories... "
rm -rf /tmp/Slack_*
rm -rf $CHROOTDIR
mkdir -p /tmp/Slack_$version
mkdir -p $CHROOTDIR
echo "DONE"

# Check available space on hard disk
echo -n "Checking for space... "
CHECK=$(check_space_on_hd)
if [ $CHECK = 0 -o $CHECK = 2 ]; then
  echo "FAIL"
else
  echo "OK"
fi

# Ping Mirror
echo -n "Checking for mirror... "
connection_check

# Choose your installation type
echo
echo "Slackware Linux $version Setup"
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 "Exiting from installer..."
  exit 1
  ;;
 
  "F" | "f" )
  echo
  echo "Full installation mode selected"
  echo "[WARNING] The full mode installation may take several minutes. So please wait until the operation completes. [WARNING]"
  echo -n "Downloading Slackware... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 --exclude-directories=slackware-$version/slackware/kdei ftp://slackware.at/slackware-$version/slackware/* > /dev/null 2>&1
  echo "DONE"
  ;;

  "B" | "b" )
  echo
  echo "Basic installation mode selected"
  echo -n "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;

  "S" | "s" )
  echo
  echo "Standard installation mode selected"
  echo -n "Downloading core packages... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/a/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/ap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/d/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/e/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/f/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/k/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/l/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/n/*.t?z > /dev/null 2>&1
  echo "DONE"
  echo -n "Downloading extras... "
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/t/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/tcl/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/x/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/xap/*.t?z > /dev/null 2>&1
  wget -c -r --directory-prefix=/tmp/Slack_$version/ -np --cut-dirs=2 ftp://ftp.slackware.at/slackware-$version/slackware/y/*.t?z > /dev/null 2>&1
  mv /tmp/Slack_$version/ftp.slackware.at /tmp/Slack_$version/slackware.at
  echo "DONE"
  ;;
 
esac

echo -n "Installing Slackware... "
cd /tmp/Slack_$version/slackware.at
installpkg -root $CHROOTDIR */*.t?z > /dev/null 2>&1
echo "DONE"
echo "Slackware $version was installed successfully"

# Choose localization
if [ $type = F -o $type = f ]; then
  mkdir -p /tmp/Slack_$version/slackware.at/kdei
  cd /tmp/Slack_$version/slackware.at/kdei
  echo
  echo "KDE SC and KOffice localization"
  echo
  echo "if you selected Full mode installation you can choose 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[9] Greek"
  echo -e "[10] English (UK)\t\t[11] Esperanto"
  echo -e "[12] Spanish\t\t\t[13] Estonian"
  echo -e "[14] Basque\t\t\t[15] Finnish"
  echo -e "[16] French\t\t\t[17] Abkhasysk"
  echo -e "[18] Irish\t\t\t[19] Galician"
  echo -e "[20] Gujarati\t\t\t[21] Hebrew"
  echo -e "[22] Hindi\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[31] Kannada"
  echo -e "[32] Korean\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[39] Low Saxon"
  echo -e "[40] Dutch\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/Slack_$version/slackware.at/kdei
    continue
    ;;

    "1" )
    echo
    echo "Arabic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ar*.t?z > /dev/null 2>&1
    ;;
   
    "2" )
    echo
    echo "Bulgarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*bg*.t?z > /dev/null 2>&1
    ;;
   
    "3" )
    echo
    echo "Catalan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca*.t?z > /dev/null 2>&1
    ;;

    "4" )
    echo
    echo "Catalan (Valencian) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ca@valencia*.t?z > /dev/null 2>&1
    ;;
   
    "5" )
    echo
    echo "Czech selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*cs*.t?z > /dev/null 2>&1
    ;;

    "6" )
    echo
    echo "Kashubian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*csb*.t?z > /dev/null 2>&1
    ;;
   
    "7" )
    echo
    echo "Danish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*da*.t?z > /dev/null 2>&1
    ;;

    "8" )
    echo
    echo "German selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*de*.t?z > /dev/null 2>&1
    installpkg *de*.t?z
    ;;
   
    "9" )
    echo
    echo "Greek selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*el*.t?z > /dev/null 2>&1
    ;;

    "10" )
    echo
    echo "English (UK) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*en_GB*.t?z > /dev/null 2>&1
    ;;
   
    "11" )
    echo
    echo "Esperanto selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eo*.t?z > /dev/null 2>&1
    ;;

    "12" )
    echo
    echo "Spanish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*es*.t?z > /dev/null 2>&1
    ;;
   
    "13" )
    echo
    echo "Estonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*et*.t?z > /dev/null 2>&1
    ;;

    "14" )
    echo
    echo "Basque selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*eu*.t?z > /dev/null 2>&1
    ;;
   
    "15" )
    echo
    echo "Finnish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fi*.t?z > /dev/null 2>&1
    ;;

    "16" )
    echo
    echo "French selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fr*.t?z > /dev/null 2>&1
    ;;
   
    "17" )
    echo
    echo "Abkhasysk selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*fy*.t?z > /dev/null 2>&1
    ;;

    "18" )
    echo
    echo "Irish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ga*.t?z > /dev/null 2>&1
    ;;
   
    "19" )
    echo
    echo "Galician selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gl*.t?z > /dev/null 2>&1
    ;;

    "20" )
    echo
    echo "Gujarati selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*gu*.t?z > /dev/null 2>&1
    ;;
   
    "21" )
    echo
    echo "Hebrew selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*he*.t?z > /dev/null 2>&1
    ;;

    "22" )
    echo
    echo "Hindi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hi*.t?z > /dev/null 2>&1
    ;;
   
    "23" )
    echo
    echo "Croatian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hr*.t?z > /dev/null 2>&1
    ;;

    "24" )
    echo
    echo "Hungarian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*hu*.t?z > /dev/null 2>&1
    ;;
   
    "25" )
    echo
    echo "Indonesian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*id*.t?z > /dev/null 2>&1
    ;;

    "26" )
    echo
    echo "Icelandic selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*is*.t?z > /dev/null 2>&1
    ;;
   
    "27" )
    echo
    echo "Italian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*it*.t?z > /dev/null 2>&1
    ;;

    "28" )
    echo
    echo "Japanese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ja*.t?z > /dev/null 2>&1
    ;;
   
    "29" )
    echo
    echo "Kazakh selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kk*.t?z > /dev/null 2>&1
    ;;

    "30" )
    echo
    echo "Khmer selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*km*.t?z > /dev/null 2>&1
    ;;
   
    "31" )
    echo
    echo "Kannada selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*kn*.t?z > /dev/null 2>&1
    ;;

    "32" )
    echo
    echo "Korean selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ko*.t?z > /dev/null 2>&1
    ;;
   
    "33" )
    echo
    echo "Lithuanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lt*.t?z > /dev/null 2>&1
    ;;

    "34" )
    echo
    echo "Latvian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*lv*.t?z > /dev/null 2>&1
    ;;
   
    "35" )
    echo
    echo "Maithili selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mai*.t?z > /dev/null 2>&1
    ;;

    "36" )
    echo
    echo "Macedonian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*mk*.t?z > /dev/null 2>&1
    ;;
   
    "37" )
    echo
    echo "Malayam selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ml*.t?z > /dev/null 2>&1
    ;;

    "38" )
    echo
    echo "Norwegian (Bokmaal) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nb*.t?z > /dev/null 2>&1
    ;;
   
    "39" )
    echo
    echo "Low Saxon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nds*.t?z > /dev/null 2>&1
    ;;

    "40" )
    echo
    echo "Dutch selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nl*.t?z > /dev/null 2>&1
    ;;
   
    "41" )
    echo
    echo "Norwegian (Nynorsk) selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*nn*.t?z > /dev/null 2>&1
    ;;

    "42" )
    echo
    echo "Punjabi selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pa*.t?z > /dev/null 2>&1
    ;;
   
    "43" )
    echo
    echo "Polish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pl*.t?z > /dev/null 2>&1
    ;;

    "44" )
    echo
    echo "Portuguese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt*.t?z > /dev/null 2>&1
    ;;
   
    "45" )
    echo
    echo "Brasil selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*pt_BR*.t?z > /dev/null 2>&1
    ;;

    "46" )
    echo
    echo "Romanian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ro*.t?z > /dev/null 2>&1
    ;;
   
    "47" )
    echo
    echo "Russian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*ru*.t?z > /dev/null 2>&1
    ;;

    "48" )
    echo
    echo "Sinhala selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*si*.t?z > /dev/null 2>&1
    ;;
   
    "49" )
    echo
    echo "Slovak selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sk*.t?z > /dev/null 2>&1
    ;;

    "50" )
    echo
    echo "Slovenian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sl*.t?z > /dev/null 2>&1
    ;;
   
    "51" )
    echo
    echo "Serbian selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sr*.t?z > /dev/null 2>&1
    ;;

    "52" )
    echo
    echo "Swedish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*sv*.t?z > /dev/null 2>&1
    ;;
   
    "53" )
    echo
    echo "Tajik selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tg*.t?z > /dev/null 2>&1
    ;;

    "54" )
    echo
    echo "Turkish selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*tr*.t?z > /dev/null 2>&1
    ;;
   
    "55" )
    echo
    echo "Ukrainan selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*uk*.t?z > /dev/null 2>&1
    ;;

    "56" )
    echo
    echo "Walloon selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*wa*.t?z > /dev/null 2>&1
    ;;

    "57" )
    echo
    echo "Simplified Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_CN*.t?z > /dev/null 2>&1
    ;;
   
    "58" )
    echo
    echo "Chinese selected"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*zh_TW*.t?z > /dev/null 2>&1
    ;;

    "59" )
    echo
    echo "All kdei packages selcted"
    wget -c ftp://ftp.slackware.at/slackware-$version/slackware/kdei/*.t?z
    ;;

  esac

  if [ $lang != 0 ]; then
    echo -n "Installing localization... "
    installpkg -root $CHROOTDIR *.t?z > /dev/null 2>&1
    echo "DONE"
  fi
fi

if [ $version != current ]; then
  # Download patches
  echo -n "Downloading patches... "
  mkdir -p /tmp/Slack_$version/slackware.at/patches
  cd /tmp/Slack_$version/slackware.at/patches
  wget -c ftp://ftp.slackware.at/slackware-$version/patches/packages/*.t?z > /dev/null 2>&1
  echo "DONE"

  # Install patches
  echo -n "Patching Slackware... "
  ROOT=$CHROOTDIR upgradepkg --reinstall --install-new *.t?z > /dev/null 2>&1
  echo "DONE"
fi

# Copy host name and host partition table
echo -n "Configuring hostname and partition table... "
cp -a $HOSTFILE $CHROOTDIR/etc/hosts
cp -a $FSTABFILE $CHROOTDIR/etc/fstab
echo "DONE"

# Remove Slackware Packages
echo -n "Cleaning Cache... "
cd /tmp
rm -r /tmp/Slack_$version
echo "DONE"

echo "Finish!!!"

echo "+----------------------------------+"
echo "|  Thank you for using my builder  |"
echo "+----------------------------------+"

echo "#####################################################"
echo " If you want to start this chroot environment:"
echo " mount -o bind /proc $CHROOTDIR/proc"
echo " mount -o bind /dev $CHROOTDIR/dev"
echo " chroot $CHROOTDIR /bin/bash"
echo "#####################################################"
Ultima modifica di hashbang il dom set 12, 2010 16:43, modificato 3 volte in totale.
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda hashbang » dom set 12, 2010 16:42

ChangeLog dom 12 set 2010 17:30:15
Aggiunta opzione escape agli echo per la colorazione in alcuni punti dello script.
Aggiunta funzione user_check() che permette allo script di funzionare SOLO da utente root.
Risolti bug riguardanti l'integrazione di escape

Di seguito riporto "un consiglio per una corretta visualizzazione":
L'emulatore di terminale dovrà avere una dimensione minima di 80x24 per visualizzare in modo ottimale lo script. Chi usa dimensioni superiori o usa la console di sistema lo potrà usare senza alcun problema. Chi usa dimensioni inferiori (anche se ne dubito) o allarga la dimensione dell'emulatore o potrebbe avere problemi nella visualizzazione. Dico potrebbe perchè non so come si comporta lo script con altre dimensioni della consolle.

Problemi in risoluzione: Ora sto cercando di ovviare al problema riguardante lo sfondo delle parti colorate da escape. Purtroppo quelle parti sono impostate su sfondo nero pertanto chi usa rxvt, xterm e compagnia vedrebbe nell'area attorno ai caratteri colorati il colore nero dello sfondo. Appena risolvo aggiorno il changelog che affermo ora: sarà quello finale. Lo script è stabile e funziona (intendo quello che ho io). Chiedo di non usare gli script postati per chrootare la Slack (mi rivolgo a chi avesse visto il topic oggi). Quando esso sarà definitivamente pronto all'uso. Verrà direttamente inviato a Loris che provvederà a postarlo sul wiki. Pertanto chi volesse suggerire piccoli accorgimenti può basarsi sull'ultimo script postato tenendo presente quest'ultimo ChangeLog. :)

Aggiornamento del ChangeLog
Risolto problema trasparenza su Escape.
Passaggio dalla licenza tipica degli SlackBuild alla licenza GPLv3
nuova gestione delle patch che passa da un automatizzazione posta sotto condizione a un case posto sotto condizione

Lo script è pronto! :D
Ringrazio Conraid e zoros per i consigli. :)
Un ringraziamento speciale ad Ansa89 per lo user_check() e le tabulazioni nella scelta delle lingue e a metrofox per gli enormi suggerimenti e implementazioni che sono stati via via integrati nello script.
Ringrazio infine Kobaiachi che ha orientato lo script ad utilizzi molto più ampi rispetto ai nostri (pacchettizzazione).

Lo script verrà inviato a Loris che provvederà a postarlo sul wiki.
Ultima modifica di hashbang il dom set 12, 2010 19:16, modificato 1 volta in totale.
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda metrofox » dom set 12, 2010 19:08

Ricordo che nella connection_check() il valore che deve essere ritornato è $ERRNUM e non $? che da 0 visto che l'echo viene eseguito correttamente ;)
Avatar utente
metrofox
Linux 2.6
Linux 2.6
 
Messaggi: 758
Iscritto il: gio ago 07, 2008 11:29
Slackware: slackware64-current
Kernel: 3.4.4-ck3
Desktop: FluxBox-1.3.1
Distribuzione: FreeBSD-8.1(amd64)

Re: Script per un chroot

Messaggioda hashbang » dom set 12, 2010 19:14

metrofox ha scritto:Ricordo che nella connection_check() il valore che deve essere ritornato è $ERRNUM e non $? che da 0 visto che l'echo viene eseguito correttamente ;)
Cioè devo sostituire exit $? con exit $ERRNUM? :-k

EDIT: Ho sostituito exit $? con exit $ERRNUM e funziona. È questo ciò che avevi chiesto di modificare? :)
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Re: Script per un chroot

Messaggioda metrofox » lun set 20, 2010 20:59

Esattamente :)
Avatar utente
metrofox
Linux 2.6
Linux 2.6
 
Messaggi: 758
Iscritto il: gio ago 07, 2008 11:29
Slackware: slackware64-current
Kernel: 3.4.4-ck3
Desktop: FluxBox-1.3.1
Distribuzione: FreeBSD-8.1(amd64)

Re: Script per un chroot

Messaggioda hashbang » mer set 22, 2010 20:12

Chiudo il topic visto che ormai lo script è pronto. Per le segnalazioni vi rimando al topic rigurdante le segnalazioni ;) Grazie a tutti :)

http://www.slacky.eu/forum/viewtopic.php?p=289273#p289273
Adoro il pragmatismo della lingua giapponese, è l'unica in cui per dire ad una ragazza che la ami le dici "suki". (cit.)
Avatar utente
hashbang
Packager
Packager
 
Messaggi: 1840
Iscritto il: ven giu 04, 2010 9:27
Località: Lecce
Nome Cognome: Luca De Pandis
Distribuzione: Windows 8.1 Pro

Precedente

Torna a Programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron