Page 1 of 1

Porteus Migration Tool

Posted: 22 Apr 2011, 11:24
by Hamza
I writing a tool for upgrade from older version of Porteus to latest.

But , I must have the choose of the community.

If you want this tool , please post a message in this thread.

If you won't this tool , please post a message in this thread.

All votes out of this thread are not valid.

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:34
by fanthom
dont ask for votes - just do the job and show it to the community. will be included in the distro, if people find it useful.
few ideas:
- cron job which checks periodically for new version (user could decide how often)
- support for stable and unstable, 32/64 bit
- autostart in KDE/LXDE

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:37
by Hamza
Thanks for ideas!

Will see if I can make these functions.

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:46
by 82issa
I like this idea.
Suggestion md5sum the xzm's to identify version number. If != to current stable,verify they want to upgrade
then download and replace. You would need to make an exemption list. So that people can add their custom
xzm's to that without having to worry about them getting replaced. But first md5 itself and update the updater.

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:51
by Hamza
I have already added this function to my tool.

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:55
by 82issa
even exemption list?

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 20:56
by Hamza
My tool will check the md5sum of the ISO file only , that's more fast ,and more easy.

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 21:02
by 82issa
Well I will just go ahead and punch myself in the face a couple times for you :wall:

Re: Porteus Migration Tool

Posted: 22 Apr 2011, 21:04
by Hamza
Well I will just go ahead and punch myself in the face a couple times for you
I think , I haven't understand perfectly your last answer.

Re: Porteus Migration Tool

Posted: 28 Apr 2011, 22:00
by Hamza
This is a part of the code , I can't finish and test it , the official repo is not ready yet.

Code: Select all

#!/bin/bash

cpu=`uname -m`
HOST=http://ponce.cc/porteus
rm -Rf /tmp/version*.*
echo "Checking of latest version available.."

cd /tmp && wget -q http://porteus.olympe-network.com/current/version.txt
if [ -e /tmp/version.txt ]; then
CVER=`cat /tmp/version.txt | head -n1`
else
clear
echo "An error is occured when Porteus Migration Tool trying to check the latest version available"
echo "You must have an internet connection"
exit
fi

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

}


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


if [ "$cpu" = "x86_64" ]; then
ARCH=x86_64
else
ARCH=i486
fi


mount_iso () {
mount -o loop -t iso9660 $1 $2
}

mkfold () {
if [ -e $1 ]; then
rm -Rf $1
else
mkdir $1
fi
}


clear

echo "==========> Porteus <=========="
echo " "
echo "Welcome to Porteus Upgrade Tool"
echo "With this tool , you'll be able"
echo "to upgrade to latest version"
echo "of Porteus.This Tool will see"
echo "your architecture before to begin"
echo "all operations.If you won't make"
echo "problems with this script."
echo "Could you close all others apps"
echo " "
echo "Are you ready?"
read

echo "Checking of your current OS.."
chk_ver
echo "Checking of your architecture.."
TMP=/tmp/porteus_mig
[ -d $TMP ] && rm -Rf $TMP
mkdir $TMP
EXT=iso
ISO=porteus-$CVER-$ARCH.$EXT
#LATEST=$HOST/$ARCH/current/porteus-$C_VER-$ARCH.$EXT
LATEST=$HOST/$ARCH/current/$ISO
echo "Downloading of the latest ISO..."
cd $TMP
download $LATEST
if [ -e $TMP/$ISO ]; then
LC_ISO=$TMP/$ISO
echo "Porteus downloaded!"
echo "Checking of ISO..."
wget -q $HOST/$ARCH/current/porteus-$CVER-$ARCH.txt
MD5_LC=`md5sum $LC_ISO`
MD5_RM=`cat $TMP/porteus-$CVER-$ARCH.txt | head -n1`
if [ "$MD5_LC" = "$MD5_RM" ]; then
echo "Well, Your Porteus ISO is checked and it correct!"
else
echo "Your Porteus ISO is corrupted , you must download it again."
echo "Exiting..."
exit
fi
else
echo "Check your internet connection."
echo "The Porteus ISO was not found !"
echo "Exiting..."
exit
fi

[ -d /mnt/iso ] && rm -Rf /mnt/iso
mkdir /mnt/iso 
mount_iso $LC_ISO /mnt/iso
echo "Is it a frugual install?"
echo "Answer available 'y' and 'n'"
read ans
if [ "$ans" = "y" ]; then
echo "Backing up of old installation..."
else
clear
echo "If it is not a frugal installation"
echo "I can't upgrade your current installation"
echo "For save your disk space , I cleanning the system"
rm -Rf
if [ -e /mnt/live/mnt/*/boot ]; then
cd /mnt/live/mnt/*/boot && cd ../ && mv ./boot ./boot.bak
fi
if [ -e /mnt/live/mnt/*/porteus ]; then
cd /mnt/live/mnt/*/porteus && cd ../ && mv ./porteus ./porteus.bak
fi
echo "Copying of files...."
C_BOOT=`ls /mnt/live/mnt/`
BOOT_DIR=/mnt/live/mnt/$C_BOOT/boot
PRTS_DIR=/mnt/live/mnt/$C_BOOT/porteus
if [ -e $BOOT_DIR ]; then
cd /mnt/live/mnt/$C_BOOT/boot && cp -r . /mnt/iso/boot
cd /mnt/live/mnt/$C_BOOT/porteus && cp -r . /mnt/iso/porteus

echo "Starting of Boot Installer..."
sh /mnt/live/mnt/*/boot/bootinst.sh
Any suggestions are welcome.

Re: Porteus Migration Tool

Posted: 29 Apr 2011, 08:15
by fanthom
i would add a warning that porteus can crash (for sure user wont be able to start any new application) after:
"cd /mnt/live/mnt/*/porteus && cd ../ && mv ./porteus ./porteus.bak"
so immediate reboot is required.

Re: Porteus Migration Tool

Posted: 29 Apr 2011, 08:41
by Blaze
Hamza, great job!

Re: Porteus Migration Tool

Posted: 29 Apr 2011, 09:31
by Hamza
i would add a warning that porteus can crash (for sure user wont be able to start any new application) after:
"cd /mnt/live/mnt/*/porteus && cd ../ && mv ./porteus ./porteus.bak"
so immediate reboot is required.
This is good idea. But I won't use any dialog box. Because , It will be compatible with any versions (KDE/LXDE/...) of Porteus.

I'll try to insert a red warning with a red message.

Re: Porteus Migration Tool

Posted: 02 May 2011, 13:13
by brokenman
I have a text file sitting on the server that has a number in it ... for example 110102. The number is the date of the last release in yymmdd. There is also a file in the boot folder with the same number.

When a new release comes out users will be able to check (via main menu) if there is an update available. If the number they have locally is lower than the number checked on the server then an update is available. I havn't got as far as writing anything for an automatic update because this will be a long and winding road and will most probably have differences from release to release (just check ponces latest lxde for an example).

Eventually ... once official release is out and most bugs are ironed out ... i would like to work on an svn script to update Porteus. The ISO will still be offered but for those that prefer to 'roll their own' the svn may be a better choice.