From ffda25a3145b9597861f397554414f34b29fb710 Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 01:23:32 +0300 Subject: [PATCH 1/8] glibc: include UTF-8 charmap Include UTF-8 charmap and compress it. --- packages/devel/glibc/package.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index 5c214878df..25933a4f8d 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -136,8 +136,11 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/*.map rm -rf $INSTALL/var -# remove locales and charmaps +# remove locales and charmaps (except UTF-8 for installer) rm -rf $INSTALL/usr/share/i18n/charmaps + mkdir -p $INSTALL/usr/share/i18n/charmaps + cp -PR $ROOT/$PKG_BUILD/localedata/charmaps/UTF-8 $INSTALL/usr/share/i18n/charmaps + gzip $INSTALL/usr/share/i18n/charmaps/UTF-8 if [ ! "$GLIBC_LOCALES" = yes ]; then rm -rf $INSTALL/usr/share/i18n/locales From 4abfbdd9404b6e2015a87a41b9dc9b15b6659eeb Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 01:27:24 +0300 Subject: [PATCH 2/8] newt: add dialog replacement newt/whiptail replaces dialog that is used for the installer --- packages/devel/popt/package.mk | 44 +++++++++++++++++++++++++++++ packages/devel/slang/package.mk | 48 +++++++++++++++++++++++++++++++ packages/tools/newt/package.mk | 50 +++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 packages/devel/popt/package.mk create mode 100644 packages/devel/slang/package.mk create mode 100644 packages/tools/newt/package.mk diff --git a/packages/devel/popt/package.mk b/packages/devel/popt/package.mk new file mode 100644 index 0000000000..f0fee9c12b --- /dev/null +++ b/packages/devel/popt/package.mk @@ -0,0 +1,44 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +PKG_NAME="popt" +PKG_VERSION="1.16" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://rpm5.org/files/popt/" +PKG_URL="http://rpm5.org/files/popt/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="popt: library for parsing command line options." +PKG_LONGDESC="The popt library exists essentially for parsing command-line options. It is found superior in many ways when compared to parsing the argv array by hand or using the getopt functions getopt() and getopt_long()." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + + +pre_configure_target() { + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +pre_configure_host() { + cd $ROOT/$PKG_BUILD + rm -rf .$HOST_NAME +} diff --git a/packages/devel/slang/package.mk b/packages/devel/slang/package.mk new file mode 100644 index 0000000000..828d9bcedb --- /dev/null +++ b/packages/devel/slang/package.mk @@ -0,0 +1,48 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +PKG_NAME="slang" +PKG_VERSION="2.1.4" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://s-lang.org/" +PKG_URL="ftp://space.mit.edu/pub/davis/slang/v2.1/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="devel" +PKG_SHORTDESC="slang: multi-platform programmer's library designed to allow a developer to create robust multi-platform software." +PKG_LONGDESC="S-Lang is a multi-platform programmer's library designed to allow a developer to create robust multi-platform software. It provides facilities required by interactive applications such as display/screen management, keyboard input, keymaps, and so on. The most exciting feature of the library is the slang interpreter that may be easily embedded into a program to make it extensible. While the emphasis has always been on the embedded nature of the interpreter, it may also be used in a stand-alone fashion through the use of slsh, which is part of the S-Lang distribution." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +MAKEFLAGS=-j1 + + +pre_configure_target() { + # slang fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +pre_configure_host() { + # slang fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$HOST_NAME +} diff --git a/packages/tools/newt/package.mk b/packages/tools/newt/package.mk new file mode 100644 index 0000000000..65e22bcf05 --- /dev/null +++ b/packages/tools/newt/package.mk @@ -0,0 +1,50 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +PKG_NAME="newt" +PKG_VERSION="0.52.19" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://fedorahosted.org/newt/" +PKG_URL="https://fedorahosted.org/releases/n/e/newt/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain slang popt" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="newt: A programming library for color text mode, widget based user interfaces" +PKG_LONGDESC="Newt is a programming library for color text mode, widget based user interfaces. Newt can be used to add stacked windows, entry widgets, checkboxes, radio buttons, labels, plain text fields, scrollbars, etc., to text mode user interfaces. Newt is based on the S-Lang library." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ + --without-python \ + --without-tcl" + +pre_configure_target() { + # newt fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +pre_configure_host() { + # newt fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$HOST_NAME +} + From ba4e620da80a0029b8c727214537433dc4257a63 Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 01:33:39 +0300 Subject: [PATCH 3/8] installer: replace dialog with whiptail This modifies the installer to use whiptail instead of dialog. Line drawing does not work without a proper locale. Create en_US.UTF-8 locale as part of the installer. --- packages/devel/glibc/package.mk | 2 +- packages/tools/dialog/package.mk | 44 -- .../tools/installer/config/installer.conf | 6 +- packages/tools/installer/package.mk | 2 +- packages/tools/installer/scripts/installer | 446 +++++++++--------- 5 files changed, 235 insertions(+), 265 deletions(-) delete mode 100644 packages/tools/dialog/package.mk diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index 25933a4f8d..37546714d6 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -64,7 +64,7 @@ fi NSS_CONF_DIR="$PKG_BUILD/nss" GLIBC_EXCLUDE_BIN="catchsegv gencat getconf iconv iconvconfig ldconfig" -GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN localedef makedb mtrace pcprofiledump" +GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN makedb mtrace pcprofiledump" GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN pldd rpcgen sln sotruss sprof xtrace" pre_build_target() { diff --git a/packages/tools/dialog/package.mk b/packages/tools/dialog/package.mk deleted file mode 100644 index f819446feb..0000000000 --- a/packages/tools/dialog/package.mk +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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 OpenELEC. If not, see . -################################################################################ - -PKG_NAME="dialog" -PKG_VERSION="1.2-20150920" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://invisible-island.net/dialog/" -PKG_URL="ftp://invisible-island.net/dialog/$PKG_NAME-$PKG_VERSION.tgz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="tools" -PKG_SHORTDESC="dialog: A utility for creating TTY dialog boxes" -PKG_LONGDESC="Dialog is a utility that allows you to show dialog boxes (containing questions or messages) in TTY (text mode) interfaces from shell scripts. Dialog is initally written by Savio Lam and various branches do exist (e.g. lxdialog which is used for a linux kernel make menuconfig). This is the branch maintained by Thomas Dickey." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ - --without-dbmalloc \ - --without-dmalloc \ - --with-ncurses \ - --disable-widec \ - --disable-rc-file \ - --disable-Xdialog \ - --disable-form \ - --disable-mixedform \ - --disable-tailbox" - diff --git a/packages/tools/installer/config/installer.conf b/packages/tools/installer/config/installer.conf index 4ceb68528e..41cd508602 100644 --- a/packages/tools/installer/config/installer.conf +++ b/packages/tools/installer/config/installer.conf @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with OpenELEC. If not, see . ################################################################################ -# Disklabel for System an Storage partition +# Disklabel for System and Storage partition DISKLABEL_SYSTEM="System" DISKLABEL_STORAGE="Storage" @@ -36,3 +36,7 @@ # location for BIOS backup (with filename) BIOS_BACKUP="" + +# color scheme to use for Whiptail/Newt +# see http://askubuntu.com/questions/776831/whiptail-change-background-color-dynamically-from-magenta + WHIPTAIL_COLORS="root=,magenta;entry=,magenta;label=magenta,;actlistbox=,magenta;roottext=,magenta" diff --git a/packages/tools/installer/package.mk b/packages/tools/installer/package.mk index bdb202f699..a41495818f 100644 --- a/packages/tools/installer/package.mk +++ b/packages/tools/installer/package.mk @@ -23,7 +23,7 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv/" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain busybox dialog parted e2fsprogs syslinux" +PKG_DEPENDS_TARGET="toolchain busybox newt parted e2fsprogs syslinux" PKG_SECTION="tools" PKG_SHORTDESC="installer: LibreELEC.tv Install manager" PKG_LONGDESC="LibreELEC.tv Install manager to install the system on any disk" diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index 4bf88711d4..38dc2c9abc 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -40,14 +40,6 @@ # exclude mounted partitions # for i in `cat /proc/mounts | grep ^/dev/ | cut -f1 -d " " | sed "s/[0-9]//"`; do TEST="$TEST `echo "| grep -v $i"`"; done -# Interpret embedded "\Z" sequences in the dialog text by the following -# character, which tells dialog to set colors or video attributes: 0 through 7 -# are the ANSI used in curses: black, red, green, yellow, blue, magenta, cyan -# and white respectively. Bold is set by 'b', reset by 'B'. Reverse is set -# by 'r', reset by 'R'. Underline is set by 'u', reset by 'U'. The settings are -# cumulative, e.g., "\Zb\Z1" makes the following text bold (perhaps bright) -# red. Restore normal settings with "\Zn". - # disable Ctrl+C - can be very dangerous trap '' 2 @@ -57,9 +49,9 @@ dbglg() { # Acts just like echo cmd, with automatic redirection echo "" >> $LOGFILE - echo "###################################################################" >> $LOGFILE + echo "#################################################################" >> $LOGFILE echo "# $@" >> $LOGFILE - echo "###################################################################" >> $LOGFILE + echo "#################################################################" >> $LOGFILE echo "" >> $LOGFILE } @@ -145,15 +137,15 @@ create_partition_list() { do_install_mbr() { # show menu - MSG_TITLE="\Z4[ (RE)INSTALL MBR ]\Zn" - MSG_MENU="\n Please select where to install MBR.\n\n Please select a device:" + MSG_TITLE="(RE)INSTALL MBR" + MSG_MENU="Please select where to install MBR.\n\n Please select a device:" MSG_CANCEL="Back" create_device_list - dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ - --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ - $DEVICE_LIST 2> $TMPDIR/device_for_install + whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ + --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ + $DEVICE_LIST 2> $TMPDIR/device_for_install # now we must do everything case $? in @@ -181,16 +173,16 @@ do_install_mbr() { do_install_quick() { # show menu - MSG_TITLE="\Z4[ QUICK INSTALL MENU ]\Zn" + MSG_TITLE="QUICK INSTALL MENU" MSG_MENU="\nUse the up/down arrows to select the correct device.\n\n Please select a device:" MSG_CANCEL="Back" DIALOG_OPTIONS="--defaultno" create_device_list - dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ - $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ - $DEVICE_LIST 2> $TMPDIR/device_for_install + whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ + $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ + $DEVICE_LIST 2> $TMPDIR/device_for_install # now we must do everything case $? in @@ -213,168 +205,172 @@ do_install_quick() { prompt_backup_unpack # check for confirmation (twice!) - MSG_TITLE="\Z1[ Confirmation before installing ]\Zn" + MSG_TITLE="Confirmation before installing" MSG_DETAIL="\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" DIALOG_OPTIONS="--defaultno" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ - $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 if [ $? -ne 0 ]; then menu_main fi - MSG_TITLE="\Z1[ Confirmation before installing ]\Zn" + MSG_TITLE="Confirmation before installing" MSG_DETAIL="\nThis is last chance to abort the installation!\n\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n\n" DIALOG_OPTIONS="--defaultno" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 if [ $? -ne 0 ]; then menu_main fi - # remove all partitions - msg_progress_install "1" "get all partitions $INSTALL_DEVICE" - get_partition $INSTALL_DEVICE + # start the progress bar (whiptail --gauge) + { + # remove all partitions + msg_progress_install "1" "Get all partitions $INSTALL_DEVICE" + get_partition $INSTALL_DEVICE - msg_progress_install "5" "wiping disk $INSTALL_DEVICE" - dd if=/dev/zero of=$INSTALL_DEVICE bs=4096 count=1024 + msg_progress_install "5" "Wiping disk $INSTALL_DEVICE" + dd if=/dev/zero of=$INSTALL_DEVICE bs=4096 count=1024 2>>$LOGFILE - # create 2 new partitions (first $PARTSIZE_SYSTEM, second rest) - msg_progress_install "7" "creating label on $INSTALL_DEVICE" - if [ "$GPT" = "1" ]; then - parted -s $INSTALL_DEVICE mklabel gpt >> $LOGFILE 2>&1 - else - parted -s $INSTALL_DEVICE mklabel msdos >> $LOGFILE 2>&1 - fi + # create 2 new partitions (first $PARTSIZE_SYSTEM, second rest) + msg_progress_install "7" "Creating label on $INSTALL_DEVICE" + if [ "$GPT" = "1" ]; then + parted -s $INSTALL_DEVICE mklabel gpt >> $LOGFILE 2>&1 + else + parted -s $INSTALL_DEVICE mklabel msdos >> $LOGFILE 2>&1 + fi - msg_progress_install "9" "writing Master Boot Record on $INSTALL_DEVICE" - if [ "$GPT" = "1" ]; then - cat /usr/share/syslinux/gptmbr.bin > $INSTALL_DEVICE - else - cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE - fi + msg_progress_install "9" "Writing Master Boot Record on $INSTALL_DEVICE" + if [ "$GPT" = "1" ]; then + cat /usr/share/syslinux/gptmbr.bin > $INSTALL_DEVICE + else + cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE + fi - partsize_system_start=$PARTSIZE_SYSTEM_OFFSET - partsize_system_end=$(((PARTSIZE_SYSTEM * 1024 * 1024 / 512) + partsize_system_start)) - partsize_storage_start=$((partsize_system_end + 2048)) - partsize_storage_end=-1024 + partsize_system_start=$PARTSIZE_SYSTEM_OFFSET + partsize_system_end=$(((PARTSIZE_SYSTEM * 1024 * 1024 / 512) + partsize_system_start)) + partsize_storage_start=$((partsize_system_end + 2048)) + partsize_storage_end=-1024 - msg_progress_install "10" "creating partition on $INSTALL_DEVICE" - if [ "$UEFI" = "1" ]; then - parted -s $INSTALL_DEVICE unit s mkpart primary fat32 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 - else - parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 - fi + msg_progress_install "10" "Creating partition on $INSTALL_DEVICE" + if [ "$UEFI" = "1" ]; then + parted -s $INSTALL_DEVICE unit s mkpart primary fat32 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 + else + parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 + fi - msg_progress_install "13" "creating partition on $INSTALL_DEVICE" - parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_storage_start $partsize_storage_end >> $LOGFILE 2>&1 + msg_progress_install "13" "Creating partition on $INSTALL_DEVICE" + parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_storage_start $partsize_storage_end >> $LOGFILE 2>&1 - msg_progress_install "16" "setup bootflag on partition 1 of $INSTALL_DEVICE" - parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1 - if [ "$GPT" = "1" ]; then - parted -s $INSTALL_DEVICE set 1 legacy_boot on >> $LOGFILE 2>&1 - fi + msg_progress_install "16" "Setup bootflag on partition 1 of $INSTALL_DEVICE" + parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1 + if [ "$GPT" = "1" ]; then + parted -s $INSTALL_DEVICE set 1 legacy_boot on >> $LOGFILE 2>&1 + fi - msg_progress_install "20" "tell the kernel we have a new partitiontable on $INSTALL_DEVICE" - partprobe $INSTALL_DEVICE >> $LOGFILE 2>&1 + msg_progress_install "20" "Tell the kernel we have a new partitiontable on $INSTALL_DEVICE" + partprobe $INSTALL_DEVICE >> $LOGFILE 2>&1 - # create filesystem - msg_progress_install "23" "creating filesystem on ${INSTALL_DEVICE}1" - if [ "$UEFI" = "1" ]; then - mkfs.vfat ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - else - mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - fi + # create filesystem + msg_progress_install "23" "Creating filesystem on ${INSTALL_DEVICE}1" + if [ "$UEFI" = "1" ]; then + mkfs.vfat ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + else + mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + fi - msg_progress_install "25" "set uuid and disklabel $DISKLABEL_SYSTEM on ${INSTALL_DEVICE}${PART1}" - if [ "$UEFI" = "1" ]; then - dosfslabel ${INSTALL_DEVICE}${PART1} $DISKLABEL_SYSTEM >> $LOGFILE 2>&1 - else - tune2fs -U random -L $DISKLABEL_SYSTEM ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - fi + msg_progress_install "25" "Set uuid and disklabel $DISKLABEL_SYSTEM on ${INSTALL_DEVICE}${PART1}" + if [ "$UEFI" = "1" ]; then + dosfslabel ${INSTALL_DEVICE}${PART1} $DISKLABEL_SYSTEM >> $LOGFILE 2>&1 + else + tune2fs -U random -L $DISKLABEL_SYSTEM ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + fi - msg_progress_install "28" "creating filesystem on ${INSTALL_DEVICE}${PART2}" - mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 + msg_progress_install "28" "Creating filesystem on ${INSTALL_DEVICE}${PART2}" + mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 - msg_progress_install "30" "set uuid and disklabel $DISKLABEL_STORAGE on ${INSTALL_DEVICE}${PART2}" - tune2fs -U random -L $DISKLABEL_STORAGE ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 + msg_progress_install "30" "Set uuid and disklabel $DISKLABEL_STORAGE on ${INSTALL_DEVICE}${PART2}" + tune2fs -U random -L $DISKLABEL_STORAGE ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 - # mount system partition - msg_progress_install "35" "creating $TMPDIR/part1" - mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 + # mount system partition + msg_progress_install "35" "Creating $TMPDIR/part1" + mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_progress_install "40" "mounting ${INSTALL_DEVICE}${PART1} to $TMPDIR/part1" - if [ "$UEFI" = "1" ]; then - mount -t vfat ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 - else - mount -t ext4 ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 - fi + msg_progress_install "40" "Mounting ${INSTALL_DEVICE}${PART1} to $TMPDIR/part1" + if [ "$UEFI" = "1" ]; then + mount -t vfat ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 + else + mount -t ext4 ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 + fi - # installing extlinux - msg_progress_install "50" "installing extlinux to $TMPDIR/part1" - if [ "$UEFI" = "1" ]; then - syslinux -i ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - else - extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1 - fi + # installing extlinux + if [ "$UEFI" = "1" ]; then + msg_progress_install "50" "Installing syslinux to $TMPDIR/part1" + syslinux -i ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + else + msg_progress_install "50" "Installing extlinux to $TMPDIR/part1" + extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1 + fi - # install system files - msg_progress_install "60" "installing Kernel" - cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 + # install system files + msg_progress_install "60" "Installing Kernel" + cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_progress_install "65" "installing System" - cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 - sync + msg_progress_install "65" "Installing System" + cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 + sync - # configuring bootloader - msg_progress_install "80" "setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE" - echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf - echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf - echo " " >> $TMPDIR/part1/extlinux.conf - echo "LABEL linux" >> $TMPDIR/part1/extlinux.conf - echo " KERNEL /KERNEL" >> $TMPDIR/part1/extlinux.conf - echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE $EXTLINUX_PARAMETERS quiet" >> $TMPDIR/part1/extlinux.conf - # uefi boot / hybrid mode - if [ "$UEFI" = "1" ]; then - mv $TMPDIR/part1/extlinux.conf $TMPDIR/part1/syslinux.cfg - mkdir -p $TMPDIR/part1/EFI/BOOT - cp $TMPDIR/part1/syslinux.cfg $TMPDIR/part1/EFI/BOOT - cp /usr/share/syslinux/bootx64.efi $TMPDIR/part1/EFI/BOOT - cp /usr/share/syslinux/ldlinux.e64 $TMPDIR/part1/EFI/BOOT - fi - sync - - # umount system partition, remove mountpoint - msg_progress_install "85" "unmount $TMPDIR/part1" - umount $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "87" "remove $TMPDIR/part1" - rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 - - if [ "$BACKUP_UNPACK" = "1" ]; then - # mount storage partition - msg_progress_install "89" "creating $TMPDIR/part2" - mkdir -p $TMPDIR/part2 >> $LOGFILE 2>&1 - - msg_progress_install "90" "mounting ${INSTALL_DEVICE}${PART2} to $TMPDIR/part2" - mount -t ext4 ${INSTALL_DEVICE}${PART2} $TMPDIR/part2 >> $LOGFILE 2>&1 - - msg_progress_install "92" "restoring backup" - [ -f /flash/backup.tar.bz2 ] && tar -xjf /flash/backup.tar.bz2 -C $TMPDIR/part2 >> $LOGFILE 2>&1 - [ -f /flash/backup.zip ] && unzip -qq /flash/backup.zip -d $TMPDIR/part2 >> $LOGFILE 2>&1 + # configuring bootloader + msg_progress_install "80" "Setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE" + echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf + echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf + echo " " >> $TMPDIR/part1/extlinux.conf + echo "LABEL linux" >> $TMPDIR/part1/extlinux.conf + echo " KERNEL /KERNEL" >> $TMPDIR/part1/extlinux.conf + echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE $EXTLINUX_PARAMETERS quiet" >> $TMPDIR/part1/extlinux.conf + # uefi boot / hybrid mode + if [ "$UEFI" = "1" ]; then + mv $TMPDIR/part1/extlinux.conf $TMPDIR/part1/syslinux.cfg + mkdir -p $TMPDIR/part1/EFI/BOOT + cp $TMPDIR/part1/syslinux.cfg $TMPDIR/part1/EFI/BOOT + cp /usr/share/syslinux/bootx64.efi $TMPDIR/part1/EFI/BOOT + cp /usr/share/syslinux/ldlinux.e64 $TMPDIR/part1/EFI/BOOT + fi sync # umount system partition, remove mountpoint - msg_progress_install "97" "unmount $TMPDIR/part2" - umount $TMPDIR/part2 >> $LOGFILE 2>&1 + msg_progress_install "85" "Unmount $TMPDIR/part1" + umount $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_progress_install "100" "remove $TMPDIR/part2" - rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 - fi + msg_progress_install "87" "Remove $TMPDIR/part1" + rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 + + if [ "$BACKUP_UNPACK" = "1" ]; then + # mount storage partition + msg_progress_install "89" "Creating $TMPDIR/part2" + mkdir -p $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "90" "Mounting ${INSTALL_DEVICE}${PART2} to $TMPDIR/part2" + mount -t ext4 ${INSTALL_DEVICE}${PART2} $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "92" "Restoring backup" + [ -f /flash/backup.tar.bz2 ] && tar -xjf /flash/backup.tar.bz2 -C $TMPDIR/part2 >> $LOGFILE 2>&1 + [ -f /flash/backup.zip ] && unzip -qq /flash/backup.zip -d $TMPDIR/part2 >> $LOGFILE 2>&1 + sync + + # umount system partition, remove mountpoint + msg_progress_install "97" " bbUnmount $TMPDIR/part2" + umount $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "100" "Remove $TMPDIR/part2" + rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 + fi + } | whiptail --gauge "Please wait while your system is being setup ..." 6 70 0 # install complete - MSG_TITLE="\Z1[ @DISTRONAME@ Install Complete ]\Zn" - MSG_DETAIL="\nYou may now remove the install media and reboot\n" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 + MSG_TITLE="@DISTRONAME@ Install Complete" + MSG_DETAIL="You may now remove the install media and reboot\n" + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 7 52 menu_main ;; @@ -389,7 +385,7 @@ do_install_quick() { do_install_custom() { # show menu - MSG_TITLE="\Z4[ REPAIR/UPGRADE MENU ]\Zn" + MSG_TITLE="REPAIR/UPGRADE MENU" MSG_MENU="\nUse the up/down arrows to select the correct partition where you want to overwrite KERNEL and SYSTEM files.\n\n Please select a partition:" MSG_CANCEL="Back" DIALOG_OPTIONS="--defaultno" @@ -418,7 +414,7 @@ do_install_custom() { msg_no_device fi - dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ + whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ $PARTITION_LIST 2> $TMPDIR/device_for_install @@ -429,75 +425,77 @@ do_install_custom() { INSTALL_PARTITION_FULL=$(echo $PARTITION_LIST | sed "s|.*$INSTALL_PARTITION \([^ ]*\).*|$INSTALL_PARTITION \1|") # check for confirmation (twice!) - MSG_TITLE="\Z1[ Confirmation before copying ]\Zn" + MSG_TITLE="Confirmation before copying" MSG_DETAIL="\nIf you continue the target partition will be\noverwritten with new KERNEL and SYSTEM files:\n\n$INSTALL_PARTITION_FULL\n\n" DIALOG_OPTIONS="--defaultno" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 if [ $? -ne 0 ]; then menu_main fi - MSG_TITLE="\Z1[ Confirmation before copying ]\Zn" + MSG_TITLE="Confirmation before copying" MSG_DETAIL="\nThis is last chance to abort the copying!\n\nIf you continue the target partition will be\noverwritten with new KERNEL and SYSTEM files:\n\n$INSTALL_PARTITION_FULL\n\n\n" DIALOG_OPTIONS="--defaultno" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 if [ $? -ne 0 ]; then menu_main fi - # mount system partition - msg_progress_install "5" "creating $TMPDIR/part1" - mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 + { + # mount system partition + msg_progress_install "5" "creating $TMPDIR/part1" + mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_progress_install "10" "mounting $INSTALL_PARTITION to $TMPDIR/part1" - mount -t ext4 $INSTALL_PARTITION $TMPDIR/part1 >> $LOGFILE 2>&1 + msg_progress_install "10" "mounting $INSTALL_PARTITION to $TMPDIR/part1" + mount -t ext4 $INSTALL_PARTITION $TMPDIR/part1 >> $LOGFILE 2>&1 - # check for enough target space - msg_progress_install "15" "checking for space on $INSTALL_PARTITION" + # check for enough target space + msg_progress_install "15" "checking for space on $INSTALL_PARTITION" - KERNEL_SIZE=$(stat -t /flash/KERNEL | awk '{print $2}') - SYSTEM_SIZE=$(stat -t /flash/SYSTEM | awk '{print $2}') - SRC_SIZE=$(( $KERNEL_SIZE + $SYSTEM_SIZE )) + KERNEL_SIZE=$(stat -t /flash/KERNEL | awk '{print $2}') + SYSTEM_SIZE=$(stat -t /flash/SYSTEM | awk '{print $2}') + SRC_SIZE=$(( $KERNEL_SIZE + $SYSTEM_SIZE )) - DEST_SIZE=$(df $TMPDIR/part1 | awk '/[0-9]%/{print $4}') - DEST_SIZE=$(( $DEST_SIZE * 1024 )) - if [ -f $TMPDIR/part1/KERNEL ]; then - KERNEL_SIZE=$(stat -t $TMPDIR/part1/KERNEL | awk '{print $2}') - DEST_SIZE=$(( $DEST_SIZE + $KERNEL_SIZE )) - fi - if [ -f $TMPDIR/part1/SYSTEM ]; then - SYSTEM_SIZE=$(stat -t $TMPDIR/part1/SYSTEM | awk '{print $2}') - DEST_SIZE=$(( $DEST_SIZE + $SYSTEM_SIZE )) - fi + DEST_SIZE=$(df $TMPDIR/part1 | awk '/[0-9]%/{print $4}') + DEST_SIZE=$(( $DEST_SIZE * 1024 )) + if [ -f $TMPDIR/part1/KERNEL ]; then + KERNEL_SIZE=$(stat -t $TMPDIR/part1/KERNEL | awk '{print $2}') + DEST_SIZE=$(( $DEST_SIZE + $KERNEL_SIZE )) + fi + if [ -f $TMPDIR/part1/SYSTEM ]; then + SYSTEM_SIZE=$(stat -t $TMPDIR/part1/SYSTEM | awk '{print $2}') + DEST_SIZE=$(( $DEST_SIZE + $SYSTEM_SIZE )) + fi - if [ $SRC_SIZE -ge $DEST_SIZE ]; then + if [ $SRC_SIZE -ge $DEST_SIZE ]; then + umount $TMPDIR/part1 >> $LOGFILE 2>&1 + rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 + msg_target_space + menu_main + fi + + # install system files + msg_progress_install "20" "installing Kernel" + cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 + + msg_progress_install "40" "installing System" + cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 + sync + + # umount system partition, remove mountpoint + msg_progress_install "95" "unmount $TMPDIR/part1" umount $TMPDIR/part1 >> $LOGFILE 2>&1 + + msg_progress_install "100" "remove $TMPDIR/part1" rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_target_space - menu_main - fi - - # install system files - msg_progress_install "20" "installing Kernel" - cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "40" "installing System" - cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 - sync - - # umount system partition, remove mountpoint - msg_progress_install "95" "unmount $TMPDIR/part1" - umount $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "100" "remove $TMPDIR/part1" - rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 + } | whiptail --gauge "Please wait while your system is being setup ..." 6 70 0 # install complete - MSG_TITLE="\Z1[ @DISTRONAME@ Install Complete ]\Zn" + MSG_TITLE="@DISTRONAME@ Install Complete" MSG_DETAIL="\nYou may now remove the install media and reboot\n" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 menu_main ;; @@ -512,39 +510,42 @@ do_install_custom() { msg_no_device() { # show a warning dialog if we dont find not mounted devices for install and return to main menu - MSG_TITLE="\Z1[ WARNING ]\Zn" + MSG_TITLE="WARNING" MSG_INFOBOX=" No devices were found. " - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 70 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 70 menu_main } msg_target_space() { # show an error dialog for missing space - MSG_TITLE="\Z1[ TARGET SPACE ]\Zn" - MSG_INFOBOX="\nNot enough target space!\nCopying aborted.\n" + MSG_TITLE="TARGET SPACE" + MSG_INFOBOX="Not enough target space!\nCopying aborted.\n" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 8 70 - - menu_main -} - -msg_install_ready() { - # show a dialog that we have installed - MSG_TITLE="\Z1[ INFORMATION ]\Zn" - - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 70 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 8 70 menu_main } msg_progress_install() { - # show the progress dialog - MSG_TITLE="\Z1[ INSTALLING ]\Zn" + # update the whiptail gauge window dbglg "$2" - dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --gauge "$2 ..." 6 70 $1 & + sleep .3 + echo XXX + echo $1 + echo "$2 ..." + echo XXX +} + +msg_install_ready() { + # show a dialog that we have installed + MSG_TITLE="INFORMATION" + + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 70 + + menu_main } prompt_gpt() { @@ -569,10 +570,10 @@ prompt_backup_unpack() { # provides: BACKUP_UNPACK BACKUP_UNPACK="0" if [ -f /flash/backup.tar.bz2 -o -f /flash/backup.zip ]; then - MSG_TITLE="\Z1[ Restore backup files ]\Zn" + MSG_TITLE="Restore backup files" MSG_DETAIL="Restore backup files to storage partition.\nFile backup.tar.bz2 or/and backup.zip exist on\ninstallation USB stick." DIALOG_OPTIONS="--defaultno" - if dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0; then + if whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0; then BACKUP_UNPACK="1" fi fi @@ -580,16 +581,16 @@ prompt_backup_unpack() { menu_main() { # show the mainmenu - MSG_TITLE="\Z4[ MAIN MENU ]\Zn" - MSG_MENU="\n\ZbQuick Install:\Zn do a default installation on a specific device \ - \Z1\Zb(this will delete ALL data on this device!)\Zn \ - \n\ZbRepair / Upgrade:\Zn do repair / upgrade \ - \n\ZbShow logfile:\Zn show and save the logfile \ + MSG_TITLE="MAIN MENU" + MSG_MENU="\nQuick Install: do a default installation on a specific device \ + (this will delete ALL data on this device!) \ + \nRepair / Upgrade: do repair / upgrade \ + \nShow logfile: show and save the logfile \ \n \ \nPlease select:" MSG_CANCEL="Reboot" - dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ + whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ --title "$MSG_TITLE" --menu "$MSG_MENU" 20 70 5 \ 1 "Quick Install of @DISTRONAME@" \ 2 "Repair / Upgrade" \ @@ -614,7 +615,7 @@ menu_main() { } logfile_show() { - dialog --textbox "$LOGFILE" 20 70 + whiptail --textbox "$LOGFILE" 20 70 --scrolltext clear menu_main } @@ -634,13 +635,16 @@ do_poweroff() { } # setup needed variables -INSTALLER_VERSION="0.2.8" +INSTALLER_VERSION="0.3.0" OS_VERSION=$(lsb_release) BACKTITLE="@DISTRONAME@ Installer $INSTALLER_VERSION - $OS_VERSION" TMPDIR="/tmp/installer" LOGFILE="$TMPDIR/install.log" +export COLORTERM="1" +export NEWT_COLORS="$WHIPTAIL_COLORS" + # prepare temporary directory rm -rf $TMPDIR mkdir -p $TMPDIR @@ -648,6 +652,12 @@ mkdir -p $TMPDIR #create log file touch "$LOGFILE" +# generate the en_US.UTF-8 locale to enable line drawing +mkdir -p $TMPDIR/locale +localedef -i en_US -f UTF-8 $TMPDIR/locale/en_US.UTF-8 +export LOCPATH=$TMPDIR/locale +export LC_ALL=en_US.UTF-8 + # main while true; do From d3698b0379a784182573b8304393ea0c5532bbba Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 19:22:58 +0300 Subject: [PATCH 4/8] installer: small fixes Fix a typo, get rid of installer version variable and change the URL to point to the correct LibreELEC URL. --- packages/tools/installer/package.mk | 2 +- packages/tools/installer/scripts/installer | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/tools/installer/package.mk b/packages/tools/installer/package.mk index a41495818f..a7f52f449b 100644 --- a/packages/tools/installer/package.mk +++ b/packages/tools/installer/package.mk @@ -21,7 +21,7 @@ PKG_VERSION="1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv/" +PKG_SITE="http://libreelec.tv/" PKG_URL="" PKG_DEPENDS_TARGET="toolchain busybox newt parted e2fsprogs syslinux" PKG_SECTION="tools" diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index 38dc2c9abc..3c24fd8eb6 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -359,7 +359,7 @@ do_install_quick() { sync # umount system partition, remove mountpoint - msg_progress_install "97" " bbUnmount $TMPDIR/part2" + msg_progress_install "97" "Unmount $TMPDIR/part2" umount $TMPDIR/part2 >> $LOGFILE 2>&1 msg_progress_install "100" "Remove $TMPDIR/part2" @@ -635,9 +635,8 @@ do_poweroff() { } # setup needed variables -INSTALLER_VERSION="0.3.0" OS_VERSION=$(lsb_release) -BACKTITLE="@DISTRONAME@ Installer $INSTALLER_VERSION - $OS_VERSION" +BACKTITLE="@DISTRONAME@ Installer - $OS_VERSION" TMPDIR="/tmp/installer" LOGFILE="$TMPDIR/install.log" From d523e6c26cab6820fa2a6d76ce74862c3311db97 Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 19:35:03 +0300 Subject: [PATCH 5/8] glibc: only add UTF-8 charmap for Generic project Installer needs a proper charmap. Only Generic project utilizes the installer. --- packages/devel/glibc/package.mk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index 37546714d6..30ff9757b6 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -136,11 +136,15 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/*.map rm -rf $INSTALL/var -# remove locales and charmaps (except UTF-8 for installer) +# remove locales and charmaps rm -rf $INSTALL/usr/share/i18n/charmaps - mkdir -p $INSTALL/usr/share/i18n/charmaps - cp -PR $ROOT/$PKG_BUILD/localedata/charmaps/UTF-8 $INSTALL/usr/share/i18n/charmaps - gzip $INSTALL/usr/share/i18n/charmaps/UTF-8 + +# add UTF-8 charmap for Generic (charmap is needed for installer) + if [ "$PROJECT" = "Generic" ]; then + mkdir -p $INSTALL/usr/share/i18n/charmaps + cp -PR $ROOT/$PKG_BUILD/localedata/charmaps/UTF-8 $INSTALL/usr/share/i18n/charmaps + gzip $INSTALL/usr/share/i18n/charmaps/UTF-8 + fi if [ ! "$GLIBC_LOCALES" = yes ]; then rm -rf $INSTALL/usr/share/i18n/locales From 85b9dc63d7d89a9ecf774396620aa9184c56d08c Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 22:48:56 +0300 Subject: [PATCH 6/8] installer: ditch repair/upgrade mode Remove the (at least on my system) broken repair/upgrade mode from the installer. At the same time improve the formatting/wording of some screens. Should be a bit simpler now. --- packages/tools/installer/scripts/installer | 233 +++------------------ 1 file changed, 25 insertions(+), 208 deletions(-) diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index 3c24fd8eb6..60257abb76 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -112,71 +112,11 @@ create_device_list() { done } -create_partition_list() { - # get an overview of all partitions of a specified device - # usage: create_partition_list /dev/sda - # uses: get_partition - # provides: PARTITION_NUMBER, PARTITION_SIZE, PARTITION_FORMAT, - # PARTITION_LIST, PARTITIONS (get_partition) - - PARTITION_NUMBER="" - PARTITION_SIZE="" - PARTITION_FORMAT="" - PARTITION_LIST="" - - get_partition $1 - - for partition in $PARTITIONS; do - PARTITION_NUMBER=$(parted -s -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":") - PARTITION_SIZE=$(parted -s -m $1 print |grep -v ^/dev |grep -v BYT | cut -f4 -d ":") - PARTITION_FORMAT=$(parted -s -m $1 print |grep -v ^/dev |grep -v BYT | cut -f5 -d ":") - PARTITION_LIST=" $PARTITION_LIST \n Partition $1$PARTITION_NUMBER Size: $PARTITION_SIZE Format: $PARTITION_FORMAT" - done -} - -do_install_mbr() { - # show menu - - MSG_TITLE="(RE)INSTALL MBR" - MSG_MENU="Please select where to install MBR.\n\n Please select a device:" - MSG_CANCEL="Back" - - create_device_list - - whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ - --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ - $DEVICE_LIST 2> $TMPDIR/device_for_install - - # now we must do everything - case $? in - 0) - INSTALL_DEVICE=$(cat "$TMPDIR/device_for_install") - - # installing mbr - prompt_gpt - if [ "$GPT" = "1" ]; then - cat /usr/share/syslinux/gptmbr.bin > $INSTALL_DEVICE - else - cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE - fi - - msg_install_ready "Master Boot Record installed on $INSTALL_DEVICE" - ;; - 1) - menu_main - ;; - 255) - do_poweroff - ;; - esac -} - do_install_quick() { # show menu MSG_TITLE="QUICK INSTALL MENU" - MSG_MENU="\nUse the up/down arrows to select the correct device.\n\n Please select a device:" + MSG_MENU="\nUse the up/down arrows to select the device you wish to install to.\n\nPlease select a device:" MSG_CANCEL="Back" - DIALOG_OPTIONS="--defaultno" create_device_list @@ -206,7 +146,7 @@ do_install_quick() { # check for confirmation (twice!) MSG_TITLE="Confirmation before installing" - MSG_DETAIL="\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" + MSG_DETAIL="\nIf you continue the contents of the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" DIALOG_OPTIONS="--defaultno" whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 @@ -365,11 +305,11 @@ do_install_quick() { msg_progress_install "100" "Remove $TMPDIR/part2" rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 fi - } | whiptail --gauge "Please wait while your system is being setup ..." 6 70 0 + } | whiptail --gauge "Please wait while your system is being setup ..." 6 73 0 # install complete MSG_TITLE="@DISTRONAME@ Install Complete" - MSG_DETAIL="You may now remove the install media and reboot\n" + MSG_DETAIL="You may now remove the install media and reboot.\n" whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 7 52 menu_main @@ -383,137 +323,12 @@ do_install_quick() { esac } -do_install_custom() { - # show menu - MSG_TITLE="REPAIR/UPGRADE MENU" - MSG_MENU="\nUse the up/down arrows to select the correct partition where you want to overwrite KERNEL and SYSTEM files.\n\n Please select a partition:" - MSG_CANCEL="Back" - DIALOG_OPTIONS="--defaultno" - - get_device_unmount - - if [ "$DEVICES" = "" ]; then - msg_no_device - fi - - PARTITION_LIST="" - for device in $DEVICES; do - get_partition $device - for partition in $PARTITIONS; do - LABEL=$(tune2fs -l $device$partition | awk 'BEGIN {FS=":"} /Filesystem volume name/ {gsub(/ /,"",$2); print $2}') - if [ "$LABEL" = "$DISKLABEL_SYSTEM" ]; then - DEVICE_MODEL=$(parted -s $device -m print | grep ^$device | cut -f7 -d ":" | sed "s/;//") - DEVICE_SIZE=$(parted -s $device -m print | grep ^$device | cut -f2 -d ":") - DEVICE_NAME=$(echo $DEVICE_MODEL ${DEVICE_SIZE} | sed 's/ /_/g') - PARTITION_LIST="$PARTITION_LIST $device$partition $DEVICE_NAME" - fi - done - done - - if [ "$PARTITION_LIST" = "" ]; then - msg_no_device - fi - - whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ - $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ - $PARTITION_LIST 2> $TMPDIR/device_for_install - - # now we must do everything - case $? in - 0) - INSTALL_PARTITION=$(cat "$TMPDIR/device_for_install") - INSTALL_PARTITION_FULL=$(echo $PARTITION_LIST | sed "s|.*$INSTALL_PARTITION \([^ ]*\).*|$INSTALL_PARTITION \1|") - - # check for confirmation (twice!) - MSG_TITLE="Confirmation before copying" - MSG_DETAIL="\nIf you continue the target partition will be\noverwritten with new KERNEL and SYSTEM files:\n\n$INSTALL_PARTITION_FULL\n\n" - DIALOG_OPTIONS="--defaultno" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ - $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 - if [ $? -ne 0 ]; then - menu_main - fi - - MSG_TITLE="Confirmation before copying" - MSG_DETAIL="\nThis is last chance to abort the copying!\n\nIf you continue the target partition will be\noverwritten with new KERNEL and SYSTEM files:\n\n$INSTALL_PARTITION_FULL\n\n\n" - DIALOG_OPTIONS="--defaultno" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ - $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 - if [ $? -ne 0 ]; then - menu_main - fi - - { - # mount system partition - msg_progress_install "5" "creating $TMPDIR/part1" - mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "10" "mounting $INSTALL_PARTITION to $TMPDIR/part1" - mount -t ext4 $INSTALL_PARTITION $TMPDIR/part1 >> $LOGFILE 2>&1 - - # check for enough target space - msg_progress_install "15" "checking for space on $INSTALL_PARTITION" - - KERNEL_SIZE=$(stat -t /flash/KERNEL | awk '{print $2}') - SYSTEM_SIZE=$(stat -t /flash/SYSTEM | awk '{print $2}') - SRC_SIZE=$(( $KERNEL_SIZE + $SYSTEM_SIZE )) - - DEST_SIZE=$(df $TMPDIR/part1 | awk '/[0-9]%/{print $4}') - DEST_SIZE=$(( $DEST_SIZE * 1024 )) - if [ -f $TMPDIR/part1/KERNEL ]; then - KERNEL_SIZE=$(stat -t $TMPDIR/part1/KERNEL | awk '{print $2}') - DEST_SIZE=$(( $DEST_SIZE + $KERNEL_SIZE )) - fi - if [ -f $TMPDIR/part1/SYSTEM ]; then - SYSTEM_SIZE=$(stat -t $TMPDIR/part1/SYSTEM | awk '{print $2}') - DEST_SIZE=$(( $DEST_SIZE + $SYSTEM_SIZE )) - fi - - if [ $SRC_SIZE -ge $DEST_SIZE ]; then - umount $TMPDIR/part1 >> $LOGFILE 2>&1 - rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 - msg_target_space - menu_main - fi - - # install system files - msg_progress_install "20" "installing Kernel" - cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "40" "installing System" - cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 - sync - - # umount system partition, remove mountpoint - msg_progress_install "95" "unmount $TMPDIR/part1" - umount $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "100" "remove $TMPDIR/part1" - rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 - } | whiptail --gauge "Please wait while your system is being setup ..." 6 70 0 - - # install complete - MSG_TITLE="@DISTRONAME@ Install Complete" - MSG_DETAIL="\nYou may now remove the install media and reboot\n" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 6 52 - - menu_main - ;; - 1) - menu_main - ;; - 255) - do_poweroff - ;; - esac -} - msg_no_device() { # show a warning dialog if we dont find not mounted devices for install and return to main menu MSG_TITLE="WARNING" MSG_INFOBOX=" No devices were found. " - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 70 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 73 menu_main } @@ -521,9 +336,9 @@ msg_no_device() { msg_target_space() { # show an error dialog for missing space MSG_TITLE="TARGET SPACE" - MSG_INFOBOX="Not enough target space!\nCopying aborted.\n" + MSG_INFOBOX="Not enough target space!\nInstallation aborted.\n" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 8 70 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 73 menu_main } @@ -543,7 +358,7 @@ msg_install_ready() { # show a dialog that we have installed MSG_TITLE="INFORMATION" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 70 + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 73 menu_main } @@ -582,27 +397,28 @@ prompt_backup_unpack() { menu_main() { # show the mainmenu MSG_TITLE="MAIN MENU" - MSG_MENU="\nQuick Install: do a default installation on a specific device \ - (this will delete ALL data on this device!) \ - \nRepair / Upgrade: do repair / upgrade \ - \nShow logfile: show and save the logfile \ - \n \ - \nPlease select:" - MSG_CANCEL="Reboot" + MSG_MENU="\nWelcome to @DISTRONAME@ installation tool! \ +\n +This tool is used to copy @DISTRONAME@ from the installation media \ +to your disk or other device. You'll be up and running in no time! \ +Please note that the contents of the disk you choose will be wiped \ +out during the installation. \ +\n\nPlease select:" + MSG_CANCEL="Close" whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ - --title "$MSG_TITLE" --menu "$MSG_MENU" 20 70 5 \ - 1 "Quick Install of @DISTRONAME@" \ - 2 "Repair / Upgrade" \ - 3 "Show logfile" 2> $TMPDIR/mainmenu + --title "$MSG_TITLE" --menu "$MSG_MENU" 18 73 3 \ + 1 "Install @DISTRONAME@" \ + 2 "Show the log file" \ + 3 "Reboot" 2> $TMPDIR/mainmenu case $? in 0) ITEM_MAINMENU=$(cat "$TMPDIR/mainmenu") case $ITEM_MAINMENU in 1) do_install_quick; break;; - 2) do_install_custom; break;; - 3) logfile_show; break;; + 2) logfile_show; break;; + 3) do_reboot; esac ;; 1) @@ -615,7 +431,7 @@ menu_main() { } logfile_show() { - whiptail --textbox "$LOGFILE" 20 70 --scrolltext + whiptail --textbox "$LOGFILE" 20 73 --scrolltext clear menu_main } @@ -649,7 +465,8 @@ rm -rf $TMPDIR mkdir -p $TMPDIR #create log file -touch "$LOGFILE" +echo "@DISTRONAME@ Installer - $OS_VERSION started at:" > $LOGFILE +date >> $LOGFILE # generate the en_US.UTF-8 locale to enable line drawing mkdir -p $TMPDIR/locale From 6e6cf890be20f921ba83faa52c22b7d93b53924a Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 22:51:17 +0300 Subject: [PATCH 7/8] installer: cosmetics --- packages/tools/installer/config/installer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tools/installer/config/installer.conf b/packages/tools/installer/config/installer.conf index 41cd508602..c503445dcb 100644 --- a/packages/tools/installer/config/installer.conf +++ b/packages/tools/installer/config/installer.conf @@ -39,4 +39,4 @@ # color scheme to use for Whiptail/Newt # see http://askubuntu.com/questions/776831/whiptail-change-background-color-dynamically-from-magenta - WHIPTAIL_COLORS="root=,magenta;entry=,magenta;label=magenta,;actlistbox=,magenta;roottext=,magenta" + WHIPTAIL_COLORS="root=,magenta;entry=,magenta;label=magenta,;actlistbox=,magenta;roottext=white,magenta" From cbb43e568aac631f2e6f9b101f9e6b37385e546d Mon Sep 17 00:00:00 2001 From: Olli Salonen Date: Wed, 19 Oct 2016 22:51:43 +0300 Subject: [PATCH 8/8] mkimage: rebranding and prompt change Change the prompt to instruct the end user to wait for the installer instead of just "Press TAB for boot options". Hopefully more intuitive now. Rebrand to LE in the code also. :) --- scripts/mkimage | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/mkimage b/scripts/mkimage index 726078b396..06f1485792 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -24,8 +24,8 @@ ################################################################################ # set variables - OE_TMP=$(mktemp -d) - SAVE_ERROR="$OE_TMP/save_error" + LE_TMP=$(mktemp -d) + SAVE_ERROR="$LE_TMP/save_error" if [ -z "$SYSTEM_SIZE" -o -z "$SYSTEM_PART_START" ]; then echo "mkimage: SYSTEM_SIZE and SYSTEM_PART_START must be configured!" @@ -40,7 +40,7 @@ # functions cleanup() { echo "image: cleanup..." - rm -rf "$OE_TMP" + rm -rf "$LE_TMP" echo exit } @@ -125,8 +125,8 @@ fi if [ "$BOOTLOADER" = "syslinux" ]; then # create bootloader configuration echo "image: creating bootloader configuration..." - cat << EOF > "$OE_TMP"/syslinux.cfg -SAY Press to edit options (installer, live, run) + cat << EOF > "$LE_TMP"/syslinux.cfg +SAY Wait for installer to start or press for more options (live, run) DEFAULT installer TIMEOUT 50 PROMPT 1 @@ -145,7 +145,7 @@ LABEL run EOF if [ "$PROJECT" = Virtual ]; then - cat << EOF > "$OE_TMP"/syslinux.cfg + cat << EOF > "$LE_TMP"/syslinux.cfg DEFAULT virtual TIMEOUT 50 PROMPT 0 @@ -156,7 +156,7 @@ LABEL virtual EOF fi - mcopy "$OE_TMP/syslinux.cfg" :: + mcopy "$LE_TMP/syslinux.cfg" :: # install extlinux echo "image: installing extlinux to part1..." @@ -172,15 +172,15 @@ EOF mmd EFI EFI/BOOT mcopy $ROOT/$TOOLCHAIN/share/syslinux/bootx64.efi ::/EFI/BOOT mcopy $ROOT/$TOOLCHAIN/share/syslinux/ldlinux.e64 ::/EFI/BOOT - mcopy "$OE_TMP"/syslinux.cfg ::/EFI/BOOT + mcopy "$LE_TMP"/syslinux.cfg ::/EFI/BOOT elif [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then # create bootloader configuration echo "image: creating bootloader configuration..." - cat << EOF > "$OE_TMP"/cmdline.txt + cat << EOF > "$LE_TMP"/cmdline.txt boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 quiet $EXTRA_CMDLINE EOF - mcopy "$OE_TMP/cmdline.txt" :: + mcopy "$LE_TMP/cmdline.txt" :: # copy files echo "image: copying files to part1..." @@ -271,35 +271,35 @@ fi # bootloader echo "image: extracting part2 from image..." STORAGE_PART_COUNT=$(( $STORAGE_PART_END - $STORAGE_PART_START + 1 )) sync - dd if="$DISK" of="$OE_TMP/part2.ext4" bs=512 skip="$STORAGE_PART_START" count="$STORAGE_PART_COUNT" conv=fsync >"$SAVE_ERROR" 2>&1 || show_error + dd if="$DISK" of="$LE_TMP/part2.ext4" bs=512 skip="$STORAGE_PART_START" count="$STORAGE_PART_COUNT" conv=fsync >"$SAVE_ERROR" 2>&1 || show_error # create filesystem on part2 echo "image: creating filesystem on part2..." - mke2fs -F -q -t ext4 -m 0 "$OE_TMP/part2.ext4" - tune2fs -U $UUID_STORAGE "$OE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error - e2fsck -n "$OE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error + mke2fs -F -q -t ext4 -m 0 "$LE_TMP/part2.ext4" + tune2fs -U $UUID_STORAGE "$LE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error + e2fsck -n "$LE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error sync # add resize mark - mkdir "$OE_TMP/part2.fs" - touch "$OE_TMP/part2.fs/.please_resize_me" + mkdir "$LE_TMP/part2.fs" + touch "$LE_TMP/part2.fs/.please_resize_me" echo "image: populating filesystem on part2..." - populatefs -U -d "$OE_TMP/part2.fs" "$OE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error + populatefs -U -d "$LE_TMP/part2.fs" "$LE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error sync - e2fsck -n "$OE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error + e2fsck -n "$LE_TMP/part2.ext4" >"$SAVE_ERROR" 2>&1 || show_error # merge part2 back to disk image echo "image: merging part2 back to image..." - dd if="$OE_TMP/part2.ext4" of="$DISK" bs=512 seek="$STORAGE_PART_START" conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error + dd if="$LE_TMP/part2.ext4" of="$DISK" bs=512 seek="$STORAGE_PART_START" conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error # extract part1 from image to run fsck echo "image: extracting part1 from image..." SYSTEM_PART_COUNT=$(( $SYSTEM_PART_END - $SYSTEM_PART_START + 1 )) sync - dd if="$DISK" of="$OE_TMP/part1.fat" bs=512 skip="$SYSTEM_PART_START" count="$SYSTEM_PART_COUNT" conv=fsync >"$SAVE_ERROR" 2>&1 || show_error + dd if="$DISK" of="$LE_TMP/part1.fat" bs=512 skip="$SYSTEM_PART_START" count="$SYSTEM_PART_COUNT" conv=fsync >"$SAVE_ERROR" 2>&1 || show_error echo "image: checking filesystem on part1..." - fsck -n $OE_TMP/part1.fat >"$SAVE_ERROR" 2>&1 || show_error + fsck -n $LE_TMP/part1.fat >"$SAVE_ERROR" 2>&1 || show_error # create virtual images if [ "$PROJECT" = Virtual ]; then