User articles

From antiX

(Difference between revisions)
Jump to: navigation, search
Anticapitalista (Talk | contribs)
(Reverted edits by Anticapitalista (talk) to last revision by AdrianTM)

Latest revision as of 15:41, 5 February 2011

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.


Script


#!/bin/bash

# -------------------------------------------------------------------------------------- #
# Script:     antiX-upgrader.sh                                                          #
# Version     0.1.0 (28 July 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

LOC=/usr/local


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

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

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

# 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

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

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

# UPGRADING ANTIX

# Removing ffmpeg mplayer. This is necessary for antiX-M7.2-M7.5

echo_c "In order to dist-upgrade safely, ffmpeg will be removed"

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

#Dist-upgrade. As if users want to dist-upgrade.

echo_c "Time to dist-upgrade."

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

# Install necessary apps. Make different for different versions? ie M7/7.01/,-base. 
# Need to make sure that /usr/local and /usr/local/bin exists (M7/M7.01)
# Need to make sure ~/.icewm exists (not in base)

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 wicd mountpy gnome-cups-manager 
apt-get clean

echo_c "Apps installed"

# /usr/local/bin*

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*

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"

# /usr/share/fluxbox

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

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

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

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

echo_c "Setting up background ..."

mkdir $NIT
mkdir $TEMP
cd $TEMP
wget -Nc $FTP/$NIT_1
tar xvfz $NIT_1
rm $NIT_1
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
rm -fdrv $TEMP/config 

echo_c "Nitrogen configured."

# /etc/init.d/mepis-network

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"

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

echo_c "Time to re-install ffmpeg"

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

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



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


Personal tools