From f34ce08263f75ca4bef2f5b61b1356d63278572d Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:19:42 -0500 Subject: [PATCH 1/8] Update .config --- src/.config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/.config b/src/.config index d3ece837e..5e2e64305 100644 --- a/src/.config +++ b/src/.config @@ -73,6 +73,12 @@ FELIX_SOURCE_URL=http://archive.apache.org/dist/felix/org.apache.felix.main.dist # LUA_SOURCE_URL=https://www.lua.org/ftp/lua-5.3.4.tar.gz +# You can find the latest nano source bundles here: +# +# https://nano-editor.org/download.php +# +NANO_SOURCE_URL=https://nano-editor.org/dist/v2.8/nano-2.8.7.tar.xz + # You can find the latest ncurses archives here: # # https://ftp.gnu.org/pub/gnu/ncurses/ @@ -194,6 +200,7 @@ COPY_SOURCE_ISO=true # openjdk - installs Open JDK. All operations are automated. # felix - Apache Felix OSGi framework. # mll_utils - set of executable utilities (mll-*). +# nano - GNU nano is an enhanced clone of the Pico text editor # ncurses - "GUI-like" API that runs within a terminal emulator # lua - scripting language # static_get - portable binaries for Linux (http://s.minos.io) @@ -205,7 +212,7 @@ COPY_SOURCE_ISO=true # # Refer to the README file for more information. # -#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua,static_get,cf_cli,ncurses,util_linux,nweb,dhcp +#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,nano,lua,static_get,cf_cli,ncurses,util_linux,nweb,dhcp #OVERLAY_BUNDLES=dhcp,glibc_full,zlib,openjdk,felix,links # This property enables the standard penguin boot logo in the upper left corner From 011faddb747160d44f16f77517200346c91cb283 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:20:35 -0500 Subject: [PATCH 2/8] Update README --- src/README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/README b/src/README index 5db6a2088..494384b92 100644 --- a/src/README +++ b/src/README @@ -72,6 +72,8 @@ Currently available overlay bundles: * Lua - The Lua Scripting Language 5.3. Requires ~ 800kb additional space. Use the "lua" command to run an interactive lua interpreter +* nano - GNU nano is an enhanced clone of the Pico text editor + * ncurses - 'GUI-like' API that runs within a terminal emulator * nweb - nweb is a very small and easy to use webserver, it is run automatically on port 80 From 595bed2dde76c8c53d8651461b6fe9938dc37536 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:21:46 -0500 Subject: [PATCH 3/8] Update 02_build.sh --- src/minimal_overlay/bundles/ncurses/02_build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/minimal_overlay/bundles/ncurses/02_build.sh b/src/minimal_overlay/bundles/ncurses/02_build.sh index f1bfef294..dfe151ca1 100755 --- a/src/minimal_overlay/bundles/ncurses/02_build.sh +++ b/src/minimal_overlay/bundles/ncurses/02_build.sh @@ -25,13 +25,17 @@ echo "Configuring Ncurses..." ./configure \ --prefix=/usr \ --with-termlib \ - --with-shared \ --with-terminfo-dirs=/lib/terminfo \ --with-default-terminfo-dirs=/lib/terminfo \ --without-normal \ --without-debug \ --without-cxx-binding \ --with-abi-version=5 \ + --enable-widec \ + --enable-pc-files \ + --with-shared \ + CPPFLAGS=-I$PWD/ncurses/widechar \ + LDFLAGS=-L$PWD/lib \ CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" \ CPPFLAGS="-P" @@ -47,6 +51,13 @@ make -j $NUM_JOBS echo "Installing ncurses..." make -j $NUM_JOBS install DESTDIR=$DESTDIR +# Symnlink wide character libraries +cd $DESTDIR/usr/lib +ln -s libncursesw.so.5 libncurses.so.5 +ln -s libncurses.so.5 libncurses.so +ln -s libtinfow.so.5 libtinfo.so.5 +ln -s libtinfo.so.5 libtinfo.so + echo "Reducing ncurses size..." strip -g $DESTDIR/usr/bin/* @@ -57,4 +68,3 @@ cp -r $DESTDIR/usr/* $ROOTFS echo "ncurses has been installed." cd $SRC_DIR - From 651f6905c70b201c4fb929db1e60ebcf39b98b0d Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:22:47 -0500 Subject: [PATCH 4/8] Create 01-get.sh --- src/minimal_overlay/bundles/nano/01-get.sh | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/minimal_overlay/bundles/nano/01-get.sh diff --git a/src/minimal_overlay/bundles/nano/01-get.sh b/src/minimal_overlay/bundles/nano/01-get.sh new file mode 100644 index 000000000..daae2653a --- /dev/null +++ b/src/minimal_overlay/bundles/nano/01-get.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i NANO_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') + +# Grab everything after the last '/' character. +ARCHIVE_FILE=${DOWNLOAD_URL##*/} + +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE $MAIN_SRC_DIR/.config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE ] ; then + echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading nano source bundle file. The '-c' option allows the download to resume. + echo "Downloading nano source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local nano source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted nano. +echo "Removing nano work area. This may take a while..." +rm -rf $WORK_DIR/overlay/nano +mkdir $WORK_DIR/overlay/nano + +# Extract nano to folder 'work/overlay/nano'. +# Full path will be something like 'work/overlay/nano/nano-2.8.7'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/nano + +cd $SRC_DIR From 0a16fc08bda31ca9ecdc1e44fdfc076db47b82f0 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:23:08 -0500 Subject: [PATCH 5/8] Rename 01-get.sh to 01_get.sh --- src/minimal_overlay/bundles/nano/{01-get.sh => 01_get.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/minimal_overlay/bundles/nano/{01-get.sh => 01_get.sh} (100%) diff --git a/src/minimal_overlay/bundles/nano/01-get.sh b/src/minimal_overlay/bundles/nano/01_get.sh similarity index 100% rename from src/minimal_overlay/bundles/nano/01-get.sh rename to src/minimal_overlay/bundles/nano/01_get.sh From 4dedabf93d86fcca9f11c67adc575604af454c14 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:23:47 -0500 Subject: [PATCH 6/8] Create 02_build.sh --- src/minimal_overlay/bundles/nano/02_build.sh | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/minimal_overlay/bundles/nano/02_build.sh diff --git a/src/minimal_overlay/bundles/nano/02_build.sh b/src/minimal_overlay/bundles/nano/02_build.sh new file mode 100644 index 000000000..b63a4208a --- /dev/null +++ b/src/minimal_overlay/bundles/nano/02_build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/nano + +DESTDIR="$PWD/nano_installed" + +# Change to the nano source directory which ls finds, e.g. 'nano-2.8.7'. +cd $(ls -d nano-*) + +echo "Preparing nano work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring nano..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr + --disable-utf8 \ + CFLAGS="-Os -s -fno-stack-protector -U_FORTIFY_SOURCE" + +echo "Building nano..." +make -j $NUM_JOBS + +echo "Installing nano..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing nano size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/* $ROOTFS + +echo "nano has been installed." + +cd $SRC_DIR From 198617643aa8617a809e85a8a33aa7a641ae47bb Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 17:24:34 -0500 Subject: [PATCH 7/8] Create bundle.sh --- src/minimal_overlay/bundles/nano/bundle.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/minimal_overlay/bundles/nano/bundle.sh diff --git a/src/minimal_overlay/bundles/nano/bundle.sh b/src/minimal_overlay/bundles/nano/bundle.sh new file mode 100644 index 000000000..db41a1610 --- /dev/null +++ b/src/minimal_overlay/bundles/nano/bundle.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR From 1bd557d52730cc29054ea085576d7bc06cc100cb Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Mon, 13 Nov 2017 18:06:11 -0500 Subject: [PATCH 8/8] File permissions --- src/minimal_overlay/bundles/nano/01_get.sh | 0 src/minimal_overlay/bundles/nano/02_build.sh | 0 src/minimal_overlay/bundles/nano/bundle.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/minimal_overlay/bundles/nano/01_get.sh mode change 100644 => 100755 src/minimal_overlay/bundles/nano/02_build.sh mode change 100644 => 100755 src/minimal_overlay/bundles/nano/bundle.sh diff --git a/src/minimal_overlay/bundles/nano/01_get.sh b/src/minimal_overlay/bundles/nano/01_get.sh old mode 100644 new mode 100755 diff --git a/src/minimal_overlay/bundles/nano/02_build.sh b/src/minimal_overlay/bundles/nano/02_build.sh old mode 100644 new mode 100755 diff --git a/src/minimal_overlay/bundles/nano/bundle.sh b/src/minimal_overlay/bundles/nano/bundle.sh old mode 100644 new mode 100755