akgnah / rockpi-toolkit Goto Github PK
View Code? Open in Web Editor NEWToolkit for ROCK Pi
License: MIT License
Toolkit for ROCK Pi
License: MIT License
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 <[email protected]>'
+ 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=
When I try to use ”radxa-rbuild-backup.sh“ to backup my Ubuntu20.04 sytem on Rock5B, I get this wrong that can't continue
Wrong:
rsync: change_dir "//config" failed: No such file or director
rsync error: some files/attrs were not transferred (see previous errors) (code 23)
So I use # to Comment for this code
184 # rsync --force -rltWDEgop --delete --stats --progress //config/ ${CONFIG_MOUNT}
It continue to backup but still get other wrong
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(644) [sender=3.1.3]
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(520) [generator=3.1.3]
I try again but not get this wrong and Backup done
So is it ok to do this way to continue backup,or it has some other better way to solve this wrong?
脚本里的old_root分区是p2
update_uuid() {
if [ "$model" ]; then
old_config_uuid=$(blkid -o export ${DEVICE}p1 | grep ^UUID)
old_root_uuid=$(blkid -o export ${DEVICE}p2 | grep ^UUID)
new_config_uuid=$(blkid -o export ${mapdevice}p1 | grep ^UUID)
new_root_uuid=$(blkid -o export ${mapdevice}p2 | grep ^UUID)
sed -i "s/$old_config_uuid/$new_config_uuid/g" $ROOT_MOUNT/etc/fstab
sed -i "s/$old_root_uuid/$new_root_uuid/g" $ROOT_MOUNT/etc/fstab
sed -i "s/${old_root_uuid}/${new_root_uuid}/g" $ROOT_MOUNT/boot/extlinux/extlinux.conf
fi
}
3a和5b镜像的root分区实际是p3
rock@rock-5b:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.7G 8.0K 3.7G 1% /dev
tmpfs 770M 1.9M 768M 1% /run
/dev/mmcblk1p3 58G 28G 29G 50% /
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/mmcblk1p1 16M 2.5K 16M 1% /config
/dev/mmcblk1p2 300M 4.0K 300M 1% /boot/efi
tmpfs 770M 56K 770M 1% /run/user/109
tmpfs 770M 56K 770M 1% /run/user/1001
/dev/mapper/loop0p1 16M 8.0K 16M 1% /tmp/tmp.DuSMPANBpy
/dev/mapper/loop0p2 21G 11G 8.5G 56% /tmp/tmp.1elqcdMlmz
rock@rock-5b:~$
Just wondering if this can be available for Rock Pi X.
Will appreciate your comments,
Thanks,
Run sudo ./rockpi-backup.sh
, and cannot install 96boards-tools-common
Command not found: resize-helper, package required: 96boards-tools-common
Do you want to apt-get install the packages? [Y/n] y
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Get:2 http://apt.radxa.com/focal-stable focal InRelease [2356 B]
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Ign:6 http://apt.radxa.com/focal-stable focal/main arm64 Packages
Err:6 http://apt.radxa.com/focal-stable focal/main arm64 Packages
Could not connect to apt.radxa.com:80 (185.199.109.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.108.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.110.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.111.153), connection timed out [IP: 185.199.109.153 80]
Reading package lists... Done
W: Failed to fetch http://apt.radxa.com/focal-stable/dists/focal/main/binary-arm64/Packages Could not connect to apt.radxa.com:80 (185.199.109.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.108.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.110.153), connection timed out Could not connect to apt.radxa.com:80 (185.199.111.153), connection timed out [IP: 185.199.109.153 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package 96boards-tools-common
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.