From 7c50bee5c519f9e01d38cad290310e95638c6e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Vinicius=20Semprebom=20Gon=C3=A7alves?= <lucass.semprebom@gmail.com> Date: Tue, 10 Jun 2014 14:38:22 -0300 Subject: [PATCH] le-multiterminal-lic: Add dpkg-divert for pre existant license files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lucas Vinicius Semprebom Gonçalves <lucass.semprebom@gmail.com> --- le-multiterminal-lic/package/DEBIAN/control | 2 +- le-multiterminal-lic/package/DEBIAN/postrm | 20 +++++++++--- le-multiterminal-lic/package/DEBIAN/preinst | 35 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100755 le-multiterminal-lic/package/DEBIAN/preinst diff --git a/le-multiterminal-lic/package/DEBIAN/control b/le-multiterminal-lic/package/DEBIAN/control index 79c23241..b6f756c6 100755 --- a/le-multiterminal-lic/package/DEBIAN/control +++ b/le-multiterminal-lic/package/DEBIAN/control @@ -1,7 +1,7 @@ Package: le-multiterminal-lic Priority: important Section: main -Version: 0.0.3 +Version: 0.0.7 Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br> Description: Userful multiplier license for Linux Educacional 5 Architecture: all diff --git a/le-multiterminal-lic/package/DEBIAN/postrm b/le-multiterminal-lic/package/DEBIAN/postrm index 84f7648c..cf479ad4 100755 --- a/le-multiterminal-lic/package/DEBIAN/postrm +++ b/le-multiterminal-lic/package/DEBIAN/postrm @@ -20,9 +20,21 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -LicExt="1box.info" -DirLic="/etc/userful/license" +# Paths +DirLic="/etc/userful/license/" +LicExt="1Box.info" -if [ -f $DirLic/*$LicF ]; then - rm -f $DirLic/*$LicF +# List of file to divert +List="$(ls ${DirLic}/*${LicExt}* 2> /dev/null)" + +# Move diverted files back +if [[ "$1" != "upgrade" ]]; then + for file in $List; do + if [[ "${file}" != *".real" ]]; then + if test -e "${file}.real"; then + rm -f "${file}" + fi + fi + dpkg-divert --remove --rename "${file%.real}" + done fi diff --git a/le-multiterminal-lic/package/DEBIAN/preinst b/le-multiterminal-lic/package/DEBIAN/preinst new file mode 100755 index 00000000..a678ac4f --- /dev/null +++ b/le-multiterminal-lic/package/DEBIAN/preinst @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Copyright (C) 2004-2012 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of le-multiterminal-lic +# +# le-multiterminal-lic 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. + +# Paths +DirLic="/etc/userful/license/" +LicExt="1Box.info" + +# Files to divert +license_list="$(ls ${DirLic}/*${LicExt} 2> /dev/null)" + +# Divert files +for file in $license_list; do + dpkg-divert --divert "${file}.real" --rename "${file}" +done + +exit 0 -- GitLab