diff --git a/Makefile b/Makefile deleted file mode 100644 index d65aab6..0000000 --- a/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -include $(TOPDIR)/rules.mk -PKG_NAME:=box-installer -PKG_VERSION:=2.0.1 -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -#----------- Defaults -define Package/box-installer/Default - SECTION:=utils - CATEGORY:=Utilities - TITLE:=box-installer Scripts - URL:=https://github.com/LibraryBox-Dev/LibraryBox-Installer/ - PKGARCH:=all - MAINTAINER:=Matthias Strubel -# SUBMENU:= -endef - -define Package/box-installer/Default/description - See https://github.com/LibraryBox-Dev/LibraryBox-Installer/ for more information. (Script is responsible for some kind of auto installation) -endef - - -define Package/box-installer/postinst/Default - #!/bin/sh - sed 's|^exit|#exit|' -i $$PKG_ROOT/etc/rc.local - echo '/bin/box_installer_start.sh' >> $$PKG_ROOT/etc/rc.local -endef - -define Package/box-installer/prerm/Default - #!/bin/sh - sed 's|/bin/box_installer_start.sh||' -i -i $$PKG_ROOT/etc/rc.local -endef - -define Package/box-installer/install/Default - $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) ./files/bin/box_init_setup.sh $(1)/bin - $(INSTALL_BIN) ./files/bin/box_installer.sh $(1)/bin - $(INSTALL_BIN) ./files/bin/box_installer_start.sh $(1)/bin -endef - -define Build/Compile -endef - -define Build/Configure -endef - - -#---------- Base Package -define Package/box-installer - $(call Package/box-installer/Default) - DEPENDS:= +extendRoot -# MENU:=1 -endef - -define Package/box-installer/description - $(call Package/box-installer/Default/description) - This package comes without a package which should be installed. It contains only the installer itself -endef - -define Package/box-installer/postinst - $(call Package/box-installer/postinst/Default) -endef - -define Package/box-installer/prerm - $(call Package/box-installer/prerm/Default) -endef - -define Package/box-installer/install - $(call Package/box-installer/install/Default,$(1)) -endef - -#------------------ -$(eval $(call BuildPackage,box-installer)) diff --git a/README b/README deleted file mode 100644 index f1d59ef..0000000 --- a/README +++ /dev/null @@ -1,54 +0,0 @@ - -Installer script and helper stuff for an automatic installation of -LibraryBox on OpenWRT (with special custom image). - -Makefile - OpenWRT Makefile for box-installer package creation - - -syslog_recv.py - simply python script for client computer, - collecting installation log information. - Client has to be connected via wired and fixed - IP 192.168.1.2 - -files/bin/box_installer.sh - Script doing the work , loggs to STDOUT and STDERR -files/bin/box_installer_start.sh - Script launching syslog daemon and reroutes installer output to syslog-daeming. -files/bin/box_init_setup.sh - Script for a simple user menu setting time & password - -Requirements on the firmware: ------------------------------ - -Package "extendRoot" installed (not initialized) -Package "box-Installer" - -Further Requirments. --------------------- -On the USB Stick has to be located: - -/installer - Contains - /auto_package - One lined file with the packages needed to be installed after bootup - /OpenWRT.img.gz - (prepared) ext3-image file - / - Stuff that needed by 'box packge - /cache - folder containing all needed .ipk files - /Package.gz_attitude_adjustment - Package-List from public repository - /Package.gz_piratebox - Package-List from PirateBox repository (optional) - - -What happens -------------- -During bootup, the box_installer_start.sh initiates the startup of the USB initialization, if extendRoot is not enabled at boot-time. -After extendRoot gets init, the script polls until a USB stick gets available. -On the further progress, it lookups on the install-folder for auto_package and installs that package(s) listed at the first line. -After everthing is done (valid or not), auto_package is renamed into auto_package_done (to prevent infinitive tries). - -On a later start of the script, extendRoot does not get initialized anymore, so that would enable you to install additional packages later (maybe....). - - -Signaling on Router -------------------- - -If available and possible during the following steps, LED signals are given: - - 1. Start of extendRoot init ==>> Steady blinking wifi LED (can be all available WLAN-LEDs) - 2. END of extendRoot init ==>> Steady bright wifi LED - 3. Start of package installation ==> Steady blinking USB LED - 4. END of package installation ==> Steady brigh USB LED diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..dede37d --- /dev/null +++ b/README.txt @@ -0,0 +1,6 @@ + + + This repository is now maintained inside + https://github.com/PirateBox-Dev/openwrt-piratebox-feed + + 2016-04-05 ~ Matthias Strubel diff --git a/files/bin/box_init_setup.sh b/files/bin/box_init_setup.sh deleted file mode 100755 index 7472f38..0000000 --- a/files/bin/box_init_setup.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh - -### Initial Setup script for: -## - setting password -## - Date & Time with userinput -## => initialize timesave script if available. - -DEBUG=false -TIMESAVE_SCRIPT="/opt/piratebox/bin/timesave.sh" - -FTP_CONFIG_SCRIPT="/opt/piratebox/bin/ftp_enable.sh" -FTP_CONFIG_AVAILABLE="-e $FTP_CONFIG_SCRIPT" - -MINIDLNA_INITD="/etc/init.d/minidlna" -MINIDLNA_AVILABLE="-e $MINIDLNA_INITD" -MINIDLNA_PIRATEBOX_OPENWRT_CONFIG="/opt/piratebox/src/openwrt.example.minidlna" -MINIDLNA_OPENWRT_CONFIG="/etc/config/minidlna" -MINIDLNA_STATUS="disabled" - -mainmenu() { - - - while true - do - echo "-------------------------------------" - echo " " - echo " 1 - Setting password and enable SSH" - echo " 2 - Set date & time (enable timesave)" - if [ $FTP_CONFIG_AVAILABLE ] ; then - echo " 3 - Start FTP configuration " - else - echo " - FTP configuration not available" - fi - if [ $MINIDLNA_AVILABLE ] ; then - $MINIDLNA_INITD enabled && MINIDLNA_STATUS="enabled" - echo -n " 4 - minidlna " - if [ "$MINIDLNA_STATUS" = "enabled" ] ; then - echo " disable" - else - echo " enable" - fi - else - echo " - minidlna not available" - fi - echo "" - echo " Everything else causes an exit" - echo " " - read -p " Choose an option: " option - - case $option in - ("1") _set_password_ ;; - ("2") _set_date_ ;; - ("3") _start_ftp_config_ ;; - ("4") _switch_minidlna_ ;; - (*) exit 0;; - esac - option="" - done -} - -_set_password_() { - - echo "Please enter your password. The following command won't show you the entered letters." - local cmd=passwd - if [ "$DEBUG" = "false" ] ; then - $cmd && echo "$? ....OK" - else - echo "$cmd" - fi - -} - -_set_date_() { - - local year="" - local time_="" - - read -p "Please enter your date in the format YYYYMMDD : " year - read -p "Please enter your time in the format HHMM : " time_ - datetime="$year""$time_" - local cmd="date $datetime" - if [ $DEBUG = "false" ] ; then - $cmd && echo "... OK" - else - echo "$cmd" - fi - # If timesave script is available, and it is not already installed, install it. - if [ -e $TIMESAVE_SCRIPT ] ; then - if ! crontab -l | grep -q timesave.sh ; then - $TIMESAVE_SCRIPT /opt/piratebox/conf/piratebox.conf install - # Create OpenWRT cron-enabling and insert into rc.local - /etc/init.d/piratebox timesave - else - $TIMESAVE_SCRIPT /opt/piratebox/conf/piratebox.conf save - fi - fi -} - -_start_ftp_config_() { - - if [ $FTP_CONFIG_AVAILABLE ] ; then - . $FTP_CONFIG_SCRIPT - else - echo "FTP configuration not available" - fi - return 0 - -} - -_switch_minidlna_() { - if [ "$MINIDLNA_STATUS" = "enabled" ] ; then - $MINIDLNA_INITD disabled - $MINIDLNA_INITD stop - echo "minidlna disabled and stopped" - return 0 - else - $MINIDLNA_INITD enable - - - MINIDLNA_PIRATEBOX_OPENWRT_CONFIG="/opt/piratebox/src/openwrt.example.minidlna" - MINIDLNA_OPENWRT_CONFIG="/etc/config/minidlna" - cp $MINIDLNA_PIRATEBOX_OPENWRT_CONFIG $MINIDLNA_OPENWRT_CONFIG - $MINIDLNA_INITD start - - echo "minidlna configuration copied. minidlna started" - fi - -} - -mainmenu diff --git a/files/bin/box_installer.sh b/files/bin/box_installer.sh deleted file mode 100755 index 34c94e1..0000000 --- a/files/bin/box_installer.sh +++ /dev/null @@ -1,221 +0,0 @@ -#!/bin/sh - -# Auto Install script for LibraryBox. -# Installs the one listed package from auto_package to ext-install - -INSTALL_PACKAGE_FILE=/mnt/usb/install/auto_package - -CACHE_LOCATION="/mnt/usb/install/cache" -INSTALL_DESTINATION="-d ext" - -OPKG="opkg --cache $CACHE_LOCATION " -OPKG_DEST="$OPKG $INSTALL_DESTINATION " - -NEXT_STEP="run_test" -ALL_STEPS="yes" -DO_PACKAGE="no" -DO_EXT="no" - - -LED_EXTENDROOT=/sys/class/leds/*wlan -LED_PACKAGE_1=/sys/class/leds/*3g -LED_PACKAGE_2=/sys/class/leds/*usb - - - -_signaling_start(){ - for file in $1 ; do echo "timer" > $file/trigger ; done - return 0 -} - -_signaling_stop(){ - for file in $1 ; do echo "none" > $file/trigger ; done - for file in $1 ; do echo "1" > $file/brightness ; done - return 0 -} - -calc_next_step() { - - case $NEXT_STEP in - - 'run_test') NEXT_STEP="run_signaling_extendRoot_start" ;; - 'run_signaling_extendRoot_start') NEXT_STEP="run_prepare_extendRoot" ;; - 'run_prepare_extendRoot') NEXT_STEP="run_init_extendRoot" ;; - 'run_init_extendRoot') NEXT_STEP="run_signaling_extendRoot_stop" ;; - - 'run_signaling_extendRoot_stop') - if [ "$DO_PACKAGE" = "yes" ] ; then - NEXT_STEP="run_test_installation_destination" - else - NEXT_STEP="exit" - fi ;; - 'run_test_installation_destination') NEXT_STEP='run_fake_opkg_update' ;; - 'run_fake_opkg_update') NEXT_STEP="run_signaling_package_start" ;; - 'run_signaling_package_start') NEXT_STEP="run_install_package" ;; - 'run_install_package') NEXT_STEP="run_signaling_package_stop" ;; - 'run_signaling_package_stop') NEXT_STEP="exit" ;; - *) echo "$0 : unknown previous step..exiting" - exit 255 ;; - esac -} - -run_test() { - #This section includes some tests to ensure everything is as we need it - echo "$0 : Testing requirements..." - if lsmod | grep -q usb_storage ; then - echo "$0 : .. USB storage modules available" - else - echo "$0 : No usb-storage storage modules detected..exit" - exit 255 - fi - if opkg list-installed extendRoot | grep -q extendRoot ; then - echo "$0 : extendRoot package is installed" - else - echo "$0 : extendRoot not available, exiting" - exit 255 - fi -} - - -run_signaling_extendRoot_start(){ - #Switch wlan-light online, that extendRoot init is running - _signaling_start "$LED_EXTENDROOT" - return 0 -} - -run_prepare_extendRoot(){ - #sets flags for installation of extendRoot to prevent the package asking the user - echo "$0 : configure initi step for extendRoot" - . /etc/ext.config - touch $ext_force_ext_overwrite - [ $? ] || exit $? -} - -run_init_extendRoot() { - if /etc/init.d/ext enabled ; then - echo "$0 : not running extendRoot init, because it already is" - return 0 - fi - /etc/init.d/ext init - [ $? ] || exit $? - -} - -# Signalize with a steady wifi light, that extendRoot initialization is done -run_signaling_extendRoot_stop(){ - _signaling_stop "$LED_EXTENDROOT" -} - -run_test_installation_destination(){ - echo "$0 : Testing if installation destination by extendRoot is available." - /etc/init.d/ext is_ready && OK="yes" - if [ "$OK" = "yes" ] ; then - echo "$0 : Installation destination is available." - else - echo "$0 : Something happend to extendRoot filesystem. Printing debug output..." - echo "$0 : Mount output" - mount - echo "$0 : dmesg | grep sd " - dmesg | grep sd - echo "$0 : dmesg | grep loop" - dmesg | grep loop - echo "$0 : dmesg | grep ext" - dmesg | grep ext - echo "$0 : Exiting box-installer routine" - exit 255 - fi -} - - -run_fake_opkg_update() { - echo "$0 : Creating opkg-lists folder, if missing" - mkdir -p /var/opkg-lists - echo "$0 : Getting main Repository from /etc/opkg.conf" - local repo=$(head -n1 /etc/opkg.conf | cut -d ' ' -f 2) - echo "$0 : Doing fake opkg update (copy from cache folder ($repo)" - cp $CACHE_LOCATION/Package.gz_main /var/opkg-lists/$repo - [ $? ] || exit $? - echo "$0 : .. doing it for Piratebox repository (optional)" - cp $CACHE_LOCATION/Package.gz_piratebox /var/opkg-lists/piratebox -} - -run_signaling_package_start(){ - #Blinking 3g/USB LED - _signaling_start "$LED_PACKAGE_1" - _signaling_start "$LED_PACKAGE_2" -} - -run_install_package(){ - # This can only happen if extendRoot is not initialized - # and the auto-install file is not on the USB Stick - if [ ! -e $INSTALL_PACKAGE_FILE ] ; then - echo "$0 : ERROR: $INSTALL_PACKAGE_FILE is not set" - exit 255 - fi - - echo "$0 : Fixing paths" - /bin/ext_path_fixer - - INSTALL_PACKAGE=`head -n 1 $INSTALL_PACKAGE_FILE` - echo "$0 : Installing packge $INSTALL_PACKAGE " - $OPKG_DEST install $INSTALL_PACKAGE - [ $? ] || exit $? -} - -run_signaling_package_stop(){ - #Blinking 3g/USB LED - _signaling_stop "$LED_PACKAGE_1" - _signaling_stop "$LED_PACKAGE_2" -} - - - -# Implement and option to process single steps -usage(){ -echo " Auto installer core script. - -Use the following parameter to trigger actions - -e : extendRoot init only - -p : install auto package file - -n : resume with step - -o : resume only named step - -one of -e or -p is required. -"; -exit 1 -} - -while getopts ":epon:" opt; do - case "${opt}" in - n) NEXT_STEP="${OPTARG}" ;; - p) DO_PACKAGE="yes" ;; - e) DO_EXT="yes" ;; - o) ALL_STEPS="no";; - ?) usage ;; - esac -done - -if [ "$DO_EXT" = "no" ] && [ "$DO_PACKAGE" = "no" ] ; then - usage -fi - -## Default parameter starts with extendRoot -## and ends after it init, when DO_PACKAGE=no - -if [ "$DO_EXT" = "no" ] && [ "$DO_PACKAGE" = "yes" ] ; then - NEXT_STEP="run_test_installation_destination" -fi - -while true; do - echo "$0 : executing $NEXT_STEP" - $NEXT_STEP - - if [ "$ALL_STEPS" = "yes" ] ; then - echo "$0 : Trying to find next step" - calc_next_step - else - echo "$0 : exiting because we run only one step" - exit $? - fi -done - diff --git a/files/bin/box_installer_start.sh b/files/bin/box_installer_start.sh deleted file mode 100755 index c1fb0b8..0000000 --- a/files/bin/box_installer_start.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - - -PID=/var/run/auto_syslogd - -auto_package=/mnt/usb/install/auto_package -auto_package_done=/mnt/usb/install/auto_package_done -logfile=/mnt/usb/install.log - -stopfile=/mnt/usb/stop.txt - -start_log(){ -##Central function for logging; -## only start logging if not already online - if [ ! -e $PID ] ; then - [ -e $logfile ] && echo "---------------------------------------------" >> $logfile - start-stop-daemon -b -S -m -p $PID -x syslogd -- -n -L -R 192.168.1.2:9999 - fi -} - -finish_log(){ - ## Copy log to USB disc - echo "$0 : Logging install log to USB-Stick" - cat /var/log/messages >> $logfile -} - -if [ -e $stopfile ] ; then - start_log - logger "$0 : Stop file detected. Ending processing" - rm $stopfile 2>&1 | logger - logger "$0 : Stop file removed." - finish_log - exit 0 -fi - -if ! /etc/init.d/ext enabled ; then - start_log - - logger "$0 : Doing extendRoot initilization" - - /bin/box_installer.sh -e 2>&1 | logger - - RC=$? - if [ "$RC" -gt "0" ] ; then - logger "$0 : An error occured - Stopping process here ; $RC" - finish_log - exit $RC - fi - - finish_log -fi - - -# Initiates the log facility and starts the installation -if [ -e /mnt/usb/install/auto_package ]; then - - start_log - - /bin/box_installer.sh -p 2>&1 | logger - - - # Always move the first line only - head -n 1 $auto_package >> $auto_package_done - - #Count containing lines, and only shift first to "done" - package_lines=`cat $auto_package | wc -l` - if [ "$package_lines" -gt "1" ] ; then - logger "$0 : Multiple line auto_package found. Shifting 1st line to auto_package_done" - tail -n +2 $auto_package > /tmp/auto_install_new - mv /tmp/auto_install_new $auto_package - else - rm $auto_package - fi - - - logger "$0 : Initiating reboot after installation" - finish_log - sync && reboot -else - echo "Does not run because /mnt/usb/install/auto_package does not exists" -fi - - diff --git a/syslog_recv.py b/syslog_recv.py deleted file mode 100644 index 106801c..0000000 --- a/syslog_recv.py +++ /dev/null @@ -1,27 +0,0 @@ -# Server program -# UDP VERSION - - -from socket import * - -# Set the socket parameters -host = "0.0.0.0" -port = 9999 -buf = 1024 -addr = (host,port) - -# Create socket and bind to address -UDPSock = socket(AF_INET,SOCK_DGRAM) -UDPSock.bind(addr) - -# Receive messages -while 1: - data,addr = UDPSock.recvfrom(buf) - if not data: - print "Client has exited!" - break - else: - print "Received message ", data,"" - -# Close socket -UDPSock.close()