akgnah/rockpi-toolkit

Syntax Error on Rock Pi S

Closed this issue · 1 comments

Attempting to run this script on a Rock Pi S using Radxa's latest Buster image. Whenever I try to run the script, I get an error about "unexpected argument '6'"

rock@rockpis:~$ sudo ./rockpi-backup.sh
Welcome to rockpi-backup.sh, part of the Rockpi toolkit.

  Enter rockpi-backup.sh -h to view help.
  For a description and example usage, see the README.md at:
    https://rock.sh/rockpi-toolbox

--------------------
expr: syntax error: unexpected argument '6'

Here is the output if I use bash's -x option"

rock@rockpis:~$ sudo bash -x ./rockpi-backup.sh
+ set -e
+ AUTHOR='Akgnah <1024@setq.me>'
+ VERSION=0.14.0
++ basename ./rockpi-backup.sh
+ SCRIPT_NAME=rockpi-backup.sh
++ mktemp -d
+ BOOT_MOUNT=/tmp/tmp.ocmFm3oh8R
++ mktemp -d
+ ROOT_MOUNT=/tmp/tmp.tg4LdRqKqx
++ mount
++ sed -n 's|^/dev/\(.*\) on / .*|\1|p'
++ cut -b 1-7
+ DEVICE=/dev/mmcblk0
++ id -u
+ '[' 0 '!=' 0 ']'
+ commands='rsync parted gdisk kpartx mkfs.vfat losetup resize-helper'
+ packages='rsync parted gdisk kpartx dosfstools util-linux 96boards-tools-common'
+ need_packages=
+ idx=1
+ for cmd in $commands
+ command -v rsync
+ (( ++idx ))
+ for cmd in $commands
+ command -v parted
+ (( ++idx ))
+ for cmd in $commands
+ command -v gdisk
+ (( ++idx ))
+ for cmd in $commands
+ command -v kpartx
+ (( ++idx ))
+ for cmd in $commands
+ command -v mkfs.vfat
+ (( ++idx ))
+ for cmd in $commands
+ command -v losetup
+ (( ++idx ))
+ for cmd in $commands
+ command -v resize-helper
+ (( ++idx ))
+ '[' '' '!=' '' ']'
+ exclude=
+ label=rootfs
+ OLD_OPTIND=1
+ getopts o:e:m:l:t:uh flag
+ OPTIND=1
+ '[' '' == 1 ']'
+ main
+ echo -e 'Welcome to rockpi-backup.sh, part of the Rockpi toolkit.\n'
Welcome to rockpi-backup.sh, part of the Rockpi toolkit.

+ echo -e '  Enter rockpi-backup.sh -h to view help.'
  Enter rockpi-backup.sh -h to view help.
+ echo -e '  For a description and example usage, see the README.md at:
    https://rock.sh/rockpi-toolbox \n'
  For a description and example usage, see the README.md at:
    https://rock.sh/rockpi-toolbox

+ echo --------------------
--------------------
+ '[' '' == expand ']'
+ gen_partitions
+ '[' '' == rockpis ']'
+ boot_size=524288
+ loader1_size=8000
+ reserved1_size=128
+ reserved2_size=8192
+ loader2_size=8192
+ atf_size=8192
+ system_start=0
+ loader1_start=64
++ expr 64 + 8000
+ reserved1_start=8064
++ expr 8064 + 128
+ reserved2_start=8192
++ expr 8192 + 8192
+ loader2_start=16384
++ expr 16384 + 8192
+ atf_start=24576
++ expr 24576 + 8192
+ boot_start=32768
++ expr 32768 + 524288
+ rootfs_start=557056
+ gen_image_file
+ '[' '' == '' ']'
++ date +%y%m%d-%H%M
+ output=/home/rock/rockpi-backup-200226-1933.img
+++ df -P
+++ grep /dev/root
+++ awk '{print $3}'
++ expr '*' 6 / 5 '*' 1024
expr: syntax error: unexpected argument '6'
+ rootfs_size=

Hello, the latest commit has fixed the bug.