User articles

From antiX

Jump to: navigation, search

Here is the beginning of the antiX-upgrade script. So far it works in upgrading antiX-M7.2 (full) to antiX-M7.5. I need some help, advice on how to implement some more complex tasks.

eg Ask if user wishes to dist-upgrade, if no, continue with next part of the script. If user has antiX-M7, they will need to upgrade only from the Mepis repos to begin with, then disable the repos before dist-upgrading.

03 August 2008, major changes. This is what it now looks like. 06 August 2008, added mplayer skins.


Script


#!/bin/bash

# -------------------------------------------------------------------------------------- #
# Script:     antiX-upgrader.sh                                                          #
# Version     0.1.2 (03 August 2008, Thessaloniki)                                       #
# Author:     anticapitalista antiX@operamail.com                                        #
# Details:    upgrade versions of antiX                                                  #
# Copyright (C) Paul Banham aka anticapitalista 2008                                     #
# 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 2 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.         #
#                                                                                        # 
# Get the full text of the GPL here:                                                     #
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html                                  #
# -------------------------------------------------------------------------------------- #

# SOURCING THE CODE

FTP=http://www.mepisimo.com/antix/scripts-in-progress

TEMP=/usr/share/temp

LIB=/usr/local/bin
LIB_1=antiX1.tgz

LIB1=/usr/local/lib
LIB1_1=rox-lib2-2.0.5.tar.bz2

SYS=/etc/init.d
SYS_1=mepis-network.sh

ICON=/usr/share/icons
ICON_1=ROX-SVG.tgz
ICON_2=black-white_2-Gloss_big1.tgz
ICON_3=gTangish-2.0a1.tgz

FLUX=/usr/share/fluxbox
FLUX_1=fluxbox-antiX1.tgz

ICE=/usr/share/icewm
ICE_1=icewm-antiX1.tgz

SLIM=/etc
SLIM_1=slim.conf

XIN_1=xinitrc

NIT=/usr/share/wallpaper
NIT_1=config-antiX1.tgz

PIX=/usr/share/pixmaps
PIX_1=wicd_32x32.png

GRB=/boot/grub
GRB_1=message

MPLAY=/usr/share/mplayer/skins
MPLAY_1=mplayer-skins.tgz
# -------------------------------------------------------------------------------------- #

# FUNCTIONS

# Outputs in color, then resets color 
function echo_c () {
	echo -ne "\e[33m"
	echo $1 $2
	echo -ne "\e[0m"
}

# -------------------------------------------------------------------------------------- #


# INTRODUCTION

if [ $UID -ne 0 ]; then
	echo_c "Please run this script as root."
	exit
fi

HOMECHECK=$(pwd | cut -d/ -f2)
if [ $HOMECHECK = "home" ]; then
	USERNAME=$(pwd | cut -d/ -f3)
else
	echo_c "Enter your username:" 
	read USERNAME
fi

XIN=/home/$USERNAME

# UPGRADING ANTIX

echo_c "Only if you are upgrading from antiX-M7 or antiX-M7.01,"
echo_c "make sure the following folders exist before" 
echo_c "running the script, as otherwise it will fail."
echo_c "/usr/local"
echo_c "/usr/local/bin" 
echo_c "~/Wallpaper"
echo_c "~/.icewm"
echo_c 
echo_c "Please make sure that the MEPIS repo in" 
echo_c "/etc/apt/sources.list is DISABLED"
echo_c 
echo_c "If you are upgrading from antiX-M7 or antiX-M7.01 and"
echo_c "you have OpenOffice installed, you MUST remove it"
echo_c "before running this script. It will fail otherwise"
echo_c "apt-get remove --purge openoffice.org-core"
echo_c 

echo_c -n "Are you ready to upgrade antiX, $USERNAME ? [y|n]"
read INPUT
if [ "$INPUT" = "n" ]
then
  echo_c "Job cancelled."
  exit
else
  echo_c "Hope it works ;-)"
fi

# -------------------------------------------------------------------------------------- #


# Removing ffmpeg mplayer. This is necessary for antiX-M7.2-M7.5(libavutilcvs49)
function ffmpeg_remove {
echo_c "In order to dist-upgrade safely, ffmpeg will be removed"

apt-get update
apt-get remove --purge libavutilcvs49
apt-get clean

}
# Removing pidgin. This is necessary to upgrade from antiX-M7.01.(libpurple0 libnss3-0d)
function pidgin_remove {
echo_c "In order for antiX-M7.01 to upgrade safely, pidgin will be removed."

apt-get update
apt-get remove --purge libpurple0 libnss3-0d
apt-get update
apt-get install pidgin iceweasel
apt-get -f install

}
# Install necessary apps.
function apps_install {
echo_c "Now, we will add some necessary apps ..."

apt-get update
apt-get install nitrogen lxappearance gtkdialog zenity geany icemc unrar-free icewm wterm roxterm gksu synaptic catfish mybashburn gmpc aumix-gtk xsane usplash transmission claws-mail epdfview osmo mountpy pcmanfm gnome-cups-manager 
apt-get -f install
apt-get clean

echo_c "Apps installed"

}
# /usr/local/bin* Installing controlcentre and smxi script.

function controlcentre_install {
echo_c "Adding antiX contol-centre ..."

rm -fdrv $LIB

mkdir $LIB
cd $LIB
wget -Nc techpatterns.com/smxi 
chmod +x smxi
echo_c "smxi updated."

wget -nv $FTP/$LIB_1
tar xvfz $LIB_1
rm $LIB_1

echo_c "Contol-centre added."

}
#/usr/share/icons* More icons for controlcentre and rox
function icons_install {
echo_c "Updating icons ..."

cd $ICON

wget -Nc $FTP/$ICON_1
wget -Nc $FTP/$ICON_2
wget -Nc $FTP/$ICON_3
tar xvfz $ICON_1
tar xvfz $ICON_2
tar xvfz $ICON_3
rm $ICON_1
rm $ICON_2
rm $ICON_3 

# wicd icon

echo_c "Installing extra pixmaps ..."

cd $PIX
wget -Nc $FTP/$PIX_1

echo_c "Icons updated"

cd $MPLAY
wget -Nc $FTP/$MPLAY_1
tar xvfz $MPLAY_1
rm $MPLAY_1
echo_c "Mplayer skins updated"
}

# /usr/share/fluxbox Update fluxbox menu and startup
function fluxbox_update {
echo_c "Updating fluxbox ..."

cd $FLUX

wget -Nc $FTP/$FLUX_1
tar xvfz $FLUX_1
rm $FLUX_1
mv $FLUX/fluxbox/theme.cfg $FLUX/styles/antiX
mv $FLUX/fluxbox/fluxbox48x48-trans-metal-bevel.png $FLUX
mv $FLUX/fluxbox/fluxbox-icon-32x32.png $FLUX
mv -b $FLUX/fluxbox/menu $XIN/.fluxbox
mv -b $FLUX/fluxbox/startup $XIN/.fluxbox
rm -fdrv $FLUX/fluxbox

echo_c "Fluxbox updated"

}
# /usr/share/icewm Get all new icewm files
function icewm_update {
echo_c "Updating icewm ..."

cd $ICE

wget -Nc $FTP/$ICE_1
tar xvfz $ICE_1
rm $ICE_1
cp -r $ICE/AntiX $ICE/themes
rm -fdrv $ICE/AntiX
mv -b $ICE/keys $XIN/.icewm
mv -b $ICE/menu $XIN/.icewm
mv -b $ICE/preferences $XIN/.icewm
mv -b $ICE/theme $XIN/.icewm
mv -b $ICE/toolbar $XIN/.icewm
mv -b $ICE/winoptions $XIN/.icewm
mv -b $ICE/startup $XIN/.icewm

echo_c "Icewm updated"

}
# /etc/slim.conf More login options
function slim_update {
echo_c "Updating Slim login manager ..."

cd $SLIM

cp $SLIM/slim.conf $SLIM/slim.conf.bak
rm -fv $SLIM/slim.conf
wget -Nc $FTP/$SLIM_1

echo_c "Slim login manager updated"

}
# /initrc Login options
function initrc_update {
echo_c "Updating .xinitrc ..."

cd $XIN
wget -Nc $FTP/$XIN_1
cp $XIN/xinitrc $XIN/.xinitrc
rm $XIN/xinitrc

echo_c "New .xinitrc."

}
# /etc/share/wallpaper Background for nitrogen, Rox options, ROX-Lib2
function background_new {
echo_c "Setting up background ..."

mkdir $NIT
mkdir $TEMP
cd $TEMP
wget -Nc $FTP/$NIT_1
tar xvfz $NIT_1
rm $NIT_1
wget -Nc $FTP/rox-lib2-2.0.5.tar.bz2
tar xvjf rox-lib2-2.0.5.tar.bz2
rm rox-lib2-2.0.5.tar.bz2
cd rox-lib2-2.0.5
mv ROX-Lib2 $LIB1
rm -fdrv $TEMP/rox-lib2-2.0.5
mv $TEMP/config/AntiX-BTB.jpg $NIT
mv $TEMP/config/Greenz2.jpg $NIT
cp $NIT/AntiX-BTB.jpg $XIN/Wallpaper
cp $NIT/Greenz2.jpg $XIN/Wallpaper
cd $XIN/Wallpaper
chown -R $USERNAME\: AntiX-BTB.jpg
chown -R $USERNAME\: Greenz2.jpg
cd $XIN/.config
mkdir nitrogen
chown -R $USERNAME\: nitrogen
cp $TEMP/config/nitrogen/bg-saved-fb.cfg $XIN/.config/nitrogen
cp $TEMP/config/nitrogen/bg-saved-icewm.cfg $XIN/.config/nitrogen
chown -R $USERNAME\: $XIN/.config/nitrogen/bg-saved-fb.cfg
chown -R $USERNAME\: $XIN/.config/nitrogen/bg-saved-icewm.cfg
cp $TEMP/config/menus2 $XIN/.config/rox.sourceforge.net/ROX-Filer
cp $TEMP/config/globicons $XIN/.config/rox.sourceforge.net/ROX-Filer
cp $TEMP/config/Options $XIN/.config/rox.sourceforge.net/ROX-Filer
cp $TEMP/config/pb_inboard=antiX $XIN/.config/rox.sourceforge.net/ROX-Filer
cp $TEMP/config/pb_Pinboard $XIN/.config/rox.sourceforge.net/ROX-Filer
chown -R $USERNAME\: $XIN/.config/rox.sourceforge.net/ROX-Filer/menus2
chown -R $USERNAME\: $XIN/.config/rox.sourceforge.net/ROX-Filer/globicons
chown -R $USERNAME\: $XIN/.config/rox.sourceforge.net/ROX-Filer/Options
chown -R $USERNAME\: $XIN/.config/rox.sourceforge.net/ROX-Filer/pb_inboard=antiX
chown -R $USERNAME\: $XIN/.config/rox.sourceforge.net/ROX-Filer/pb_Pinboard
rm -fdrv $TEMP/config 

echo_c "Nitrogen/Rox configured."

}
# /etc/init.d/mepis-network Fixed lcpi path
function mepis-network_fix {
echo_c "Updating mepis-network ..."

cd $SYS

rm -fv $SYS/mepis-network.sh
wget -Nc $FTP/$SYS_1

chmod +x $SYS_1

echo_c "Mepis-network upgraded"

}
#message file upgraded for boot/menu
function grub-message_change {
echo_c -n "Do you want to upgrade boot menu graphics? [y|n] "
read INPUT
if [ "$INPUT" = "n" ]
then
  echo_c "Job cancelled."
  exit
else
  echo_c "Hope it works ;-)"

cd $GRB
rm -fv $GRB/message
wget -Nc $FTP/message
echo_c "Grub screen updated."

fi

}
#Re-install ffmpeg
function ffmpeg_install {
echo_c "Time to re-install ffmpeg"

apt-get update
apt-get install ffmpeg
apt-get -f install
apt-get clean

}

#Dist-upgrade. Ask if users want to dist-upgrade.Recommended.
function dist-upgrade {
echo_c -n "Do you want to dist-upgrade? It will be approx. 300MB [y|n] "
read INPUT
if [ "$INPUT" = "n" ]
then
  echo_c "Job cancelled."
  exit
else
  echo_c "Time to dist-upgrade. ;-)"

apt-get update
apt-get dist-upgrade
apt-get -f install
apt-get clean
fi

}

# Execute
ffmpeg_remove
pidgin_remove
apps_install
controlcentre_install
icons_install
fluxbox_update
icewm_update
slim_update
initrc_update
background_new
mepis-network_fix
grub-message_change
ffmpeg_install
dist-upgrade

echo_c "Finished. Your antiX is now up-to-date"
# -------------------------------------------------------------------------------------- #
# -------------------------------------------------------------------------------------- #


Personal tools