Commit 37414a16 authored by Diego Pasqualin's avatar Diego Pasqualin

ubiquity-le: Remove le-save-contents and all its references

This feature is not working properly and will be implemented in a different
way, on the future.
Signed-off-by: default avatarDiego Pasqualin <dpasqualin@c3sl.ufpr.br>
parent cfd4d9d8
#!/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-save-contents-gtk
Source: le-save-contents
Version:
Architecture: all
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Installed-Size: 231
Depends: python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), usb-creator-common (= 0.2.38), python-gi, gir1.2-gtk-3.0, gir1.2-pango-1.0, gir1.2-glib-2.0, gir1.2-unity-5.0, python-dbus
Section: admin
Priority: optional
Description: Create a copy from MEC educational contents to removable storage
providing a GTK+ frontend to configure backup.
2857f607963e564d6568011129a4faa1 usr/bin/usb-creator-gtk
f3eba7ebc2c421def951e93c1560644b usr/share/applications/usb-creator-gtk.desktop
149ace39e5fcf460e7fcabe5346dc76d usr/share/doc/usb-creator-gtk/copyright
f2ee21233b7bd0bf99d3d2dce49ce687 usr/share/icons/hicolor/scalable/apps/usb-creator-gtk.svg
9509bc37db5cf91a0c75d6db3125a051 usr/share/man/man8/usb-creator-gtk.8.gz
6b99bef49af6916853cd49bd230703ef usr/share/pyshared/usbcreator/frontends/gtk/__init__.py
f30ace18096d79228fc1802d94b757d2 usr/share/pyshared/usbcreator/frontends/gtk/frontend.py
23cbe25708f554faa25ad8bad997316e usr/share/pyshared/usbcreator/frontends/gtk/unitysupport.py
8d012f23a603a48522f1d4800a8a4b06 usr/share/usb-creator/usbcreator-gtk.ui
#!/bin/sh
set -e
# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
pycompile -p le-save-contents-gtk
fi
# End automatically added section
#!/bin/sh
set -e
# Automatically added by dh_python2:
if which pyclean >/dev/null 2>&1; then
pyclean -p le-save-contents-gtk
else
dpkg -L le-save-contents-gtk | grep \.py$ | while read file
do
rm -f "${file}"[co] >/dev/null
done
fi
# End automatically added section
#!/bin/bash
MNT="/media/tmp_mount"
mkdir -p "$MNT"
getFsType()
{
STR=$(file -s $1)
case $STR in
*ext4*)
echo $(cut -d ' ' -f5 <<< "$STR")
;;
*swap*)
echo swap
;;
*FAT*)
echo vfat
;;
*NTFS*)
echo ntfs-3g
;;
esac
}
getSize()
{
echo $(( $(du -s "$1" | awk '{print $1}') * 1024 ))
}
getLabel()
{
ls -l /dev/disk/by-id/ | grep "ata.*$1$" | cut -d '-' -f2 | tr '_' ' '
}
for dev in $(ls -l --time-style=full-iso /dev/disk/by-uuid/ | cut -d' ' -f9- |
egrep "^[[:alnum:]]{8}-([[:alnum:]]{4}-){3}[[:alnum:]]{12}" |
cut -d'/' -f3); do
fsType=$(getFsType /dev/$dev)
if [ -n "$fsType" ] && [ "$fsType" != "swap" ]; then
mount /dev/$dev -t $fsType "$MNT"
if [ -d "$MNT/home/ConteudoMEC" ]; then
partition=/dev/$dev
echo "$partition:/home/ConteudoMEC:$(getSize "$MNT/home/ConteudoMEC"):$(getLabel $dev):$fsType"
elif [ -d "$MNT/ConteudoMEC" ]; then
partition=/dev/$dev
echo "$partition:/ConteudoMEC:$(getSize "$MNT/ConteudoMEC"):$(getLabel $dev):$fsType"
fi
while ! umount "$MNT" 2> /dev/null; do
sleep 1
done
fi
done
rm -rf "$MNT"
exit 0
#!/bin/bash
LOCK=/var/lib/save-contents/lock-udisks.pid
mkdir -p $(dirname $LOCK)
udisks --inhibit -- &
echo $! > $LOCK
if [[ -n "$@" ]]; then
$@
test -e "$LOCK" && kill $(cat $LOCK) 2> /dev/null
rm -f $LOCK
fi
exit 0
#!/usr/bin/python
# Copyright (C) 2009 Canonical Ltd.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as published by the Free Software Foundation.
#
# 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, see <http://www.gnu.org/licenses/>.
import os, sys
import optparse
from dbus import DBusException
from savecontents.frontends.gtk import GtkFrontend
from savecontents.backends.udisks import UDisksBackend
from savecontents.misc import *
import gettext
sane_path()
setup_logging()
gettext.install('usbcreator', localedir='/usr/share/locale', unicode=True)
# TODO evand 2009-07-09: Rename to bin/usb-creator-gtk.in and substitue the
# version in at build time.
parser = optparse.OptionParser(usage=_('%prog [options]'), version='0.2.23')
parser.set_defaults(safe=False,
iso=None,
persistent=True,
allow_system_internal=False,
trace=False)
# FIXME evand 2009-07-28: Reconnect this option to the install routine.
parser.add_option('-s', '--safe', dest='safe', action='store_true',
help=_('choose safer options when constructing the startup '
'disk (may slow down the boot process).'))
parser.add_option('-i', '--iso', dest='img',
help=_('provide a source image (CD or disk) to '
'pre-populate the UI.'))
parser.add_option('-n', '--not_persistent', dest='persistent',
action='store_false',
help=_('disable persistent setting in the UI'))
parser.add_option('--allow-system-internal', dest='allow_system_internal',
action='store_true',
help=_('allow writing to system-internal devices'))
parser.add_option('--show-all', dest='show_all', action='store_true',
help=_('Show all devices'))
(options, args) = parser.parse_args()
try:
if os.path.exists('/var/lib/save-contents/lock-udisks.pid'):
os.system('kill $(cat /var/lib/save-contents/lock-udisks.pid)')
backend = UDisksBackend(allow_system_internal=options.allow_system_internal,
show_all=options.show_all)
frontend = GtkFrontend(backend, options.img, options.persistent,
allow_system_internal=options.allow_system_internal)
if os.path.exists('/var/lib/save-contents/lock-udisks.pid'):
os.system('lock-udisks')
except DBusException as e:
# FIXME evand 2009-07-09: Wouldn't service activation pick this up
# automatically?
# FIXME evand 2009-07-28: Does this really belong this far out?
logging.exception('DBus exception:')
if e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown':
message = _('This program needs udisks running in order to'
'properly function.')
else:
message = _('An error occurred while talking to the udisks '
'service.')
GtkFrontend.startup_failure(message)
sys.exit(1)
except (KeyboardInterrupt, Exception) as e:
# TODO evand 2009-05-03: What should we do here to make sure devices are
# unmounted, etc?
logging.exception('Unhandled exception:')
message = 'An unhandled exception occurred:\n%s' % e
GtkFrontend.startup_failure(message)
../../../../share/pyshared/savecontents/__init__.py
\ No newline at end of file
../../../../../share/pyshared/savecontents/backends/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/backends/base/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/backends/base/backend.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/backends/udisks/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/backends/udisks/backend.py
\ No newline at end of file
../../../../../share/pyshared/savecontents/frontends/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/frontends/base/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/frontends/base/frontend.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/frontends/gtk/__init__.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/frontends/gtk/frontend.py
\ No newline at end of file
../../../../../../share/pyshared/savecontents/frontends/gtk/unitysupport.py
\ No newline at end of file
../../../../share/pyshared/savecontents/install.py
\ No newline at end of file
../../../../share/pyshared/savecontents/misc.py
\ No newline at end of file
../../../../share/pyshared/savecontents/remtimest.py
\ No newline at end of file
[Desktop Entry]
Name=Salvar Conteúdos Educacionais
GenericName=Salvar Conteúdos Educacionais
Comment=Salva uma cópia dos conteúdos educacionais instalados no disco local para uma mídia removível.
Exec=save-contents
Icon=ubiquity
Terminal=false
Type=Application
Categories=System;Settings;GTK;HardwareSettings;
X-Ubuntu-Gettext-Domain=savecontents
from savecontents.misc import *
import logging
import os
import savecontents.install
def abstract(func):
def not_implemented(*args):
raise NotImplementedError('%s is not implemented by the backend.' %
func.__name__)
return not_implemented
class Backend:
def __init__(self):
self.sources = {}
self.targets = {}
self.current_source = None
self.install_thread = None
# Public methods.
def add_contents(self):
logging.debug('Backend told to add contents')
#filename = os.path.abspath(os.path.expanduser(filename))
#if not os.path.isfile(filename):
# return
#if filename in self.sources:
# logging.warn('Source already added.')
# # TODO evand 2009-07-27: Scroll to source and select.
# return
#extension = os.path.splitext(filename)[1]
# TODO evand 2009-07-25: What's the equivalent of `file` on Windows?
# Going by extension is a bit rough.
#if not extension:
# logging.error('File did not have an extension. '
# 'Could not determine file type.')
# # TODO evand 2009-07-26: Error dialog.
# return
self.sources = self.get_contents_info()
'''extension = extension.lower()
if extension == '.iso':
label = self._is_casper_cd(filename)
if label:
self.sources[filename] = {
'device' : filename,
'size' : os.path.getsize(filename),
'label' : label,
'type' : SOURCE_ISO,
}
if callable(self.source_added_cb):
self.source_added_cb(filename)
elif extension == '.img':
self.sources[filename] = {
'device' : filename,
'size' : os.path.getsize(filename),
'label' : '',
'type' : SOURCE_IMG,
}
if callable(self.source_added_cb):
self.source_added_cb(filename)
else:
logging.error('Filename extension type not supported.')
'''
@abstract
def detect_devices(self):
pass
def set_current_source(self, source):
if source == None or source in self.sources:
self.current_source = source
else:
raise KeyError(source)
self.update_free()
def get_current_source(self):
return self.current_source
# Signals.
def source_added_cb(self, drive):
pass
def target_added_cb(self, drive):
pass
def source_removed_cb(self, drive):
pass
def target_removed_cb(self, drive):
pass
def target_changed_cb(self, udi):
pass
def format_ended_cb(self):
pass
def format_failed_cb(self, message):
pass
# Installation signals.
def success_cb(self):
pass
def failure_cb(self, message=None):
pass
def install_progress_cb(self, complete, remaining, speed):
pass
def install_progress_message_cb(self, message):
pass
def install_progress_pulse_cb(self):
pass
def install_progress_pulse_stop_cb(self):
pass
def retry_cb(self, message):
pass
def update_free(self):
if not self.current_source:
return True
keys = self.targets.keys()
for k in keys:
status = self.targets[k]['status']
if status == NEED_FORMAT or status == CANNOT_USE:
continue
changed = self._update_free(k)
if changed and callable(self.target_changed_cb):
self.target_changed_cb(k)
return True
# Internal functions.
def _update_free(self, k):
# TODO evand 2009-08-28: Replace this mess with inotify watches.
# Incorporate accounting for files we will delete. Defer updates if
# sufficient time has not passed since the last update.
if not self.current_source:
return False
current_source = self.sources[self.current_source]
changed = False
target = self.targets[k]
free = target['free']
target['free'] = fs_size(target['mountpoint'])[1]
if free != target['free']:
changed = True
target = self.targets[k]
status = target['status']
target['status'] = CAN_USE
target['persist'] = 0
if target['capacity'] < current_source['size']:
target['status'] = CANNOT_USE
elif target['free'] < current_source['size']:
target['status'] = NEED_SPACE
else:
target['persist'] = (target['free'] - current_source['size'] -
PADDING * 1024 * 1024)
if status != target['status']:
changed = True
# casper cannot handle files larger than MAX_PERSISTENCE (4GB)
persist_max = MAX_PERSISTENCE * 1024 * 1024 - 1
if target['persist'] > persist_max:
target['persist'] = persist_max
return changed
def install(self, source, target, persist, device=None,
allow_system_internal=False):
logging.debug('Starting install thread.')
self.install_thread = savecontents.install.install(
source, target, persist, device=device,
allow_system_internal=allow_system_internal)
# Connect signals.
self.install_thread.success = self.success_cb
self.install_thread.failure = self.failure_cb
self.install_thread.progress = self.install_progress_cb
self.install_thread.progress_message = self.install_progress_message_cb
self.install_thread.progress_pulse = self.install_progress_pulse_cb
self.install_thread.progress_pulse_stop = self.install_progress_pulse_stop_cb
self.install_thread.retry = self.retry_cb
self.install_thread.start()
def cancel_install(self):
logging.debug('cancel_install')
if self.install_thread and self.install_thread.is_alive():
# TODO evand 2009-07-24: Should set the timeout for join, and
# continue to process in a loop until the thread finishes, calling
# into the frontend for UI event processing then break. The
# frontend should notify the user that it's canceling by changing
# the progress message to "Canceling the installation..." and
# disabiling the cancel button.
self.install_thread.join()
# UnitySupport.py
#
# Copyright (c) 2011 Canonical
#
# Author: Robert Roth <robert.roth.off@gmail.com>
# Bilal Akhtar <bilalakhtar@ubuntu.com>
#
# 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.
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
import logging
HAVE_UNITY_SUPPORT=False
try:
from gi.repository import Unity