summaryrefslogtreecommitdiff
path: root/scripts/upgrade/install.template
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/upgrade/install.template')
-rwxr-xr-xscripts/upgrade/install.template108
1 files changed, 108 insertions, 0 deletions
diff --git a/scripts/upgrade/install.template b/scripts/upgrade/install.template
new file mode 100755
index 0000000..191dcf7
--- /dev/null
+++ b/scripts/upgrade/install.template
@@ -0,0 +1,108 @@
+#!/bin/bash
+# This script works with a tar archvie
+# called upgrade.bin in either /var/volatile
+# or on the SD card.
+#
+# This is what the tar file upgrade file
+# should look like to create an ipk upgrade
+# file. IPK files should be in all,
+# arm926ejste, and mtcdt (for mtcdt)
+cat <<'!EOF' >/dev/null
+.
+|-- install_list.txt
+|-- install_list.txt.md5
+|-- install.sh*
+|-- local.conf
+|-- repo/
+| |-- arm926ejste/
+| | |-- busybox_1.24.1-r0.mlinux2.mlinux2.1_arm926ejste.ipk
+| | |-- busybox-hwclock_1.24.1-r0.mlinux2.mlinux2.1_arm926ejste.ipk
+| | |-- busybox-ifplugd_1.24.1-r0.mlinux2.mlinux2.1_arm926ejste.ipk
+| | |-- busybox-syslog_1.24.1-r0.mlinux2.mlinux2.1_arm926ejste.ipk
+| | |-- busybox-udhcpc_1.24.1-r0.mlinux2.mlinux2.1_arm926ejste.ipk
+| | |-- initscripts_1.0-r155.3.40.0_arm926ejste.ipk
+| | |-- initscripts-functions_1.0-r155.3.40.0_arm926ejste.ipk
+| | |-- Packages
+| | |-- Packages.gz
+| | `-- Packages.stamps
+| `-- Packages
+!EOF
+#
+# The tarball must be called upgrade.bin.
+#
+# The file /var/volatile/do_flash_upgrade must exist and
+# be owned by root.
+#
+# The tar file, upgrade.bin must be either in
+# /var/volatile/flash-upgrade or
+# /media/card/flash-upgrade
+#
+# Note that when this script is started, the
+# tar file is already unpacked, since this script
+# is in the tarball.
+
+# This script assumes that the rootfs and maybe /var
+# are writable. For MTR, we may need to set
+# root and var to read/write
+
+NAME=install.sh
+echo "$NAME starting in directory $(pwd)"
+cd flash-upgrade/UPGRADE_DIR
+
+id=$(id -u)
+if ((id != 0)) ; then
+ echo 'You must be root (admin in AEP) to install packages.'
+ exit 1
+fi
+
+cat /proc/mounts
+ls /
+ls -l /tmp
+
+localcnf=local.conf
+
+if ! [[ -f ${localcnf} ]] ; then
+ echo "Cannot find ${localcnf}"
+ echo "This file must be in the current directory."
+ exit 1
+fi
+
+dir=$(pwd)
+
+sed -i "s?FLASHDIR?${dir}?" ${localcnf}
+machine=$(mts-io-sysfs show product-id | sed 's/-.*//')
+if [[ $machine == MTCAP ]] ; then
+ # remove mtcdt
+ sed -i '/mtcdt/d' ${localcnf}
+else
+ # remove mtcap
+ sed -i '/mtcap/d' ${localcnf}
+fi
+
+cat ${localcnf}
+pkglist_file="install_list.txt"
+cat ${pkglist_file} |
+(if ! md5sum -c ${pkglist_file}.md5 ; then
+ echo "md5sum bad on ${pkglist_file}"
+ umount_all error
+fi)
+
+echo "Update package list ... /usr/bin/opkg -f ${localcnf} update"
+/usr/bin/opkg -t /var/volatile/ -f "${localcnf}" update
+if [[ -r ${pkglist_file} ]] ; then
+ OIFS="${IFS}"
+ IFS=$'\n'
+ for p in $(cat ${pkglist_file}) ; do
+ echo /usr/bin/opkg -f "${localcnf}" install $p
+ /usr/bin/opkg -t /var/volatile/ -f "${localcnf}" install $p
+ done
+ IFS="${OIFS}"
+fi
+
+/usr/bin/opkg -t /var/volatile/ -f "${localcnf}" upgrade
+
+
+version=$(grep mLinux /etc/mlinux-version | sed 's/mLinux //')
+
+sed -ri "s/mLinux [0-9][^ ]* /mLinux ${version} /" /etc/issue
+sed -ri "s/Version: [0-9][^ ]*/Version: ${version} /" /etc/issue