bluerobotics / companion

Companion computer startup scripts and examples
https://www.ardusub.com/operators-manual/companion-web.html
GNU General Public License v3.0
48 stars 54 forks source link

Add image deploy script #320

Closed jaxxzer closed 4 years ago

jaxxzer commented 4 years ago

The procedure for creating a new stable image:

patrickelectric commented 4 years ago

image Is this amount of questions normal ?

patrickelectric commented 4 years ago

I also got a bunch of errors:

./create-image.sh: line 100: * : syntax error: operand expected (error token is "* ")
./create-image.sh: line 102: 47185920 + : syntax error: operand expected (error token is "+ ")
End?  [7948205568B]? yes                                                  
Error: Invalid number.

There is more but my terminal buffer removed some of them

jaxxzer commented 4 years ago

Updated procedure for creating a new image:

This is the output from running the script. The resulting image (0.0.20) is here.

➜  git lsblk -a
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    1  59.8G  0 disk 
├─sda1        8:1    1    41M  0 part 
└─sda2        8:2    1  59.7G  0 part 
nvme0n1     259:0    0 232.9G  0 disk 
├─nvme0n1p1 259:1    0   100M  0 part 
└─nvme0n1p2 259:2    0 232.8G  0 part /
➜  git cd companion/scripts/deploy 
➜  deploy git:(deploy) sudo ./create-image.sh /dev/sda 0.0.20.img
[sudo] password for jacob: 
/dev/sda is (64.2GB)
Are you sure you want to make an image with /dev/sda?
unmounting /dev/sda
umount: /dev/sda1: not mounted.
umount: /dev/sda2: not mounted.
mounting /dev/sda on /tmp/companion_deploy
removing backup repo
copying gstreamer2.param.default
copying mavproxy.param.default
copying wpa_suplicant.conf.default
adding expand_fs entry to /etc/rc.local
e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2: 100574/3655744 files (0.4% non-contiguous), 909108/15655680 blocks
e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2: 100574/3655744 files (0.4% non-contiguous), 909108/15655680 blocks
resize2fs 1.45.5 (07-Jan-2020)
Resizing the filesystem on /dev/sda2 to 789016 (4k) blocks.
The filesystem on /dev/sda2 is now 789016 (4k) blocks long.

dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          /tmp/companion_deploy
Filesystem UUID:          f2100b2f-ed84-4647-b5ae-089280112716
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              191200
Block count:              789016
Reserved block count:     23677
Free blocks:              97863
Free inodes:              90626
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      74
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         7648
Inode blocks per group:   478
RAID stride:              32753
Flex block group size:    16
Filesystem created:       Mon Apr 10 05:57:33 2017
Last mount time:          Tue Apr 21 22:34:28 2020
Last write time:          Tue Apr 21 22:34:47 2020
Mount count:              0
Maximum mount count:      -1
Last checked:             Tue Apr 21 22:34:34 2020
Check interval:           0 (<none>)
Lifetime writes:          9 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      226681fa-1566-4c81-aa0b-bd69c1ea2eab
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             32M
Journal length:           8192
Journal sequence:         0x000043d1
Journal start:            0

dumpe2fs 1.45.5 (07-Jan-2020)
dumpe2fs 1.45.5 (07-Jan-2020)
Warning: Shrinking a partition can cause data loss, are you sure you want to continue?
Yes/No? yes                                                               
Information: You may need to update /etc/fstab.

The end of the data is 3127 MiB                                           
Do you want to copy 3127 MiB from /dev/sda to 0.0.20.img?
3206545408 bytes (3.2 GB, 3.0 GiB) copied, 34 s, 94.3 MB/s
3127+0 records in
3127+0 records out
3278897152 bytes (3.3 GB, 3.1 GiB) copied, 34.8796 s, 94.0 MB/s
Do you want to compress 0.0.20.img?
  adding: 0.0.20.img (deflated 58%)
done
➜  deploy git:(deploy) ✗ ls
0.0.20.img  0.0.20.img.zip  create-image.sh
jaxxzer commented 4 years ago

@patrickelectric please try it again starting from current stable version.

I added a lot of error handling since last time so the script will stop on a problem.

jaxxzer commented 4 years ago

ping @patrickelectric

jaxxzer commented 4 years ago

An idea I have is that the ./install-dependencies and ./setup-raspbian can be run more than once, at any arbitrary time, so these scripts could replace post-update.sh incremental approach.

jaxxzer commented 4 years ago

Check for the lock file mentioned in: https://github.com/bluerobotics/companion/pull/350

jaxxzer commented 4 years ago

bring this in too https://github.com/bluerobotics/companion/pull/339/commits/1192218ced34daeddd7412caeed4b4238f8fff58#r451166591 ( as well as other changes in this pr)