This Community site is new! Please help us build a community around the JNIOR.
Sign up, and help share your knowledge. Please sign-up even if you do not plan to post as a sign of support.
If there is evidence of a demand we will continue to develop the content here.

MANIFEST Command

The Command Console or Command Line Interface sits at the heart of JANOS. Here we will cover anything and everything that can be done there.
Post Reply
bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

MANIFEST Command

Post by bscloutier » Tue Oct 31, 2017 4:03 pm

The MANIFEST command is a utility that you can use to monitor the health of the file collection on the JNIOR.

If you copy a file from your PC to the JNIOR how do you know that the file has completely and accurately transferred?

Let's look at the DCP file /flash/www.zip. Let's see how we can tell if it is perfect.
bruce_dev /> manifest flash/www.zip
JNIOR Manifest      Tue Oct 31 15:49:01 EDT 2017
  Size                  MD5                  File Specification
 182900   2c6ce5c5d365ea53b437a3760d6f4dd0  [Modified] /flash/www.zip
End of Manifest (1 files listed)

bruce_dev />
MANIFEST tells me the size of the file and also the MD5. That is a unique (ugly) hexadecimal value calculated from the file content. If I calculate the MD5 for the file on the PC it should match. So lets see.

File Properties
2017-10-31_15-51-42.png
2017-10-31_15-51-42.png (47.42 KiB) Viewed 197 times
MD5 Matches

Wait! How do you get those Checksums in the File Properties?

There are many ways to get the MD5 of a file. I found this tool that you install and it adds this to the properties dialog. Here is the link http://code.kliu.org/hashcheck/. It's sweet.

Don't like the MD5 hash then use the -H option for the SHA-1 hash. It still matches!
bruce_dev /> manifest flash/www.zip -h
JNIOR Manifest      Tue Oct 31 15:59:14 EDT 2017
  Size                  SHA-1                        File Specification
 182900   34eda6ecf2cbd0f136ec4adef0cfb442a11f8254  [Modified] /flash/www.zip
End of Manifest (1 files listed)

bruce_dev />
Or the -C option for the simpler CRC32. It still matches!
bruce_dev /> manifest flash/www.zip -c
JNIOR Manifest      Tue Oct 31 16:00:41 EDT 2017
  Size     CRC32     File Specification
 182900   2a1f06bd  [Modified] /flash/www.zip
End of Manifest (1 files listed)

bruce_dev />
Pretty sure that file is accurately over on the JNIOR. What do you think?

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: MANIFEST Command

Post by bscloutier » Tue Oct 31, 2017 4:23 pm

It is not just about comparing checksums or hash values. You can use MANIFEST to monitor the ongoing status of your files. Here is the HELP for the command.
bruce_dev /> help manifest
MANIFEST [filespec]

Options:
 -S,-R          Include subfolders
 -U             Update reference point
 -C             Report CRC32
 -H             Report SHA-1
 -L             List differences only
 filespec       May contain wildcards

Produces a manifest of file system content including checksums.

bruce_dev />
Okay so we have experienced the -H and -C options. The -S (and -R alias) seems straight forward. If you use a wildcard this option will process subfolders as well.

The -U option creates a reference point. This is a manifest.json database containing file details. MANIFEST can use this database at a later time so you can detect changes, new files and missing files. In short, you will know what has changed and what has not on your JNIOR. That has some merit.

For example we will run MANIFEST -U to make sure that our reference point is set. I will then remove a file and let's see if MANIFEST can detect it. The MANIFEST command without file specification processes ALL files on the JNIOR. The -L option lists differences.
bruce_dev /> manifest -ul
JNIOR Manifest      Tue Oct 31 16:10:52 EDT 2017
  Size                  MD5                  File Specification
End of Manifest (0 files listed)

bruce_dev /> dir help.txt -l
total 1
-rw-r--r--   1 jnior     root       17110 Oct 31 14:10 help.txt
  1920.7 KB available

bruce_dev /> rm help.txt

bruce_dev /> manifest -l
JNIOR Manifest      Tue Oct 31 16:11:37 EDT 2017
  Size                  MD5                  File Specification
                                            [Missing] /help.txt
End of Manifest (0 files listed)

bruce_dev /> 
Here we can see that the help.txt file is Missing.

MANIFEST will report missing, new and changed files. In fact if a file changes but its timestamp has not, then it is reported as corrupt. Use of this utility can really help develop confidence in your file system content. You just need to create that reference point.

By the way, there are 2 copies of manifest.json. One is /manifest.json and the other is /flash/manifest.json. One is backup for the other. They are the same. So if for some reason the SRAM is reformatted there is a copy still in the Flash. If Flash is reformatted there is a copy still in the SRAM which holds the root of the file system.

Post Reply