NetWork Installation

Non release banter
Post Reply
User avatar
Hamza
Warlord
Warlord
Posts: 1846
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

NetWork Installation

Post#1 by Hamza » 01 Jun 2011, 13:22

This is a begin of my network installation script :

Code: Select all

#!/bin/bash

NETINST=/net-install
MD5SUM=md5sums.txt
HOST=http://ponce.cc/porteus
HOST1=http://porteus.org/porteus
perms=$(id -u)

#if [ "$perms" = "0" ];
#then
#clear
#echo "This script must be executed from root account."
#exit 1
#fi

cpu=`uname -m`

echo "Checking of latest version available.."
cd /tmp
wget -q $HOST1/version.txt
if [ -e /tmp/version.txt ]; then
CVER=`cat /tmp/version.txt`
echo " "
else
clear
echo "An error is occured when Porteus Network Installation Tool trying to check the latest version available"
echo "You must have an internet connection"
exit
fi
#wget -q http://ponce.cc/porteus/${ARCH}/porteus-${C_VER}-${ARCH}.txt

progressbar () {
# Set wget for display the progress bar only

    local flag=false c count cr=$'\r' nl=$'\n'
    while IFS='' read -d '' -rn 1 c
    do
        if $flag
        then
            printf '%c' "$c"
        else
            if [[ $c != $cr && $c != $nl ]]
            then
                count=0
            else
                ((count++))
                if ((count > 1))
                then
                    flag=true
                fi
            fi
        fi
    done
}

download () {
# Download with progressbar function

wget --progress=bar:force $1 2>&1 | progressbar

}

LATEST=http://ponce.cc/porteus/$ARCH/current/porteus-${C_VER}-${ARCH}.iso


chk_ver () {
if [ -e /etc/porteus-version ]; then
CURRENT=`cat /etc/porteus-version`
echo "You're using $CURRENT"
else
clear
echo "You don't using Porteus OS"
echo "You cannot install from another OS to Porteus"
echo "You must download the Porteus Network Installation before."
exit
fi
}

# Check the current arch
check_arch () {
if [ "$cpu" = "x86_64" ]; then
ARCH=x86_64
else
ARCH=i486
fi
}

# Mount an ISO file if needed
mount_iso () {
mount -o loop -t iso9660 $1 $2
}

# Make a folder or remove it if needed
mkfolder () {
if [ -e $1 ]; then
rm -Rf $1
else
mkdir $1
fi
}

# Check the md5sum for core modules
chkmd5 () {
if [ -e "$1" ]; then
echo "Checking of $2 in progress..."
else
echo "Error : File Not Found"
exit
fi
RM_MD5=`cat $TMP/md5sums.txt | grep $2`
LC_MD5=`md5sum $2`
if [ -e $1 ]; then
echo "Well, $2 was found!"
else
echo "Error : This file doesn't exist"
echo "
if [ "$RM_MD5" = "$LC_MD5" ]; then
echo " The module $2 is OK"
else
echo "The module $2 is broken"
exit
fi
}

echo "==========> Welcome to Porteus Network Installer <=========="
echo " "
echo " "
echo "Porteus"
echo "The portable linux community. "
echo "Porteus is lightning fast and super sleek with "
echo "a small footprint! This is a light-weight O.S. "
echo "with a heavy hit. We have a very active "
echo "development team, and a commnity forum "
echo "with wonderful people who have a wealth of "
echo "knowledge to help provide support. Come join us "
echo "at http://www.porteus.org "
echo "Destroy all barriers... Porteus"
echo " "
echo " "       
echo " "
echo " "
read

echo "Checking of your current OS.."
chk_ver
echo "Checking of your architecture.."
check_arch
TMP=/tmp/porteus_net
[ -d $TMP ] && rm -Rf $TMP
mkdir $TMP
EXT=iso
ISO=porteus-$CVER-$ARCH.$EXT
LATEST=$HOST/$ARCH/current/porteus-$CVER-$ARCH.$EXT
#LATEST=$HOST/$ARCH/current/$ISO
cd $TMP
wget -q $HOST/$ARCH/testing/net-install/md5sums.txt
echo "Downloading of xorg module..."
download $HOST/$ARCH/testing/net-install/002-xorg.xzm
chkmd5 $TMP/002-xorg.xzm 002-xorg.xzm
echo "Downloading of lxde module..."
download $HOST/$ARCH/testing/net-install/003-lxde.xzm
chkmd5 $TMP/003-lxde.xzm 003-lxde.xzm
echo "Downloading of kde module..."
download $HOST/$ARCH/testing/net-install/004-kde.xzm
chkmd5 $TMP/004-kde.xzm 004-kde.xzm
echo "Downloading of firefox module..."
download $HOST/$ARCH/testing/net-install/006-firefox-flash.xzm
chkmd5 $TMP/006-firefox-flash.xzm 006-firefox-flash.xzm

BASE=/mnt/live/mnt/*/porteus/base/
cd $BASE && mv $TMP/*.xzm .
I don't know how do I write the end of my script.

Any suggestions ?

Thanks to fanthom for some commands !
Thanks to Ahau for the text at intro !

It can works only with furgual installation with read-write perm's.

Regards,
NjVFQzY2Rg==

Post Reply