Commit f0fbd865 authored by Lucas's avatar Lucas

SCRUM#509: Add CI runner with lint stage

parent f5d0d451
Pipeline #16946 passed with stage
in 11 seconds
stages:
- lint
lint_shell:
stage: lint
tags:
- debian-packaging
script:
- ./.linter_shell.sh
\ No newline at end of file
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
sh_files=$(find . -type f -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
#if
echo -e "$files"| xargs 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
#!/bin/bash
cleanTmpFiles() {
local tmp="$1"
rm --recursive --force ${TMP}
closeChroot
}
emergency_shell() {
local tmp="$1"
cleanTmpFiles ${tmp}
echo "FATAL ERROR!"
exit 1
}
function log() {
local type=$1
local msg=$2
echo "$msg" 1>&2 >> "$LOG_FILE"
}
# shellcheck disable=SC1090
initChroot() {
local chrootdir="$1"
local chrootdir="${1}"
# Create the log file; this file will be bind to appear in $VARLOG
# Create the log file; this file will be bind to appear in "${VARLOG}"
# directory in the target machine that generates the iso.
touch "${chrootdir}/${LOG_FILE}"
touch "$LOG_FILE"
touch "${LOG_FILE}"
mount --bind /dev "${chrootdir}/dev"
mount --bind /dev/pts "${chrootdir}/dev/pts"
mount --bind /proc "${chrootdir}/proc"
mount --bind /sys "${chrootdir}/sys"
mount --bind "${LOG_FILE}" "${chrootdir}/${LOG_FILE}" ||
log ERROR "Failed to bind log file from: '${LOG_FILE}' to '${chrootdir}/${LOG_FILE}'."
mount --bind "${LOG_FILE}" "${chrootdir}/${LOG_FILE}"
mount --bind "/etc/resolv.conf" "${chrootdir}/etc/resolv.conf"
# Prevent services from being started in the chrooted environment
rm -rf ${chrootdir}/fakebin
chroot ${chrootdir} mkdir /fakebin
chroot ${chrootdir} ln -s /bin/true /fakebin/initctl
chroot ${chrootdir} ln -s /bin/true /fakebin/invoke-rc.d
chroot ${chrootdir} ln -s /bin/true /fakebin/restart
chroot ${chrootdir} ln -s /bin/true /fakebin/start
chroot ${chrootdir} ln -s /bin/true /fakebin/stop
chroot ${chrootdir} ln -s /bin/true /fakebin/service
chroot ${chrootdir} ln -s /bin/true /fakebin/start-stop-daemon
rm -rf "${chrootdir:?}/fakebin"
chroot "${chrootdir}" mkdir /fakebin
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/initctl
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/invoke-rc.d
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/restart
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/start
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/stop
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/service
chroot "${chrootdir}" ln --symbolic /bin/true /fakebin/start-stop-daemon
}
closeChroot() {
local chrootdir="$1"
local chrootdir="${1}"
umount --lazy "${chrootdir}/etc/resolv.conf"
umount --lazy "${chrootdir}/${LOG_FILE}"
umount --lazy ${chrootdir}/{dev/pts,proc,sys,dev}
umount --lazy "${chrootdir}"/{dev/pts,proc,sys,dev}
}
function create_stub() {
local script=$1
local script="${1}"
cat << EOF > "$script"
cat << EOF > "${script}"
#!/usr/bin/env bash
# THIS SCRIPT WAS GENERATE DINAMICALLY BY CREATE-ISO
......@@ -70,49 +49,45 @@ function create_stub() {
EOF
cat ${PREFIX}/helper/logging.incsh >> ${script}
}
genErrHandle() {
echo "eval if test $? -ne 0; then perror ${BASH_SOURCE[1]}: line ${BASH_LINENO} $@; /bin/bash;fi"
cat "${PREFIX}/helper/logging.incsh" >> "${script}"
}
genErrHandleInChroot() {
echo "if test \$? -ne 0; then perror ${BASH_SOURCE[1]}: line ${BASH_LINENO} $@; /bin/bash;fi"
getLogArguments() {
echo "\"$(basename "${BASH_SOURCE[1]}")\" \"${BASH_LINENO[0]}\""
}
addToChrootFile() {
local chrootdir="$1"
local script_name="$2"
local cmd="$3"
local chrootdir="${1}"
local script_name="${2}"
local cmd="${3}"
if [ ! -f "${chrootdir}/tmp/${script_name}" ]; then
create_stub "${chrootdir}/tmp/${script_name}"
fi
echo ${cmd} >> "${chrootdir}/tmp/${script_name}"
echo "${cmd}" >> "${chrootdir}/tmp/${script_name}"
}
execChroot() {
local chrootdir="$1"
local script_name="$2"
local chrootdir="${1}"
local script_name="${2}"
[ ! -x "${chrootdir}/tmp/${script_name}" ] && chmod +x "${chrootdir}/tmp/${script_name}"
chroot "${chrootdir}" "/tmp/${script_name}"
rm --recursive --force "${chrootdir}/tmp/${script_name}" &>/dev/null
rm --recursive --force "${chrootdir}/tmp/${script_name:?}" &>/dev/null
return $?
}
function cleanup() {
local chrootdir="$1"
local tmp="$2"
local chrootdir="${1}"
local tmp="${2}"
if mountpoint --quiet "${chrootdir}/etc/resolv.conf"; then
umount --lazy "${chrootdir}/etc/resolv.conf"
fi
if mountpoint --quiet "${chrootdir}/${LOG_FILE}"; then
umount --lazy "${chrootdir}/$LOG_FILE"
umount --lazy "${chrootdir}/${LOG_FILE}"
fi
if mountpoint --quiet "${chrootdir}/dev/pts"; then
umount --lazy "${chrootdir}/dev/pts"
......@@ -126,5 +101,5 @@ function cleanup() {
if mountpoint --quiet "${chrootdir}/proc"; then
umount --lazy "${chrootdir}/proc"
fi
rm --recursive --force "$tmp"
rm --recursive --force "${tmp:?}"
}
#!/bin/bash
# shellcheck disable=SC1090
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
......@@ -20,31 +21,26 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
if [ "$(id -u)" != "0" ]; then
echo You must have more power to run this script
exit -1
fi
export PREFIX=$(pwd)
source ${PREFIX}/conf/pre.conf \
|| log ERROR "Preconfiguration file not found"
export PREFIX="${PWD}"
source "${PREFIX}/conf/pre.conf"
while true; do
case "$1" in
case "${1}" in
-h | --help ) _HELP=true; shift ;;
-d | --distro ) _DIST=$2; shift; shift ;;
-a | --arch ) _ARCH=$2; shift; shift ;;
-r | --repo ) _REPO=$2; shift; shift ;;
-d | --distro ) _DIST="${2}"; shift; shift ;;
-a | --arch ) _ARCH="${2}"; shift; shift ;;
-r | --repo ) _REPO="${2}"; shift; shift ;;
-* ) echo "Unrecognized option. Try with --help."; exit 1 ;;
* ) break ;;
esac
done
if [ ${_HELP} = true ]; then
echo "Usage: $0 [OPTION] [ARGUMENT]..."
if [ "${_HELP}" = true ]; then
echo "Usage: ${0} [OPTION] [ARGUMENT]..."
echo ""
echo "Examples:"
echo " sudo $0 --distro le6/testing # Generate default arch (amd64) le6 iso image"
echo " sudo $0 -d le6/testing -a i386 # Generate i386 architecture le6 iso image"
echo " sudo ${0} --distro le6/testing # Generate default arch (amd64) le6 iso image"
echo " sudo ${0} -d le6/testing -a i386 # Generate i386 architecture le6 iso image"
echo ""
echo "Options:"
echo " -h, --help Show this help list"
......@@ -54,17 +50,17 @@ if [ ${_HELP} = true ]; then
exit 2
fi
if [ -z ${_DIST} ]; then
if [ -z "${_DIST}" ]; then
echo "No distro specified. Try with --help."
exit 1
fi
if [ ${_ARCH} != "amd64" -a ${_ARCH} != "i386" ]; then
if [ "${_ARCH}" != "amd64" ] && [ "${_ARCH}" != "i386" ]; then
echo "Unrecognized architecture. Try with --help."
exit 1
fi
if [ ${_REPO} != "stable" -a ${_REPO} != "testing" -a ${_REPO} != "unstable" ]; then
if [ "${_REPO}" != "stable" ] && [ "${_REPO}" != "testing" ] && [ "${_REPO}" != "unstable" ]; then
echo "Unrecognized remote repository codename. Try with --help."
exit 1
fi
......@@ -74,76 +70,80 @@ if [ "$(id -u)" != "0" ]; then
exit -1
fi
source "${PREFIX}/conf/$_DIST/create-iso.conf" \
|| log ERROR "configuration file not found for dist: \"${_DIST}\""
source "${PREFIX}/conf/${_DIST}/create-iso.conf"
TIME_STAMP="`date +'%Y-%m-%dT%H:%M:%S'`"
TIME_STAMP="$(date +'%Y-%m-%dT%H:%M:%S')"
export LOG_FILE="${LOG_PATH}/create-iso-${TIME_STAMP}.log"
exec 1<&-
exec 2<&-
exec 1<> ${LOG_FILE}
exec 1<> "${LOG_FILE}"
exec 1>&1
mkdir --parents ${TMP}
source ${PREFIX}/common.sh
source ${PREFIX}/helper/logging.incsh
source ${PREFIX}/lib/mktmpfs.sh
source ${PREFIX}/lib/overlay.sh
apt-get install isolinux syslinux squashfs-tools genisoimage xorriso
$(genErrHandle "Failed to install basic tools")
mountTmpfs ${TMPFS}
mountOverlay ${CHROOTDIR} ${TMPFS}
for script in `ls ${SCRIPTSDIR}`; do
if [ -x "$SCRIPTSDIR/$script" ] && egrep --quiet '^[0-9]{2}-[A-Za-z]+' <<< "$script"; then
pinfo "Running `basename $script`..."
if ! "${SCRIPTSDIR}/${script}"\
${_DIST} \
${_ARCH} \
${_REPO} \
${CHROOTDIR} \
${SCRIPT_NAME} \
${DISTRO} \
${DPLIST} \
${INSTLIST} \
${ISOLINUX} \
${MOUNTLIST} \
${OURSOURCESLIST} \
${RMDSKT} \
${RMLIST} \
${SCRIPTSDIR} \
${SHORTNAME} \
${SOURCESLISTDEFAULT} \
${TMP} \
${TMPFS} \
${REPOPKGS} \
${LOG_FILE}; then
log ERROR "While running \"${SCRIPTSDIR}/${script}\""
cleanup "$CHROOTDIR" "$TMP"
mkdir --parents "${TMP}"
source "${PREFIX}/common.sh"
source "${PREFIX}/helper/logging.incsh"
source "${PREFIX}/lib/mktmpfs.sh"
source "${PREFIX}/lib/overlay.sh"
# Installation of create-iso's dependencies
apt-get install isolinux syslinux squashfs-tools genisoimage xorriso --yes || \
perror "Failed to install basic tools"
mountTmpfs "${TMPFS}"
mountOverlay "${CHROOTDIR}" "${TMPFS}"
# Each one of the available scripts is executed in numeric order
for script in "${SCRIPTSDIR}"/*; do
if [ -x "${script}" ] && grep -E --quiet '^[0-9]{2}-[A-Za-z]+' <<< "$(basename "${script}")"; then
pinfo "Running $(basename "${script}")..."
if ! "${script}"\
"${_DIST}" \
"${_ARCH}" \
"${_REPO}" \
"${CHROOTDIR}" \
"${SCRIPT_NAME}" \
"${DISTRO}" \
"${DPLIST}" \
"${INSTLIST}" \
"${ISOLINUX}" \
"${MOUNTLIST}" \
"${OURSOURCESLIST}" \
"${RMDSKT}" \
"${RMLIST}" \
"${SCRIPTSDIR}" \
"${SHORTNAME}" \
"${SOURCESLISTDEFAULT}" \
"${TMP}" \
"${TMPFS}" \
"${REPOPKGS}" \
"${LOG_FILE}"; then
cleanup "${CHROOTDIR}" "${TMP}"
exit 1
fi
if [[ "$script" =~ [0-9]+\-chroot\.* ]]; then
# If the script is marked as 'chroot', it means it performs changes in the overlayed chroot filesystem,
# therefore, the 'chroot script', filled with the required commands by the marked script, is executed
# This warning is disabled because the literal '-' is actually needed:
# shellcheck disable=SC1001
if [[ "$(basename "${script}")" =~ [0-9]+\-chroot\.* ]]; then
initChroot "${CHROOTDIR}" "${LOG_FILE}"
execChroot "$CHROOTDIR" "${SCRIPT_NAME}"
#echo "PARADO"
#read a
execChroot "${CHROOTDIR}" "${SCRIPT_NAME}"
closeChroot "${CHROOTDIR}" "${LOG_FILE}"
fi
fi
done
NAME="LinuxEducacional6-$(echo ${_DIST} | cut --delimiter='/' --fields=2).iso"
pushd ${TMP}/image
xorriso -as mkisofs -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -no-emul-boot -isohybrid-gpt-basdat -o ${PREFIX}/iso/${NAME} .
$(genErrHandle "Failed to generate iso image.")
popd
# Finally generates the resulting iso image
NAME="LinuxEducacional6-$(echo "${_DIST}" | cut --delimiter='/' --fields=2).iso"
pushd "${TMP}/image" || perror "Unable to change directory"
xorriso -as mkisofs -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -no-emul-boot -isohybrid-gpt-basdat \
-o "${PREFIX}/iso/${NAME}" . || perror "Failed to generate iso image."
popd || perror "Unable to change directory"
cleanup "${CHROOTDIR}" "${TMP}"
umountOverlay ${CHROOTDIR} ${TMPFS}
umountTmpfs ${TMPFS}
umountOverlay "${CHROOTDIR}" "${TMPFS}"
umountTmpfs "${TMPFS}"
exit 0
#!/bin/bash
# shellcheck disable=SC1090
mount --bind /dev chroot/dev
mount --bind /dev/pts chroot/dev/pts
......
......@@ -4,33 +4,74 @@ readonly INFO=4
readonly DEBUG=8
readonly ALL=15
VERBOSE_FLAGS=$ALL
VERBOSE_FLAGS=${ALL}
perror () {
if [ $(($VERBOSE_FLAGS & $ERROR)) -eq $ERROR ]; then
echo -e "\033[38;5;9m[error]\033[0m $@" 1>&2
echo -e "\033[38;5;9m[error]\033[0m $@" >> "$LOG_FILE"
if [ "$((${VERBOSE_FLAGS} & ${ERROR}))" -eq "${ERROR}" ]; then
if [ -z "${2}" ]; then
SCRIPT="${2}"
else
SCRIPT="$(basename "${BASH_SOURCE[1]}")"
fi
if [ -z "${3}" ]; then
LINE_NUM="${3}"
else
LINE_NUM="${BASH_LINENO[0]}"
fi
echo -e "\033[38;5;9m[error]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}" 1>&2
echo -e "\033[38;5;9m[error]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}" >> "${LOG_FILE}"
/bin/bash
fi
}
pwarning () {
if [ $(($VERBOSE_FLAGS & $WARNING)) -eq $WARNING ]; then
echo -e "\033[38;5;11m[warning]\033[0m $@"
echo -e "\033[38;5;11m[warning]\033[0m $@" >> "$LOG_FILE"
if [ "$((${VERBOSE_FLAGS} & ${WARNING}))" -eq "${WARNING}" ]; then
if [ -z "${2}" ]; then
SCRIPT="${2}"
else
SCRIPT="$(basename "${BASH_SOURCE[1]}")"
fi
if [ -z "${3}" ]; then
LINE_NUM="${3}"
else
LINE_NUM="${BASH_LINENO[0]}"
fi
echo -e "\033[38;5;11m[warning]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}"
echo -e "\033[38;5;11m[warning]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}" >> "${LOG_FILE}"
fi
}
pinfo () {
if [ $(($VERBOSE_FLAGS & $INFO)) -eq $INFO ]; then
echo -e "\033[38;5;10m[info]\033[0m $@"
echo -e "\033[38;5;10m[info]\033[0m $@" >> "$LOG_FILE"
if [ "$((${VERBOSE_FLAGS} & ${INFO}))" -eq "${INFO}" ]; then
if [ -z "${2}" ]; then
SCRIPT="${2}"
else
SCRIPT="$(basename "${BASH_SOURCE[1]}")"
fi
if [ -z "${3}" ]; then
LINE_NUM="${3}"
else
LINE_NUM="${BASH_LINENO[0]}"
fi
echo -e "\033[38;5;10m[info]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}"
echo -e "\033[38;5;10m[info]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}" >> "${LOG_FILE}"
fi
}
pdebug () {
if [ $(($VERBOSE_FLAGS & $DEBUG)) -eq $DEBUG ]; then
echo -e "\033[38;5;6m[debug]\033[0m $@"
echo -e "\033[38;5;6m[debug]\033[0m $@" >> "$LOG_FILE"
if [ "$((${VERBOSE_FLAGS} & ${DEBUG}))" -eq "${DEBUG}" ]; then
if [ -z "${2}" ]; then
SCRIPT="${2}"
else
SCRIPT="$(basename "${BASH_SOURCE[1]}")"
fi
if [ -z "${3}" ]; then
LINE_NUM="${3}"
else
LINE_NUM="${BASH_LINENO[0]}"
fi
echo -e "\033[38;5;6m[debug]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}"
echo -e "\033[38;5;6m[debug]\033[0m ${SCRIPT}: line ${LINE_NUM}: ${1}" >> "${LOG_FILE}"
fi
}
......
#!/bin/bash
# shellcheck disable=SC1090
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
......@@ -21,23 +22,23 @@
# USA.
mountTmpfs() {
local tmpfs=$1
local tmpfs="${1}"
if mountpoint --quiet ${tmpfs}; then
if mountpoint --quiet "${tmpfs}"; then
return 1
fi
mkdir --parents ${tmpfs}
mkdir --parents "${tmpfs}"
if [ ! -d "${tmpfs}" ]; then
echo "overlay path: '${tmpfs}' has not been found."
exit 1
fi
mount --types tmpfs tmpfs --options suid,dev,size=6291456k ${tmpfs}
mount --types tmpfs tmpfs --options suid,dev,size=6291456k "${tmpfs}"
}
umountTmpfs() {
local tmpfs=$1
if mountpoint --quiet ${tmpfs}; then
umount ${tmpfs}
local tmpfs="${1}"
if mountpoint --quiet "${tmpfs}"; then
umount "${tmpfs}"
fi
rm --recursive --force ${tmpfs}
rm --recursive --force "${tmpfs:?}"
}
#!/bin/bash
# shellcheck disable=SC1090
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
......@@ -21,13 +22,13 @@
# USA.
mountOverlay() {
local chrootdir=$1
local tmpfs=$2
local prefix=$(pwd)
local chrootdir="${1}"
local tmpfs="${2}"
local prefix="${PWD}"
mkdir --parents "${tmpfs}/upper"
mkdir --parents "${tmpfs}/work"
mkdir --parents ${chrootdir}
mkdir --parents "${chrootdir}"
if [ ! -d "${tmpfs}" ]; then
echo "overlay path: '${tmpfs}' has not been found."
......@@ -50,8 +51,8 @@ mountOverlay() {
exit 1
fi
if ! mountpoint --quiet ${chrootdir}; then
if ! mount --types overlay overlay --options rw,lowerdir="${prefix}/chroot",upperdir="${tmpfs}"/upper,workdir="${tmpfs}"/work "${chrootdir}"; then
if ! mountpoint --quiet "${chrootdir}"; then
if ! mount --types overlay overlay --options rw,lowerdir="${prefix}"/chroot,upperdir="${tmpfs}"/upper,workdir="${tmpfs}"/work "${chrootdir}"; then
echo "Overlay could not be mounted:" >&2
echo " lowerdir: '${prefix}/chroot'" >&2
echo " upperdir: '${tmpfs}/upper'" >&2
......@@ -63,11 +64,11 @@ mountOverlay() {
}
umountOverlay() {
local chrootdir=$1
local tmpfs=$2
if mountpoint --quiet ${chrootdir}; then
umount ${chrootdir}
local chrootdir="${1}"
local tmpfs="${2}"
if mountpoint --quiet "${chrootdir}"; then
umount "${chrootdir}"
fi
rm --recursive --force ${tmpfs}/{upper,work}
rm --recursive --force "$chrootdir"
rm --recursive --force "${tmpfs}/{upper,work:?}"
rm --recursive --force "${chrootdir:?}"
}
#!/usr/bin/env bash
# shellcheck disable=SC1090
# shellcheck disable=SC2091
#set -x
_DIST=$1
PREFIX=$PWD
_DIST="${1}"
PREFIX="${PWD}"
source ${PREFIX}/conf/$_DIST/create-iso.conf
source ${PREFIX}/common.sh
source "${PREFIX}/conf/${_DIST}/create-iso.conf"
source "${PREFIX}/common.sh"
mkdir -p $TMP/bl/
cd $TMP/bl/
cpio -i < $ISOLINUX/bootlogo
mkdir -p "${TMP}/bl/"
cd "${TMP}/bl/" || perror "Unable to change directory"
cpio -i < "${ISOLINUX}/bootlogo"
sed -i 's/ubuntu/Linux Educacional/Ig' ./*.{tr,hlp}
echo "" > $TMP/list
for i in $(ls); do
echo $i >> $TMP/list
echo "" > "${TMP}/list"
for i in ./*; do
echo "${i}" >> "${TMP}/list"
done
#ls -l | awk '{if(NR>1)print}' | cut -c44- > $TMP/list
cpio -o < $TMP/list > bootlogo
mv $TMP/bl/bootlogo $ISOLINUX
cd $ISOLINUX
#ls -l | awk '{if(NR>1)print}' | cut -c44- > "${TMP}/list"
cpio -o < "${TMP}/list" > bootlogo
mv "${TMP}/bl/bootlogo" "${ISOLINUX}"
cd "${ISOLINUX}" || perror "Unable to change directory"
sed -i 's/ubuntu/Linux Educacional/Ig' ./*.{tr,hlp}
rm -rf $TMP/bl/
rm $TMP/list
rm -rf "${TMP:?}/bl/"
rm "${TMP:?}/list"
exit 0
#!/usr/bin/env bash
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of create-iso
#
# create-iso 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 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.
_DIST=$1
_ARCH=$2
_REPO=$3
CHROOTDIR=$4
SCRIPT_NAME=$5
DISTRO=$6
DPLIST=$7
INSTLIST=$8
ISOLINUX=$9
MOUNTLIST=${10}
OURSOURCESLIST=${11}
RMDSKT=${12}
RMLIST=${13}
SCRIPTSDIR=${14}
SHORTNAME=${15}
SOURCESLISTDEFAULT=${16}
TMP=${17}
TMPFS=${18}
REPOPKGS=${19}
PREFIX=$PWD
source ${PREFIX}/common.sh
initChroot $_DIST || \
log ERROR "failed to initialize chroot."
execChroot $SCRIPT_NAME $CHROOTDIR
RET=$?
closeChroot || \
log ERROR "failed to close chroot."
exit $?
#!/usr/bin/env bash
# shellcheck disable=SC1090
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
......@@ -20,28 +21,28 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
_DIST=$1
_ARCH=$2
_REPO=$3
CHROOTDIR=$4
SCRIPT_NAME=$5
DISTRO=$6
DPLIST=$7
INSTLIST=$8
ISOLINUX=$9
MOUNTLIST=${10}
OURSOURCESLIST=${11}
RMDSKT=${12}
RMLIST=${13}
SCRIPTSDIR=${14}
SHORTNAME=${15}
SOURCESLISTDEFAULT=${16}
TMP=${17}
TMPFS=${18}
REPOPKGS=${19}
PREFIX=$PWD
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"