Commit c6fb47f9 authored by Guilherme Becker Agge's avatar Guilherme Becker Agge

SCRUM#608: Create Le-Inep-Bar

parent f9033f10
Pipeline #17750 failed with stages
in 3 minutes
#!/bin/bash
# This script generates a .deb package
apt-get update && apt-get install -y devscripts
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo "$LINE" | cut -d' ' -f1)
VERSION=$(echo "$LINE" | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf "${PACKAGE}"_"${VERSION}".orig.tar.gz package/*
cd package || exit -1
debuild -us -uc --lintian-opts --profile debian
cd ../ || exit -1
mkdir build/
mv "${PACKAGE}"* build/
#!/bin/bash
# shellcheck disable=SC2029
# This script uploads an includes a .deb package in our debian repository.
# The distribution is chosen based on the gitlab-ci stage we are on.
apt-get update && apt-get install -y dput ssh
eval "$(ssh-agent -s)"
ssh-add <(echo "$PRIV_KEY")
echo "Deploy job name: $CI_JOB_NAME"
if [ "$CI_JOB_NAME" = "deploy_for_unstable" ]; then
dput -u -f --config=dput.cf repo build/*.changes
else
if [ "$CI_JOB_NAME" = "deploy_for_testing" ]; then
REPO_SRC="unstable"
REPO_TGT="testing"
elif [ "$CI_JOB_NAME" = "deploy_for_stable" ]; then
REPO_SRC="testing"
REPO_TGT="stable"
fi
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo "$LINE" | cut -d' ' -f1)
VERSION=$(echo "$LINE" | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
REPREPRO_CMD="reprepro -Vb /home/repository/www/le6 copysrc $REPO_TGT $REPO_SRC $PACKAGE $VERSION"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null repository@repo.c3sl.ufpr.br "$REPREPRO_CMD"
fi
package/debian/le-inep-bar
package/debian/le-inep-bar.debhelper.log
package/debian/le-inep-bar.substvars
package/debian/le-inep-bar.*.debhelper
package/debian/files
package/debian/debhelper-build-stamp
le-inep-bar_*.tar.xz
le-inep-bar_*.tar.gz
le-inep-bar_*.build
le-inep-bar_*.dsc
le-inep-bar_*.changes
le-inep-bar_*.deb
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- lint
- build
- test
- deploy
linter_shell:
stage: lint
tags:
- debian-packaging
script:
- ./.linter_shell.sh
linter_javascript:
stage: lint
tags:
- ubuntu
- regular
script:
- apt-get update && apt-get install -y nodejs npm nodejs-legacy
- npm install -g jshint
- jshint package/
build:
stage: build
artifacts:
paths:
- build/
tags:
- ubuntu
- regular
script:
- apt-get update && apt-get install -y glib2.0 && apt-get install -y build-essential devscripts dh-make dh-systemd nodejs npm nodejs-legacy libdbus-1-dev
- npm install -g dbus
- cp -rf /usr/local/lib/node_modules/dbus package/le-inep-bar@c3sl.ufpr.br
- ./.build.sh
test:
stage: test
tags:
- ubuntu
- regular
script:
- apt-get update && apt-get install -y wget
- echo "deb http://repo.c3sl.ufpr.br/le6/ unstable main" > /etc/apt/sources.list.d/le6.list
- wget -O- http://repo.c3sl.ufpr.br/le6/le.c3sl.ufpr.br.key | apt-key add -
- echo "Installation test:"
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install $(pwd)/build/*.deb language-pack-gnome-pt language-pack-pt-base
- echo "Removal test:"
- pkg_name=$(head -n 1 package/debian/changelog | cut -d' ' -f1)
- DEBIAN_FRONTEND=noninteractive apt -y remove $pkg_name
dependencies:
- build
deploy_for_unstable:
stage: deploy
only:
- develop
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
deploy_for_testing:
stage: deploy
when: manual
only:
- master
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
deploy_for_stable:
stage: deploy
when: manual
only:
- master
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
{
"esversion": 6,
"laxbreak": true
}
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
sh_files=$(find -name "*.sh")
exe_files=$(grep -Erl "#\!/bin/(bash|sh)" --exclude=*.* package)
files="$sh_files\n$exe_files"
#find no files
if [[ "$files" == "\n" ]];then
echo -e "${YELLOW}No shell files found!${NC}"
exit 0
fi
echo -e "$files"| xargs shellcheck -s bash
if [[ $? -eq 0 ]];then
echo "AWESOME!No problems found."
exit 0
else
echo -e "Understand errors in: ${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
exit 1
fi
# le-inep-bar
DESCRIPTION
===========
Este pacote visa criar uma extensão para o Gnome para apresentar o nome da escola de acordo com o código inserido pelo usuário.
\ No newline at end of file
This GNOME extension shows the school name as configured by the package le-proinfodata, and allows it to be (re)configured by clicking in the school name shown in the taskbar.
To use the extension, after installation you must restart your session (logout or alt + f2 then use the command 'r'). Then, open Tweak-tool or Extension Prefs (using the command gnome-shell-extension-prefs at a terminal) and enable the extension.
REQUIREMENTS
===========
Gnome-Shell 3.18
gnome-shell-extensions
[repo]
fqdn = repo.c3sl.ufpr.br
method = scp
login = repository
incoming = /home/repository/www/le6/incoming
allow_unsigned_uploads = 1
ssh_config_options = User=repository
StrictHostKeyChecking=no
post_upload_command = ssh -l repository -i ~/.ssh/id_rsa repo.c3sl.ufpr.br "reprepro -Vb /home/repository/www/le6 processincoming default"
DESCRIPTION
===========
This package installs the Inep-Bar extension, which shows the name of the school according to the INEP number configured for the package le-proinfodata. It also allows you to also configure it by clicking on the school name in the toolbar, if it's wrong or hasn't been configured yet.
To use the extension, you must restart your session after installation (logout or alt + F2 then use the command 'r'). Then, open Tweak-tool or Extension Prefs (using the command gnome-shell-extension-prefs at a terminal) and enable the le-inep-bar extension.
REQUIREMENTS
===========
Gnome-Shell 3.18
gnome-shell-extensions
le-inep-bar (0.0.1) unstable; urgency=medium
* Initial release
-- Guilherme Becker Agge <lesuporte@c3sl.ufpr.br> Thu, 23 Aug 2018 10:58:43 -0300
Source: le-inep-bar
Section: admin
Priority: optional
Maintainer: C3SL <contato@c3sl.ufpr.br>
Uploaders: Guilherme Becker Agge <lesuporte@c3sl.ufpr.br>
Build-Depends: debhelper (>=9), autotools-dev, dh-systemd
Standards-Version: 3.9.7
Package: le-inep-bar
Architecture: all
Depends: ${misc:Depends}, ${shlibs:Depends}
#Pre-Depends: le-proinfodata
Description: Shows the school name in the taskbar
GNOME extension that shows the school name from the INEP number.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: le-inep-bar
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: GPL-3.0+
Files: debian/*
Copyright: 2018 Guilherme Becker Agge <lesuporte@c3sl.ufpr.br>
License: GPL-3.0+
License: GPL-3.0+
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 3 of the License, or
(at your option) any later version.
.
This package 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 <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
le-inep-bar@c3sl.ufpr.br usr/share/gnome-shell/extensions/
#!/bin/sh
# Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-inep-bar
#
# le-inep-bar 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.
set -e
# Enable the extension
gnome-shell-extension-tool -e le-inep-bar@c3sl.ufpr.br || true
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Extensions.ReloadExtension 'le-inep-bar@c3sl.ufpr.br' || true
echo "Installation finished. Reset your system and enable the extension for it to work."
#DEBHELPER#
exit 0
#!/bin/sh
# Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-inep-bar
#
# le-inep-bar 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.
set -e
exit 0
#DEBHELPER#
#!/bin/sh
# Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-inep-bar
#
# le-inep-bar 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.
set -e
exit 0
#DEBHELPER#
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
/*
* Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of le-inep-bar
*
* le-inep-bar 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.
*/
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const Main = imports.ui.main;
const St = imports.gi.St;
let button, label, infoBox, text;
let escola, inep, color, textoInfo;
// Gets the school name if the file exists
function getSchool() {
var getInep = 'cat /opt/seed_mec/SEED2/client/conf/inep || true';
// Returns the INEP number from bash
inep = GLib.spawn_command_line_sync(getInep)[1].toString();
// Removes unnecessary spaces
inep = inep.trim();
// Gets the school name if it's configured
if (inep!='') {
color = 'white'; // Change text color
var getZone = 'grep -w '+inep+' /etc/le-proinfodata/le.zone';
escola = GLib.spawn_command_line_sync(getZone)[1].toString();
// Cuts the line returned from grep
var dl = escola.lastIndexOf("|");
escola = escola.substring(1, dl);
dl = escola.lastIndexOf("|");
escola = escola.substring(dl+1, escola.length);
escola = escola.trim();
textoInfo = escola;
// Shows a default message otherwise
} else {
escola = 'INEP AINDA NÃO INSERIDO!';
color = 'red';
textoInfo = 'CLIQUE AQUI PARA INSERIR O NÚMERO DO INEP';
Main.notify('O INEP da sua escola ainda não foi configado!');
}
}
// Gets the name on start
getSchool();
function init() {
button = new St.Bin({ style_class: 'inep-label',
reactive: true,
can_focus: true,
x_fill: true,
y_fill: false,
track_hover: true });
// Button text label
label = new St.Label({ style_class: color,
style: ' 0;',
text: escola });
button.set_child(label);
// Infobox
infoBox = new St.Label({ style_class: 'info-label',
text: textoInfo });
Main.uiGroup.add_actor(infoBox);
infoBox.hide(); // Infobox hidden on start
// Shows infobox when button is hovered
button.connect('enter-event', function(){
xInfo=global.get_pointer()[0];
// Grants the infobox is drawn inside the screen
var screen = Main.layoutManager.primaryMonitor;
if (xInfo+infoBox.width>screen.width)
xInfo -= xInfo+infoBox.width - screen.width;
infoBox.set_position(xInfo, Main.panel._rightBox.height);
infoBox.show();
});
button.connect('leave-event', function(){
infoBox.hide();
});
button.connect('button-press-event', function(){
GLib.spawn_command_line_async('/usr/local/bin/dialog_inep.sh');
infoBox.hide();
});
DBusService = new InepbarService();
}
function enable() {
Main.panel._rightBox.insert_child_at_index(button, 0);
}
function disable() {
Main.panel._rightBox.remove_child(button);
}
// Sets up DBus interface to refresh the name after configuration
const DBusInterface = '<node>'+
' <interface name="br.ufpr.c3sl.inepbar">'+
' <method name="refresh">'+
' </method>'+
' </interface>'+
'</node>';
// Class for the method that is exported to DBus
const InepbarService = new Lang.Class({
Name: 'inepbar',
_init: function() {
this._dbus = Gio.DBusExportedObject.wrapJSObject(DBusInterface, this);
this._dbus.export(Gio.DBus.session, '/br/ufpr/c3sl/inepbar');
},
refresh: function(str) {
getSchool();
label.style_class = color;
label.text = escola;
infoBox.text = textoInfo;
Main.notify('INEP modificado com sucesso');
}
});
{
"description": "Mostra o nome da escola a partir do número INEP.",
"name": "Le-Inep-Bar",
"shell-version": ["3.18.5"],
"uuid": "le-inep-bar@c3sl.ufpr.br"
}
/*
* Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of le-inep-bar
*
* le-inep-bar 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.
*/
.inep-label {
margin: 4px;
min-width: 108px;
min-height: 25px;
font-weight: bold;
}
.info-label {
font-size: 12px;
font-weight: bold;
color: #ffffff;
background-color: rgba(10,10,10,0.7);
border-radius: 5px;
padding: .5em;
}
.white {
color: #FFFFFF;
}
.red {
color: #FF0000;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment