Commit 81d34019 authored by Daniel Bissani Furlin's avatar Daniel Bissani Furlin

Removed israel's scripts, old version

Signed-off-by: Daniel Bissani Furlin's avatarDaniel Bissani Furlin <dbf15@inf.ufpr.br>
parent f9495558
......@@ -2,3 +2,4 @@ chroot
image
*.swp
iso/**/*.iso
israel-version
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare -r file=./resources/sources.list
declare -r tmp_file=$(mktemp ./resources/sources.list-XXXXXX.tmp)
function clean () {
rm -f ${tmp_file}
}
trap clean EXIT
dialog --keep-tite --title 'Install base system' --editbox ${file} 22 76 > ${tmp_file} 2>&1 >/dev/tty
case ${?} in
${DIALOG_OK:-0})
cat ${tmp_file} > ${file}
exit 0
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare choice
declare default_architecture='amd64'
declare architecture
declare default_codename='xenial'
declare codename
declare default_mirror='http://ubuntu.c3sl.ufpr.br/ubuntu'
declare mirror
declare chroot_dir='./chroot'
while true; do
choice=$(dialog --title 'Install base system' --keep-tite --menu\
'Select an action to perform:' 22 76 16\
1 "Set architecture"\
2 "Set base system's version"\
3 "Set installation mirror"\
4 "Install" 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
case ${choice} in
1)
architecture=$(./select-architecture.sh)
;;
2)
codename=$(./select-base-version.sh)
;;
3)
choice=$(dialog --title 'Install base system' --keep-tite --menu\
'Select the input method:' 22 76 16\
1 "Select from a list"\
2 "Type the mirror's URL" 2>&1 > /dev/tty)
case ${?} in
${DIALOG_OK:-0} | ${DIALOG_CANCEL:-1})
;;
*)
exit 255
;;
esac
case ${choice} in
1)
mirror=$(./select-mirror.sh)
;;
2)
mirror=$(./prompt-mirror.sh)
;;
esac
;;
4)
debootstrap\
--arch=${architecture:-${default_architecture}}\
${codename:-${default_codename}}\
${chroot_dir}\
${mirror:-${default_mirror}} | dialog --keep-tite --title 'Install base system' --programbox 22 76 2>&1 >/dev/tty
if [[ 0 ]]; then
codename_escaped=$(sed 's/[&/\]/\\&/g' <<< "${codename:-${default_codename}}") # Escape sed metacharacters
mirror_escaped=$(sed 's/[&/\]/\\&/g' <<< "${mirror:-${default_mirror}}") # Escape sed metacharacters
sed -e "s/<mirror>/${mirror_escaped}/g" -e "s/<codename>/${codename_escaped}/g" ./resources/template-sources.list > ./resources/sources.list
dialog --keep-tite --title 'Install base system' --yesno\
"\nWould you like to edit the base system's \"sources.list\" file?" 8 35 2>&1 >/dev/tty
case ${?} in
${DIALOG_OK:-0})
./edit-sources-list.sh
exit 0
;;
${DIALOG_CANCEL:-1})
exit 0
;;
*)
exit 255
;;
esac
fi
;;
esac
done
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
# Include configuration file
if [[ -r ./config.sh ]]; then
source ./config.sh # You must sanitize this!!!1!11one
fi
function set_chroot() {
{ # Block
if [[ -r /etc/resolv.conf ]]; then
cp /etc/resolv.conf ${work_dir}/chroot/etc/resolv.conf || exit 1
fi
if [[ -r /etc/hosts ]]; then
cp /etc/hosts ${work_dir}/chroot/etc/hosts || exit 1
fi
mount --bind /dev/ ${work_dir}/chroot/dev || exit 1
mount --bind /dev/pts/ ${work_dir}/chroot/dev/pts/ || exit 1
mount --bind /proc/ ${work_dir}/chroot/proc/ || exit 1
mount --bind /sys/ ${work_dir}/chroot/sys/ || exit 1
} 2>&1 >/dev/null # Entire block silent
}
function unset_chroot() {
{ # Block
umount ${work_dir}/chroot/dev/pts/
umount ${work_dir}/chroot/dev/
umount ${work_dir}/chroot/sys/
umount ${work_dir}/chroot/proc/
rm -f ${work_dir}/chroot/etc/resolv.conf
rm -f ${work_dir}/chroot/etc/hosts
} 2>&1 >/dev/null # Entire block silent
}
OPTIND=1
while getopts "f:h?ua" opt; do
case "${opt}" in
f)
input_file=$OPTARG
;;
h | \?)
show_help
exit 0
;;
u)
upgrade="true"
;;
a)
autoremove="true"
;;
esac
done
shift $(( OPTIND - 1 ))
[[ "$1" == "--" ]] && shift
trap unset_chroot EXIT
set_chroot
echo "UPDATE:" # pense no log depois. isso cai fora.
if ! chroot ${work_dir}/chroot/ apt-get -y update; then
echo "Update failed"
exit 1
fi
echo -e "\nINSTALL:"
if ! chroot ${work_dir}/chroot/ apt-get -y install $(< ./resources/packages-list); then
echo "Installation failed"
exit 1
fi
if [[ "${upgrade}" == "true" ]]; then
echo -e "\nUPGRADE:"
if ! chroot ${work_dir}/chroot/ apt-get -y upgrade; then
echo "Upgrade failed"
exit 1
fi
fi
if [[ "${autoremove}" == "true" ]]; then
echo -e "\nAUTOREMOVE:"
if ! chroot ${work_dir}/chroot/ apt-get -y autoremove; then
echo "Autoremove failed"
exit 1
fi
fi
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare -r default='http://ubuntu.c3sl.ufpr.br/ubuntu/'
declare input
input=$(dialog --keep-tite --title 'Install base system' --inputbox\
"Please provide the mirror URL: [${default}]" 8 72 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
input=${input:-${default}}
echo ${input}
exit 0
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare -a options
declare architecture
architecture=$(dialog --title 'Install base system' --keep-tite --menu\
"Select the base system's architecture:" 22 76 16\
"amd64" ""\
"i386" "" 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
echo ${architecture}
exit 0
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*) exit 255
;;
esac
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare -a options
declare release
for item in $(ls /usr/share/debootstrap/scripts/); do
options+=(${item} '')
done
release=$(dialog --title 'Install base system' --keep-tite --menu\
"Select the base installation's release:" 22 76 16 "${options[@]}" 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
echo ${release}
exit 0
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
#!/bin/bash
#
# Copyright (C) 2004-2016 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.
declare -r raw_mirrors_file='/usr/share/python-apt/templates/Ubuntu.mirrors'
declare -r resources_dir='./resources'
declare -r localities_file=$(mktemp ${resources_dir}/localities-XXXXXX.tmp)
function clean() {
{
line_count=$(cat ${localities_file} | wc -l)
i=0
while IFS= read -r locality_file; do
if [[ $(( i++ % 5 )) == 0 ]]; then
echo $(( (${i} * 100) / ${line_count} ))
fi
rm ${resources_dir}/${locality_file%% *}
done < ${localities_file}
rm ${localities_file}
echo 100
} | dialog --title 'Install base system' --keep-tite --gauge 'Removing temporary files...' 6 31 >/dev/tty
}
trap clean EXIT
{
line_count=$(cat ${raw_mirrors_file} | wc -l)
i=0
while IFS= read -r line; do
if [[ $(( i++ % 5 )) == 0 ]]; then
echo $(( (${i} * 100) / ${line_count} ))
fi
if [[ -n "$(grep '^#' <<< ${line})" ]]; then
current_locality=$(cut -d':' -f 2 <<< ${line})
echo "${current_locality} \"\"" >> ${localities_file}
continue
fi
if ! [[ -z "${current_locality}" ]]; then
echo "${line} \"\"" >> ${resources_dir}/${current_locality}
fi
done < ${raw_mirrors_file}
echo 100
} | dialog --title 'Install base system' --keep-tite --gauge 'Reading mirror list...' 6 27 2>&1 >/dev/tty
locality=$(dialog --title 'Install base system' --keep-tite --menu 'Select locality of mirror:' 22 76 16 --file ${localities_file} 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
mirror=$(dialog --title 'Install base system' --keep-tite --menu "Select mirror for ${locality}:" 22 76 16 --file ${resources_dir}/${locality} 2>&1 >/dev/tty)
case ${?} in
${DIALOG_OK:-0})
echo ${mirror}
exit 0
;;
${DIALOG_CANCEL:-1})
exit 1
;;
*)
exit 255
;;
esac
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