SCRUM#606: Initial version

parent a8771f64
Pipeline #18449 passed with stages
in 20 minutes and 27 seconds
#!/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 || return
debuild -us -uc --lintian-opts --profile debian
cd ../ || return
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
*.swp
*.pyc
build/
make_deb.sh
__pycache_
shellcheck*_
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- lint
- build
- test
- deploy
lint_shell:
stage: lint
tags:
- debian-packaging
script:
- ./.linter_shell.sh
build:
stage: build
artifacts:
paths:
- build/
tags:
- debian-packaging
script:
- ./.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:
- /^rc-.*$/
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
#!/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
# Download the lastest stable version of shellcheck
apt install wget
wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz
tar xf shellcheck-stable.linux.x86_64.tar.xz
if echo -e "$files"| xargs ./shellcheck-stable/shellcheck -s bash
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
This diff is collapsed.
le-proinfodata (1.0.0) unstable; urgency=medium
* Initial release (Closes: #627)
-- Davisson Paulino <lesuporte@inf.ufpr.br> Mon, 03 Sep 2018 11:38:06 -0300
Source: le-proinfodata
Section: admin
Priority: important
Maintainer: Equipe Linux Educacional <lesuporte@c3sl.ufpr.br>
Uploaders: Davisson Paulino <lesuporte@inf.ufpr.br>, Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>, Rafael Sanfelice Castilho <rsc15@inf.ufpr.br>
Build-Depends: devscripts, debhelper (>= 9.20160709)
Standards-Version: 3.9.8
Vcs-Git: https://gitlab.c3sl.ufpr.br/le6/le-proinfodata.git
Package: le-proinfodata
Architecture: all
Depends: ${misc:Depends}, zenity, wget, passwd, sudo, cron, bzip2, xli, acl
Description: Agent of PROINFODATA project designed for the LE project
Coleta de dados do projeto ProInfo/MEC de inclusão digital nas escolas
públicas brasileiras (PROINFODATA) is a project supported by Ministério da
Educação e Cultura (MEC) that collects some information about computer
laboratories at public schools in Brazil and make these data available
through a website.
This agent periodically collects the data of the computer that it is
installed and sends them to a webservice running on internet.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: le-proinfodata
Source: https://gitlab.c3sl.ufpr.br/le6/le-samba
Files: *
Copyright: 2017 Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
2017 Levi Gomes <lhgs15@inf.ufpr.br>
2017 C3SL <contato@c3sl.ufpr.br>
License: GPL-3.0+
On Debian systems, the complete text of the GNU General Public
License, version 3, can be found in /usr/share/common-licenses/GPL-3.
le-proinfodata_1.0.0_all.deb admin important
le-proinfodata_1.0.0_amd64.buildinfo admin important
etc/le-proinfodata/* etc/le-proinfodata
usr/* usr/
var/lib/AccountsService/users/* var/lib/AccountsService/users/
#!/bin/bash
#DEBHELPER#
# Copyright (C) 2004-2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# proinfodata 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 is the postinst of proinfodata
set -e
SEED_MEC_HOME="/opt/seed_mec"
#SEED_USER="seed_mec"
BACKUP_DIR="/opt/seed_mec_backup"
LBFILE="/etc/le-proinfodata/le.zone.bz2"
MULTISEAT_DIR="/etc/userful/scripts/PostLogin"
EXE_DIR="/usr/lib/le-proinfodata/"
# shellcheck disable=SC1091
source /usr/lib/le-proinfodata/commum.sh
# Set option on lightdm.conf. If the option $1 already exists, make sure it
# has the value $2. If it doesn't exist, add it.
function setLightdmOption() {
local option=$1
local value=$2
if [[ ! -d "/etc/lightdm/lightdm.conf.d/" ]]; then
mkdir -p "/etc/lightdm/lightdm.conf.d/"
fi
echo -e "[Seat:*]\\n${option}=${value}" > /etc/lightdm/lightdm.conf.d/10-proinfodata.conf
}
# Check whether file $1 was already diverted.
# Return true if it was and false otherwise.
function alreadyDiverted() {
file="$1"
dpkg-divert --listpackage "$file" | grep -q le-proinfodata
return $?
}
# Descompressing the local base
[[ -f $LBFILE ]] && bunzip2 -f $LBFILE
# Install the PROINFODATA agent
[[ -f /usr/lib/le-proinfodata/agent.run ]] && bash /usr/lib/le-proinfodata/agent.run || error=$?
case $error in
1)
echo >&2 "ERRO: Falha ao criar grupo seed_mec."
exit 1
;;
2)
echo >&2 "ERRO: Falha ao criar o usuário seed_mec."
exit 1
;;
3)
echo >&2 "ERRO: Falha ao adicionar permissões de super-usuário ao usuário seed_mec."
exit 1
;;
4)
echo >&2 "ERRO: md5 incorreto, o pacote esta corrompido"
exit 1
;;
5)
echo >&2 "ERRO: Falha ao mudar dono dos arquivos."
exit 1
;;
6)
echo >&2 "AVISO: arquivo inep não encontrado ou corrompido, agente executou com erro"
;;
*)
echo >&2 "ERRO: agente retornou codigo de erro desconhecido"
exit 1
;;
esac
# Check if there is a backup for the inep and proxy files and restore it
if test -f "${BACKUP_DIR}/SEED2/client/conf/inep"; then
# Restore the inep and proxy files, and also their backup and md5sum
# counterparts
for FILE in "proxy" "inep"; do
cp -af "${BACKUP_DIR}/SEED2/.backup/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.backup/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/.md5sum/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/.md5sum/.backup/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/client/conf/${FILE}"
done
# Remove the auxiliar directory
rm -rf "${BACKUP_DIR}"
fi
# Set lightdm to open the le-proinfodata configuration script when user
# session starts
if [[ ! -d $MULTISEAT_DIR ]]; then
#TODO: Change it to tigger in every login not only on the first
setLightdmOption "session-setup-script" "/usr/lib/le-proinfodata/exec_dialog.sh"
fi
# We will no longer need this files, but as the postrm would only remove the
# diverts when this package were removed, we have to do it here
DIVERTS="
/etc/init/dbus.conf \
/etc/init/tty1.conf \
"
for file in $DIVERTS; do
if alreadyDiverted "$file"; then
dpkg-divert --package le-proinfodata --remove --rename \
--divert "${file}"{.real,}
fi
done
# The multiseat system need the exec_dialog.sh script to be in a different
# place to work properly
if [[ -d "$MULTISEAT_DIR" ]]; then
ln -fs "/usr/lib/le-proinfodata/exec_dialog.sh" \
"$MULTISEAT_DIR/05-exec_dialog.script"
fi
# Make sure the owner of ~seed_mec is seed_mec
#chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"
eval "$EXE_DIR"/middleware_agent_cron.sh --fix_crontab
give_permissions
exit 0
#!/bin/bash
#DEBHELPER#
# Copyright (C) 2004-2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-proinfodata
#
# le-proinfodata 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 is the postrm of proinfodata
set -e
SEED_MEC_HOME="/opt/seed_mec"
if test "$1" != "purge" -a -f "${SEED_MEC_HOME}/SEED2/client/conf/inep"; then
rm -rf "${SEED_MEC_HOME}/SEED2/"[^c]* \
"${SEED_MEC_HOME}/SEED2/"c[^l]* \
"${SEED_MEC_HOME}/SEED2/client/"[^c]* \
"${SEED_MEC_HOME}/SEED2/client/common.sh" \
"${SEED_MEC_HOME}/SEED2/client/conf/version"
else
rm -rf "${SEED_MEC_HOME}"
fi
rm -f /etc/lightdm/lightdm.conf.d/10-proinfodata.conf
exit 0
#!/bin/bash -e
#DEBHELPER#
# Copyright (C) 2004-2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# proinfodata 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 is the preinst of proinfodata
SEED_MEC_HOME="/opt/seed_mec"
CONF="${SEED_MEC_HOME}/SEED2/client/conf/"
BKPCONF="${SEED_MEC_HOME}/SEED2/.backup/client/conf/"
MD5CONF="${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"
MD5BKPCONF="${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/"
BKP="/opt/seed_mec_backup"
BKP_CONF="${BKP}/SEED2/client/conf/"
BKP_BKPCONF="${BKP}/SEED2/.backup/client/conf/"
BKP_MD5CONF="${BKP}/SEED2/.md5sum/client/conf/"
BKP_MD5BKPCONF="${BKP}/SEED2/.md5sum/.backup/client/conf/"
LBFILE="/etc/le-proinfodata/le.zone*"
rm -f "$LBFILE"
# Check if there is a previously configured INEP and no backup before creating
# the backup for both the inep and proxy files
if test -f "${CONF}/inep" -a ! -f "${BKP_CONF}/inep"; then
# Create auxiliar directories
mkdir -p "${BKP_CONF}"
mkdir -p "${BKP_BKPCONF}"
mkdir -p "${BKP_MD5CONF}"
mkdir -p "${BKP_MD5BKPCONF}"
# Copy the inep and proxy files, and also their backup and md5sum
# counterparts. The last copied file is the inep, so the verification of its
# existence always means the other ones also exist
for FILE in "proxy" "inep"; do
if test -f "${BKPCONF}/${FILE}"; then
cp -af "${BKPCONF}/${FILE}" "${BKP_BKPCONF}/${FILE}"
else
cp -af "${CONF}/${FILE}" "${BKP_BKPCONF}/${FILE}"
fi
if test -f "${MD5CONF}/${FILE}"; then
cp -af "${MD5CONF}/${FILE}" "${BKP_MD5CONF}/${FILE}"
else
md5sum "${CONF}/${FILE}" | cut -d' ' -f1 > "${BKP_MD5CONF}/${FILE}"
fi
if test -f "${MD5BKPCONF}/${FILE}"; then
cp -af "${MD5BKPCONF}/${FILE}" "${BKP_MD5BKPCONF}/${FILE}"
else
md5sum "${CONF}/${FILE}" | cut -d' ' -f1 > \
"${BKP_MD5BKPCONF}/${FILE}"
fi
cp -af "${CONF}/${FILE}" "${BKP_CONF}/${FILE}"
done
fi
exit 0
#!/bin/bash
#DEBHELPER#
# Copyright (C) 2004-2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# proinfodata 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
# This is the prerm of proinfodata
# Delete the crontab of seed_mec
crontab -u seed_mec -r
# Delete user seed_mec
userdel seed_mec
# Delete group seed_mec
#groupdel seed_mec 2> /dev/null
exit 0
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
#DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
# 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
# main packaging script based on dh7 syntax
%:
dh $@
override_dh_usrlocal:
# both used to reconfigure a seat in lightdm at login time
interest-await /etc/lightdm
interest-await /etc/userful/scripts/PostLogin
This diff is collapsed.
#!/bin/bash
function give_permissions() {
CONF_AGENT_PATH="/opt/seed_mec/SEED2/client/conf"
MD5F_INEP="/opt/seed_mec/SEED2/.md5sum"
BACKUPF_INEP="/opt/seed_mec/SEED2/.backup/"
if grep -q sudo /etc/group;then
setfacl -R -m g:sudo:rwx "$CONF_AGENT_PATH"
#directory may be empty
setfacl -R -m g:sudo:rwx "$MD5F_INEP"
setfacl -R -m g:sudo:rwx "$BACKUPF_INEP"
fi
if grep -q professores /etc/group;then
setfacl -R -m g:professores:rwx "$CONF_AGENT_PATH"
#directory may be empty
setfacl -R -m g:professores:rwx "$MD5F_INEP"
setfacl -R -m g:professores:rwx "$BACKUPF_INEP"
fi
}
#!/bin/bash
# Copyright (C) 2004-2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-proinfodata
#
# le-proinfodata 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.
# shellcheck disable=SC2089
# shellcheck disable=SC2181
# shellcheck disable=SC1117
TEXT="quero digitar o INEP da minha escola depois"
SEED_HOME="/opt/seed_mec/SEED2"
F_INEP="${SEED_HOME}/client/conf/inep"
BACKUPF_INEP="${SEED_HOME}/.backup/client/conf/inep"
MD5BACKUPF_INEP="${SEED_HOME}/.md5sum/.backup/client/conf/inep"
LE_ZONE="/etc/le-proinfodata/le.zone"
MD5F_INEP="${SEED_HOME}/.md5sum/client/conf/inep"
# shellcheck disable=SC1091
source /usr/lib/le-proinfodata/commum.sh
#Filter data in le.zone
function verify_inep() {
local inep=$1
local inep_file=$2
local line
local sch_inep
if [[ ${#inep} -ge 7 ]] || [[ ${#inep} -le 10 ]]; then
line=$(grep -w "$inep" $LE_ZONE | tr -d " ")
sch_inep=$(cut -d "|" -f1 <<< "$line")
fi
if [[ -z "$line" ]] || [[ -z "$sch_inep" ]] || [[ "$sch_inep" != "$inep" ]]; then
return 1
fi
# this line is different because the name of the school may have spaces
sch_name=$(grep -w "$inep" $LE_ZONE | cut -d "|" -f4)
sch_uf=$(cut -d "|" -f2 <<< "$line")
sch_city=$(cut -d "|" -f3 <<< "$line")
sch_zip=$(cut -d "|" -f5 <<< "$line")
#Check whether INEP is valid and correct for user
zenity --list --title="INEP" --text="Essas informações estão corretas?" \
--cancel-label="Não" --ok-label="Sim" --width=600 --height=200 \
--column="Inep" --column="Estado" --column="Municipio" \
--column="Cep" --column="Escola" "$sch_inep" "$sch_uf" "$sch_city" "$sch_zip" "$sch_name"
if [ $? -eq 0 ];then
echo "$sch_inep" > "$inep_file"
return 0
else
# Check INEP is valid but not what the user expected
return 1
fi
}
#Save information of the proxy in file
function verify_proxy() {
local proxy_ok="false"
local password_ok="false"
local proxy
local host
local port
local user
local pwd_confirm
local password
local confirm
while [[ $proxy_ok = "false" ]]; do
proxy=$(zenity --forms --title="PROXY" --text="Preencha as informações de proxy:" --add-entry="Host" --add-entry="Porta" --add-entry="Usuario" --cancel-label="Cancelar")
if [[ $? -eq 1 ]]; then
zenity --info --title="INEP" \
--text="Configuração de Proxy cancelada pelo usuário."
return 0
fi
host=$(cut -d"|" -f1 <<< "$proxy")
port=$(cut -d"|" -f2 <<< "$proxy")
user=$(cut -d"|" -f3 <<< "$proxy")
# Configure the password if exist
zenity --question --title="PROXY" --cancel-label="Não" --ok-label="Sim" --text="Existe senha do proxy?" --width=600 --height=100
if [[ $? -eq 0 ]]; then
password_ok="false"
while [[ $password_ok = "false" ]]; do
pwd_confirm=$(zenity --title="PROXY" --forms --text="Digite a senha" --add-password="Digite a senha" --add-password="Confirme a senha" --cancel-label="Cancelar")
if [[ $? -ne 0 ]]; then
break
fi
password=$(cut -d"|" -f1 <<< "$pwd_confirm")
confirm=$(cut -d"|" -f2 <<< "$pwd_confirm")
if [[ "$password" = "$confirm" ]]; then
password_ok="true"
else
zenity --info --title="PROXY" \
--text="As senhas não conferem\!"
fi
done
else
password_ok="true"
fi
# Check whether PROXY is valid
if [[ $password_ok = "true" ]]; then
zenity --question --title="INEP" --cancel-label="Não" --ok-label="Sim" \
--text="Host:$host \nPorta: $port \nUsuario: $user \nEssas informações estão corretas?"
if [[ $? -eq 0 ]]; then
echo {"phost=$host","pport=$port","puid=$user","ppasswd=$password"} > "$F_PROXY"
proxy_ok="true"
fi
fi
done
return 0
}
# Asks if the user want to abort it
# return 0 if yes 1 if not
abort_screen(){
while true;do
msg=$(zenity --title "Instituição de ensino não reconhecida" --text "Instituição de ensino não selecionada ou inválida.\nEla será requisitada novamente na próxima vez que este computador for ligado.\nDigite a frase \"$TEXT\" para sair\nou pressione \"Cancelar\" para voltar a tela inicial." --entry)
out=$?
if [ "$out" -ne 0 ] ; then
return 1
else
if [ "$msg" == "$TEXT" ]; then
return 0
fi
fi
done
}
### MAIN #######################################################################
# Check if user is in the groups that can configure the inep
if ! groups "$USER"| grep -Eq "root|sudo|professores";then
exit 0
fi
# Check whether the INEP code is already set and exit
#Check if is to force reconfigure INEP
if [[ -f "$F_INEP" && "$1" != "--reconfigure" ]]; then
exit 0
fi