Commit d4825022 authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski

Merge remote branch 'le-recovery/master'

Signed-off-by: 's avatarThiago H. S. Picharski <thsp08@c3sl.ufpr.br>
parents 44f100e9 0acd1ff5
#!/bin/bash
# gerar.sh
# Copyright (c) 2006 by Bruno Ribas <ribas@ufpr.br>
DIRTMP=$(mktemp -d)
VERSAO=$(cat VERSAO)
#arrumar versao
#$1 tipo de incremento
MAJOR=$(echo $VERSAO| cut -d'.' -f1)
MINOR=$(echo $VERSAO| cut -d'.' -f2)
REVISION=$(echo $VERSAO| cut -d'.' -f3)
case $1 in
Minor)
((MINOR++))
REVISION=0
;;
Major)
((MAJOR++))
MINOR=0
REVISION=0
;;
help)
echo "Uso: $0 Major|Minor|Revision"
echo ' Major - Altera versao Major'
echo ' Minor - Altera versao Minor'
exit
;;
*)
((REVISION++))
;;
esac
VERSAO="${MAJOR}.${MINOR}.${REVISION}"
echo "$VERSAO" > VERSAO
#Compila a documentacao do pacote no diretorio doc/
#cd doc/
#hevea -text *.tex
#hevea -text *.tex
#cd ../
cp -r pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".svn" -exec rm -rf {} \; &>/dev/null
sed -i -e "s/Version:/Version: $VERSAO/" pacote/DEBIAN/control
fakeroot dpkg -b pacote .
cd -
cp $DIRTMP/*deb .
rm -rf $DIRTMP
# vim:tabstop=4:shiftwidth=4:encoding=iso-8859-1
Package: le-recovery
Priority: important
Section: main
Version:
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Description: Recover Linux Educacional system
Architecture: i386
Depends: squashfs-tools, initramfs-tools
#!/bin/bash
#
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-recovery
#
# le-recovery 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
GRUB_DEVICE_MAP=/boot/grub/device.map
GRUB_SCRIPT=/etc/grub.d/15_le-recovery
DISK_LABEL=le-recovery
DISK_PATH_BY_LABEL=/dev/disk/by-label/$DISK_LABEL
# the label does not exist
if [[ ! -L $DISK_PATH_BY_LABEL ]]; then
echo "WARNING: LE recovery partition not found."
exit 0 # still not returning an error
fi
DISK_PATH=$(readlink -f $DISK_PATH_BY_LABEL)
DISK_PARTITION=$(echo $DISK_PATH | sed -e 's/[^0-9]//g')
DISK=$(echo $DISK_PATH | sed -e 's/[0-9]//')
# creating grub device map
grub-mkdevicemap --device-map=$GRUB_DEVICE_MAP
# probing grub name for this disk
GRUB_DISK=$(grep $DISK $GRUB_DEVICE_MAP | cut -f1 | sed -e 's/[(|)]//g')
# we need to use two here documents:
# 1) parameter substitution turned off
cat > $GRUB_SCRIPT <<'EOF'
#!/bin/sh
exec tail -n +3 $0
# Inserts recovery option for Linux Educacional system.
menuentry 'Recuperar Linux Educacional' --class linux --class gnu-linux --class gnu --class os {
insmod ext2 $0
EOF
# 2) parameter substitution turned on
cat >> $GRUB_SCRIPT <<EOF
set root='($GRUB_DISK,$DISK_PARTITION)'
linux /vmlinuz-2.6.32-24-generic
initrd /initrd.img-2.6.32-24-generic
}
EOF
# updating grub menu
update-grub
#!/bin/bash
#
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-recovery
#
# le-recovery 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
[[ $1 == 'remove' ]] && update-grub
exit 0
#!/bin/bash
#
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-recovery
#
# le-recovery 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
RECOVERY_LABEL=le-recovery
RECOVERY_PARTITION=/dev/disk/by-label/$RECOVERY_LABEL
RECOVERY_MOUNT_POINT=/mnt
DIRS="/bin /boot /etc /lib /sbin /usr /var /opt"
IMAGE=recovery-image.sqsh
# checking the recovery partition
if ! test -b $RECOVERY_PARTITION; then
echo "Error: Cannot find recovery partition. Aborting..."
exit 1
fi
if ! mount $RECOVERY_PARTITION $RECOVERY_MOUNT_POINT; then
echo -n "Error: Cannot mount '$RECOVERY_PARTITION' on "
echo "'$RECOVERY_MOUNT_POINT'. Aborting..."
exit 1
fi
if mksquashfs $DIRS $RECOVERY_MOUNT_POINT/$IMAGE; then
echo "Recovery image generated. No errors found..."
else
echo "Error: mksquashfs has returned errors."
fi
umount $RECOVERY_MOUNT_POINT
#!/bin/sh
#
# Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-recovery
#
# le-recovery 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
RECOVERY_LABEL=le-recovery
RECOVERY_PARTITION=/dev/disk/by-label/$RECOVERY_LABEL
RECOVERY_MOUNT_POINT=/mnt
RECOVERY_SQUASH_ROOT=$RECOVERY_MOUNT_POINT/squashed
RECOVERY_REAL_ROOT=$RECOVERY_MOUNT_POINT/root
IMAGE=recovery-image.sqsh
echo "do-the-recovery: INICIANDO O PROCEDIMENTO DE RECUPERACAO"
sleep 5
# checking the recovery partition
if ! test -b $RECOVERY_PARTITION; then
echo "Error: Cannot find recovery partition. Aborting..."
exit 1
fi
# checking mount target
test -d $RECOVERY_MOUNT_POINT || mkdir $RECOVERY_MOUNT_POINT
if ! mount $RECOVERY_PARTITION $RECOVERY_MOUNT_POINT; then
echo -n "Error: Cannot mount '$RECOVERY_PARTITION' on "
echo "'$RECOVERY_MOUNT_POINT'. Aborting..."
exit 2
fi
mkdir -p $RECOVERY_SQUASH_ROOT
mkdir -p $RECOVERY_REAL_ROOT
if mount.real -o loop $RECOVERY_MOUNT_POINT/$IMAGE $RECOVERY_SQUASH_ROOT; then
echo "Recovery image mounted successfully..."
else
echo "Unable to mount recovery image."
exit 3
fi
rsync -r --delete --exclude= $RECOVERY_SQUASH_ROOT $RECOVERY_REAL_ROOT
# Linux Educacional 4.0
C3SL - Centro de Computacao Cientifica e Software Livre
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Edson Ramiro Lucas Filho
Eduardo Cunha de Almeida
Erik Alexandre Pucci
Fabiano Silva
Jorge Augusto Meira
Josiney de Souza
Juliana Bueno
Lucio Foltran da Silva
Luis Carlos Erpen de Bona
Marcos Castilho
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Vinicius Kwiecien Ruoso
This diff is collapsed.
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-base
#
# le-base 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This script is included in others scripts to use common functions
PREFIX=$(dirname $(readlink -f $0))
TMP=$PREFIX/tmp
getPrimaryDisk()
{
basename $(ls -l /dev/disk/by-id/ | egrep -v "usb|total" |
awk '{print $NF}' | sort | head -n1)
}
getDiskSize()
{
echo $(cat /sys/block/$DEVICE/size)
}
getInitFreeSpace()
{
echo $((
$(tail -n1 $TMP/partition-struct | cut -d ' ' -f4 | tr "," " ") +
$(tail -n1 $TMP/partition-struct | cut -d ' ' -f8 | tr "," " ") +
2048))
}
getFreeSpace()
{
size=$(cat /sys/block/$DEVICE/size)
echo $(($size - $(getInitFreeSpace) - 5103))
}
nextPartition()
{
next=$(($(tail -n1 $TMP/partition-struct | cut -d ' ' -f1 | sed -r \
's@/dev/[a-z]{3}@@g')+1))
echo $(tail -n1 $TMP/partition-struct | cut -d ' ' -f1 | sed -e \
"s@[0-9]@$next@g")
}
getLogicalSize()
{
echo $(grep "Id= 5" $TMP/partition-struct | awk '{print $6}' | tr "," " ")
}
saveImg()
{
sfdisk -d /dev/$DEVICE > $TMP/partition-struct
dd if=/dev/${DEVICE}1 of=$TMP/${DEVICE}1-$DISTRO.img
}
checkStatus()
{
if [ -n "$(grep "$DEVICE" /etc/mtab)" ]; then
echo "Error: /dev/$DEVICE is mounted according with mtab"
return 1
fi
return 0
}
checkUser()
{
if ! [ -r /dev/$DEVICE ]; then
echo "Please, execute this script as root!"
return 1
fi
return 0
}
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-base
#
# le-base 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This script will edit a default installation of Kubuntu desktop
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
export HOME=/root
export LC_ALL=C
dbus-uuidgen > /var/lib/dbus/machine-id
#ln -s /bin/true /sbin/initctl
#------------------------------------------------------------------------------
#edit distro
rm -f /etc/apt/sources.list.d/le-repos.list
echo "deb http://repositorio.mec.gov.br mec 3.0" \
>> /etc/apt/sources.list.d/le-repos.list
echo "deb http://windu.c3sl.ufpr.br/le le-testing main" \
>> /etc/apt/sources.list.d/le-repos.list
for user in $(grep "home/.*/sh" /etc/passwd | cut -d ':' -f1); do
userdel $user --remove
done
PASSWORD="123mudar"
useradd professor -p $PASSWORD
adduser professor admin
useradd aluno1 -p $PASSWORD
useradd aluno2 -p $PASSWORD
useradd aluno3 -p $PASSWORD
apt-get -y --force-yes update
apt-get -y --force-yes remove --purge $(cat /root/remove.list)
apt-get -y --force-yes autoremove
#------------------------------------------------------------------------------
aptitude clean
rm -rf /root/.bash_history /tmp/* /var/lib/dbus/machine-id
#dpkg-divert --rename --remove /sbin/initctl
umount /proc
umount /sys
umount /dev/pts
exit 0
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-base
#
# le-base 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This Script will partition and copy the Linux Educacional image to hard disk
# of computer
. $(dirname $(readlink -f $0))/common.sh
#------------------------------------------------------------------------------
# Sets configuration variables
if [ -n "$1" ]; then
DEVICE=$1
else
DEVICE=$(getPrimaryDisk)
fi
#------------------------------------------------------------------------------
# Check ambient integrity
checkUser || exit 1
checkStatus || exit 2
#------------------------------------------------------------------------------
# installs distro
if [ -e "$TMP/partition-struct" ]; then
sed -i "s@$(getLogicalSize)@$(($(getLogicalSize)+$(getFreeSpace)+2048))@g"\
$TMP/partition-struct
echo "$(nextPartition) : start= $(getInitFreeSpace),"\
" size=$(getFreeSpace), Id=83" >> $TMP/partition-struct
sfdisk --force /dev/$DEVICE < $TMP/partition-struct
head -n-1 $TMP/partition-struct > $TMP/partition-struct.tmp &&
mv -f $TMP/partition-struct.tmp $TMP/partition-struct
mkfs.ext4 $(nextPartition)
mkfs.ext4 $(grep "Id=83$" $TMP/partition-struct | cut -d ' ' -f1)
mkswap $(grep "Id=82" $TMP/partition-struct | cut -d ' ' -f1)
echo "Copying image to disk..."
dd if="$(ls $TMP/.*img | grep ${DEVICE}1)" of="/dev/${DEVICE}1"
else
echo "Not found hard disk image."
exit 1
fi
#------------------------------------------------------------------------------
# Configures recovery partition
echo "Configurating Recovery image..."
mkdir -p $TMP/recovery
mount -t ext4 $(grep "Id=83$" $TMP/partition-struct | cut -d ' ' -f1) $TMP/recovery
gzip -c "$(ls $TMP/.*img | grep ${DEVICE}1)" > $TMP/recovery/recovery.img.gz
umount $TMP/recovery && rm -rf $TMP/recovery
#------------------------------------------------------------------------------
# Move home content to separate partition and configures fstab
echo "Configurating home directory..."
mkdir -p $TMP/chroot-dir $TMP/home
mount -t ext4 /dev/${DEVICE}1 $TMP/chroot-dir
mount -t ext4 $(nextPartition) $TMP/home
grep -v "/home" $TMP/chroot-dir/etc/fstab > $TMP/fstab.tmp && mv -f \
$TMP/fstab.tmp $TMP/chroot-dir/etc/fstab
echo "UUID=$(ls -l --time-style="+%F %R" /dev/disk/by-uuid |
grep $(basename $(nextPartition)) | awk '{print $8}') /home ext4 "\
"defaults 0 0" >> $TMP/chroot-dir/etc/fstab
mv -f $TMP/chroot-dir/home/.directory $TMP/home/
for home in $(grep "home/.*/sh" $TMP/chroot-dir | cut -d':' -f6); do
mkdir -p $TMP$home
done
umount $TMP/chroot-dir
umount $TMP/home
rm -rf $TMP/chroot-dir $TMP/home
exit 0
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-base
#
# le-base 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
. $(dirname $(readlink -f $0))/common.sh
#------------------------------------------------------------------------------
editDistro()
{
CHROOTDIR=$TMP/chroot-dir
mkdir -p $CHROOTDIR
mount -t ext4 /dev/${DEVICE}1 $CHROOTDIR
#cp $CHROOTDIR/etc/resolv.conf $CHROOTDIR/etc/resolv.conf.BKP
cp $CHROOTDIR/etc/hosts $CHROOTDIR/etc/hosts.BKP
cp /etc/resolv.conf $CHROOTDIR/etc/
cp /etc/hosts $CHROOTDIR/etc/
mount --bind /dev $CHROOTDIR/dev
cp $1 $CHROOTDIR/root
cp $2 $CHROOTDIR/root
chroot $CHROOTDIR /root/$(basename $1)
rm $CHROOTDIR/root/$(basename $1) $CHROOTDIR/root/$(basename $2)
umount $CHROOTDIR/dev
rm -f $CHROOTDIR/etc/resolv.conf
mv -f $CHROOTDIR/etc/hosts.BKP $CHROOTDIR/etc/hosts
umount $CHROOTDIR
rm -rf $CHROOTDIR
}
#------------------------------------------------------------------------------
# Sets configuration variables
DISTRO=kubuntu-10.04.1
SCRIPT=$PREFIX/edit-kubuntu.sh
LIST=$PREFIX/remove.list
if [ -n "$1" ]; then
DEVICE=$1
else
DEVICE=$(getPrimaryDisk)
fi
#------------------------------------------------------------------------------
# Check ambient integrity
checkUser || exit 1
checkStatus || exit 2
#------------------------------------------------------------------------------
# Init chroot routines
mkdir -p $TMP
editDistro $SCRIPT $LIST
saveImg
exit 0
akregator
apt-transport-https
apturl-common
apturl-kde
avahi-utils
bcmwl-modaliases
bogofilter
bogofilter-bdb
bogofilter-common
brltty
byobu
dnsmasq-base
dragonplayer
exiv2
fancontrol
fglrx-modaliases
freespacenotifier
geoip-database
gnupg-curl
gtk2-engines-qtcurve
hunspell-en-us
icoutils
im-switch
installation-report
intel-gpu-tools
irqbalance
kaddressbook
kcalc
kcm-touchpad
kdegraphics-strigi-plugins
kdepim-groupware
kdepim-kresources
kdepim-strigi-plugins
kdepim-wizards
kerneloops-daemon
kmail
kmousetool
knotes
konqueror-plugin-searchbar
kontact
kopete
kopete-message-indicator
korganizer
kpackagekit
krdc
krfb
krosspython
ktimetracker
ktorrent
ktorrent-data
kubuntu-debug-installer
kubuntu-notification-helper
kvkbd
kwalletmanager
libbrlapi0.5
libcap-ng0
libclass-accessor-perl
libdjvulibre-text
libdjvulibre21
libepub0
libgadu3
libindicate-qt0
libindicate4
libio-string-perl
libjs-jquery
libkdepim4
libkleo4
libkopete4
libkpgp4
libksieve4
liblockfile1
libmailtools-perl
libmeanwhile1
libmimelib4
libmsn0.3