Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
meta-seconorth-distro
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
13
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SECO Northern Europe
Yocto
layers
meta-seconorth-distro
Commits
076d4431
Commit
076d4431
authored
4 years ago
by
Jonas Höppner
Browse files
Options
Downloads
Patches
Plain Diff
fng-install: remove whitespace from line endings
parent
c64bc4a4
No related branches found
No related tags found
1 merge request
!2
Install script
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
recipes-bsp/fng-install/files/mx6/fng-install.sh
+53
-53
53 additions, 53 deletions
recipes-bsp/fng-install/files/mx6/fng-install.sh
with
53 additions
and
53 deletions
recipes-bsp/fng-install/files/mx6/fng-install.sh
+
53
−
53
View file @
076d4431
#!/bin/sh
# Yocto installation script for Flash-N-Go System - (c) 2015 Garz & Fricke GmbH
#
#
# This script is designed to run from the Flash-N-Go System v4.0 or higher.
# It partitions the device for Linux Yocto and writes Linux Yocto images
# to the internal eMMC memory.
#
#
# The name of the root filesystem image can optionally be specified on the
# command line. If this parameter is omitted, the default image is used.
# The script can load the image files either from a local directory (e.g. USB
# drive, SD card or /tmp directory) or over the network via TFTP.
#
#
# To execute it locally, boot Flash-N-Go System, place the binary files and
# this script into a common directory and execute the script from the
# Flash-N-Go System shell (replace path with e.g. /mnt/mstick1):
#
#
# /path/to/images/fng-install.sh [<Options>]
#
#
# To run it using TFTP, configure your TFTP server so that it points to the BSP
# folder containing this script and the binary images.
# Connect your device to the Ethernet, boot Flash-N-Go System and make sure
...
...
@@ -24,7 +24,7 @@
# 'sconfig' if necessary). Then run the following command from the Flash-N-Go
# System shell (replace the IP address by your TFTP server's IP address and
# remove the '#' sign):
#
#
# export TFTP=192.168.1.100; curl tftp://$TFTP/fng-install.sh | sh [-s -- <Options>]
#
# Options:
...
...
@@ -84,8 +84,8 @@ usage()
}
#==============================================
# Parse user partition argument
# -u|--UserPartition
# Parse user partition argument
# -u|--UserPartition
# (Format "<filesystem>:<megabytes>:<label>").
# allows to create an additional partition
# during installation
...
...
@@ -458,9 +458,9 @@ unmountall()
milestone
()
{
text
=
"
$@
"
# Dupplicate text to out and logfile
# Dupplicate text to out and logfile
echo
"
$text
"
>
/dev/fd/5
echo
echo
echo
"==
$text
=="
echo
}
...
...
@@ -485,7 +485,7 @@ info_msg()
#========================================
nop
()
{
echo
echo
}
cleanup
()
{
...
...
@@ -531,7 +531,7 @@ check_fng_boot_version()
info_msg
"your system has fngboot
${
fngboot_major
}
.
${
fngboot_minor
}
r
$fngboot_revision
"
if
[
"
$fngboot_major
"
-gt
"
$min_fngboot_major
"
]
;
then return
0
;
fi
if
[
"
$fngboot_major
"
-eq
"
$min_fngboot_major
"
]
;
then
if
[
"
$fngboot_major
"
-eq
"
$min_fngboot_major
"
]
;
then
if
[
"
$fngboot_minor
"
-gt
"
$min_fngboot_minor
"
]
;
then return
0
;
fi
if
[
"
$fngboot_minor
"
-eq
"
$min_fngboot_minor
"
]
;
then
if
[
"
$fngboot_revision
"
-ge
"
$min_fngboot_revision
"
]
;
then return
0
;
fi
...
...
@@ -567,20 +567,20 @@ check_fng_system_version()
if
[
"
$fngsys_major
"
-eq
"
$min_fngsys_major
"
-a
"
$fngsys_minor
"
-ge
"
$min_fngsys_minor
"
]
;
then return
0
;
fi
if
[
"
$fngsys_major
"
-eq
"
$min_fngsys_major
"
-a
"
$fngsys_minor
"
-eq
"
$min_fngsys_minor
"
-a
"
$fngsys_revision
"
-ge
"
$min_fngsys_revision
"
]
;
then return
0
;
fi
error_msg
"Your Flash-N-Go System version is outdated."
error_msg
"Your Flash-N-Go System version is outdated."
if
[
"
$fngsys_revision
"
-eq
0
]
;
then
error_text
"Please update Flash-N-Go System to version
${
min_fngsys_major
}
.
${
min_fngsys_minor
}
or newer."
else
error_text
"Please update Flash-N-Go System to version
${
min_fngsys_major
}
.
${
min_fngsys_minor
}
r
${
min_fngsys_revision
}
or newer."
fi
error_text
"Update failed."
error_text
"Update failed."
exit
1
}
#===========================================================
# Are we in FNG System, do we have an mmc,
# Are we in FNG System, do we have an mmc,
# does the version of FNGBoot and FNG System match
#===========================================================
check_startup_conditions
()
...
...
@@ -668,7 +668,7 @@ unmounttarget()
#=========================================
# Executes rpm installation given with
# -r|--RPM after change root in the
# -r|--RPM after change root in the
# target os
#=========================================
rpm_install
()
...
...
@@ -709,7 +709,7 @@ rpm_install()
}
#=========================================
# Executes rpm removal given with
# -e|--EraseRPM after change root in the
# -e|--EraseRPM after change root in the
# target os
#=========================================
rpm_erase
()
...
...
@@ -742,8 +742,8 @@ rpm_erase()
}
#=================================================
# Install arbitrary files given with -t|--TFTP
# (Format "<file>:<location>" where
# Install arbitrary files given with -t|--TFTP
# (Format "<file>:<location>" where
# location can be a filename or an existing dir.
#=================================================
tftp_install
()
...
...
@@ -812,7 +812,7 @@ tftp_install()
#=========================================
# Executes 'PreInstallScripts' given with
# --PreInstallScripts in the Flash-N-Go
# --PreInstallScripts in the Flash-N-Go
# environment
#=========================================
run_preinstall_scripts
()
...
...
@@ -846,7 +846,7 @@ run_preinstall_scripts()
#=========================================
# Executes 'PostInstallScripts' given with
# --PostInstallScripts in the Flash-N-Go
# --PostInstallScripts in the Flash-N-Go
# environment
#=========================================
run_postinstall_scripts
()
...
...
@@ -880,7 +880,7 @@ run_postinstall_scripts()
#=========================================
# Executes 'user' install script given with
# -s|--UserScript after change root in
# -s|--UserScript after change root in
# the target os
#=========================================
user_install
()
...
...
@@ -917,14 +917,14 @@ user_install()
#=========================================================
# Executed Tests:
# After installation all partitions should be
# After installation all partitions should be
# mounted to detect problems with the created partitions.
#
# Params: 1: device 2: filesystem type
#=========================================================
posttest_check_partition
()
{
local
p
local
p
local
fstype
local
result
...
...
@@ -939,7 +939,7 @@ posttest_check_partition()
return
1
fi
mount |
grep
${
TMP_MOUNT_POINT
}
|
grep
-q
"type
$fstype
"
mount |
grep
${
TMP_MOUNT_POINT
}
|
grep
-q
"type
$fstype
"
result
=
$?
if
[
0
!=
$result
]
;
then
echo
"Wrong fstype seen, expected
$fstype
, mount returned:
$(
mount |
grep
${
TMP_MOUNT_POINT
}
)
"
...
...
@@ -959,26 +959,26 @@ posttest_check_partition()
postinstallation_tests
()
{
local
partitions
local
p
local
p
local
fstype
local
result
milestone
"Executing postinstallation test"
partitions
=
"/dev/mmcblk0p1:vfat ""/dev/mmcblk0p2:vfat ""/dev/mmcblk0p3:
$ROOTFS_TYPE
"
partitions
=
"/dev/mmcblk0p1:vfat ""/dev/mmcblk0p2:vfat ""/dev/mmcblk0p3:
$ROOTFS_TYPE
"
for
p
in
$partitions
;
do
fstype
=
${
p
#*
:
}
;
p
=
${
p
%
:
*
}
;
posttest_check_partition
$p
$fstype
result
=
$?
if
[
0
!=
$result
]
;
then
return
$result
fi
done
if
[
!
-z
$USER_PARTITION_DEV
]
;
then
posttest_check_partition
$USER_PARTITION_DEV
$USERFS_TYPE
result
=
$?
...
...
@@ -999,7 +999,7 @@ postinstallation_tests()
# the TFTP variable if a protocol was given
# (allows http://...)
#=========================================
setup_download_prefix
()
setup_download_prefix
()
{
local
FILEPATH
# Choose cURL prefix dependent on whether TFTP variable is set
...
...
@@ -1018,8 +1018,8 @@ setup_download_prefix()
}
#=========================================
# Tries to download # to see if the
# network connection is OK
# Tries to download # to see if the
# network connection is OK
# and the file is reachable
#=========================================
verify_file_access
()
...
...
@@ -1068,7 +1068,7 @@ wait_for_devnodes()
nodes
=
$@
for
node
in
$nodes
;
do
while
[
!
-b
$node
]
;
do
while
[
!
-b
$node
]
;
do
echo
-n
.
timeout
=
$(
expr
$timeout
- 1
)
if
[
0
==
$timeout
]
;
then
...
...
@@ -1083,7 +1083,7 @@ wait_for_devnodes()
}
#===================================================
#
#
#===================================================
check_partitions
()
{
...
...
@@ -1126,8 +1126,8 @@ check_partitions()
}
#===================================================
# Creates new partition table,
# the first partition (FNG System) is rewritten
# Creates new partition table,
# the first partition (FNG System) is rewritten
# ( because sfdisk only allows writing the complete table)
# The other partitions are newly created
#===================================================
...
...
@@ -1243,7 +1243,7 @@ load_file()
milestone
"Writing
${
FILE
}
..."
while
true
;
while
true
;
do
# TODO we should have a timeout here
info_msg
"Try to load
${
FILE
}
... "
...
...
@@ -1254,7 +1254,7 @@ load_file()
ret
=
$?
set
-e
if
[[
"x
$ret
"
==
"x0"
]]
if
[[
"x
$ret
"
==
"x0"
]]
then
milestone
"Writing
${
FILE
}
finished."
return
0
...
...
@@ -1279,7 +1279,7 @@ load_and_untar()
TARGET
=
$2
repeat
=
3
while
true
;
while
true
;
do
# TODO we should have a timeout here
milestone
"Writing rootfs (
${
FILE
}
)"
...
...
@@ -1303,7 +1303,7 @@ load_and_untar()
ret
=
$?
set
-e
if
[[
"x
$ret
"
==
"x0"
]]
if
[[
"x
$ret
"
==
"x0"
]]
then
sync
milestone
"Writing rootfs (
${
FILE
}
) finished."
...
...
@@ -1323,7 +1323,7 @@ load_and_untar()
#===========================================
load_and_write_files
()
{
info_msg
info_msg
info_msg
"== Writing files =="
info_msg
...
...
@@ -1419,9 +1419,9 @@ load_and_write_files()
sed
-i
"s/^
\(
overlays=.*
\)
$/
\1
${
DTBASE
}
/g"
${
TMP_MOUNT_POINT
}
/overlays.txt
done
if
[
-n
"
$MD5SUMS
"
]
;
if
[
-n
"
$MD5SUMS
"
]
;
then
load_file
${
MD5SUMS
}
${
TMP_MOUNT_POINT
}
/md5sums.txt
load_file
${
MD5SUMS
}
${
TMP_MOUNT_POINT
}
/md5sums.txt
fi
# If there is an md5sums.txt in the boot partition (just loaded or from the root.tar)
...
...
@@ -1437,8 +1437,8 @@ load_and_write_files()
for
i
in
`
find
${
TMP_MOUNT_POINT
}
-type
f
-print
`
;
do
case
$i
in
*
md5sums
*
)
continue
;;
# ignore the md5sum files
*
)
grep
"[[:space:]*]
${
i
##*/
}
"
${
TMP_MOUNT_POINT
}
/md5sums.txt.tmp
>>
${
TMP_MOUNT_POINT
}
/md5sums.txt
||
echo
"WARNING: no md5sum found for
$i
"
;;
*
md5sums
*
)
continue
;;
# ignore the md5sum files
*
)
grep
"[[:space:]*]
${
i
##*/
}
"
${
TMP_MOUNT_POINT
}
/md5sums.txt.tmp
>>
${
TMP_MOUNT_POINT
}
/md5sums.txt
||
echo
"WARNING: no md5sum found for
$i
"
;;
esac
done
...
...
@@ -1447,7 +1447,7 @@ load_and_write_files()
fi
umount
${
TMP_MOUNT_POINT
}
unmountall
unmountall
sync
}
...
...
@@ -1457,7 +1457,7 @@ load_and_write_files()
do_update
()
{
# Use subshell so set -e breaks at any return != 0 finished only the subshell an we may repeat the process
(
(
# Stop on errors
set
-e
;
...
...
@@ -1484,7 +1484,7 @@ do_update()
# Execute some tests to make sure the target partitions are there and good
postinstallation_tests
# Execute Postinstall Scripts, if any
run_postinstall_scripts
$PostInstallScript
...
...
@@ -1500,16 +1500,16 @@ do_and_repeat_update()
local
repeat
=
$1
local
ret
while
true
;
while
true
;
do
# Unmount any previously mounted partitions of the emmc
unmountall
# Execute the actual update
# Execute the actual update
do_update
ret
=
$?
if
[[
"x
$ret
"
==
"x0"
]]
if
[[
"x
$ret
"
==
"x0"
]]
then
return
0
fi
...
...
@@ -1559,13 +1559,13 @@ parse_args "$@"
set
-o
pipefail
# makes sure the return code of a piped command is not 0 if one of the commands in it fails
if
[
$VERBOSE
-gt
0
]
;
then
# In Verbose mode just print everything (stdin and stderr to stcout and the logfile,
# In Verbose mode just print everything (stdin and stderr to stcout and the logfile,
# the messages one fd5 are not used.
exec
5>/dev/null
exec
2>&1
do_installation |
tee
$LOGFILE
else
# In none verbose mode only the milestones and errors are printed to stdout using fd5,
# In none verbose mode only the milestones and errors are printed to stdout using fd5,
# other output on stdin and stderr is written to the logfile.
exec
5>&1
exec
1>
$LOGFILE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment