Ever wanted to pack a few things and carry them around? ToolBag might be the tool for you!

Isn’t tar Enough?

Well… you might be wondering why tar wouldn’t be enough for this! Actually, ToolBag generates a gzipped tar file, so in a sense tar is enough.

Fact is that you might have several repositories (yours or from other people) and you might want to produce different collections as all of them evolve. In the meantime, you might also want to throw in a few configuration files, some additional tools, etc.

This is the sweet spot for ToolBag.

Example?

If you clone the GitHub repository for ToolBag you end up with the following:

README.md  teepee.json  toolbag.sh

File teepee.json is an example that should work out of the box:

echo ; ./toolbag.sh <teepee.json

adding git https://github.com/polettix/teepee.git#remotes/origin/master
Cloning into 'teepee.git'...
remote: Enumerating objects: 702, done.
remote: Total 702 (delta 0), reused 0 (delta 0), pack-reused 702
Receiving objects: 100% (702/702), 1.29 MiB | 572.00 KiB/s, done.
Resolving deltas: 100% (248/248), done.
--2019-11-01 23:32:45--  https://github.com/polettix/teepee/raw/master/bundle/teepee
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/polettix/teepee/master/bundle/teepee [following]
--2019-11-01 23:32:46--  https://raw.githubusercontent.com/polettix/teepee/master/bundle/teepee
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 142654 (139K) [text/plain]
Saving to: ‘/home/poletti/sviluppo/toolbag/tmp.rLcy8SYMol/teepee’

/home/poletti/sviluppo/toolbag/t 100%[=========================================================>] 139.31K   609KB/s    in 0.2s    

2019-11-01 23:32:47 (609 KB/s) - ‘/home/poletti/sviluppo/toolbag/tmp.rLcy8SYMol/teepee’ saved [142654/142654]

adding file https://github.com/polettix/teepee/raw/master/bundle/teepee
--2019-11-01 23:32:47--  https://github.com/polettix/teepee/archive/0.7.1.tar.gz
Resolving github.com (github.com)... 140.82.118.3
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/polettix/teepee/tar.gz/0.7.1 [following]
--2019-11-01 23:32:47--  https://codeload.github.com/polettix/teepee/tar.gz/0.7.1
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘/home/poletti/sviluppo/toolbag/tmp.rLcy8SYMol/0.7.1.tar.gz’

/home/poletti/sviluppo/toolbag/t     [  <=>                                                     ]  65.82K   193KB/s    in 0.3s    

2019-11-01 23:32:49 (193 KB/s) - ‘/home/poletti/sviluppo/toolbag/tmp.rLcy8SYMol/0.7.1.tar.gz’ saved [67397]

adding tar https://github.com/polettix/teepee/archive/0.7.1.tar.gz
/path/to/generated/teepee-stuff.tar.gz

The last line will tell you where to find the generated file. Let’s take a look at the contents:

echo ; tar tvf teepee-stuff.tar.gz 

drwxr-xr-x user/user   0 2019-11-01 23:33 teepee-stuff/
drwxr-xr-x user/user   0 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/
-rw-r--r-- user/user 9275 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/CHEATSHEET.md
-rwxr-xr-x user/user 41879 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/teepee
-rw-r--r-- user/user    31 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/.gitignore
-rwxr-xr-x user/user   916 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/update.sh
drwxr-xr-x user/user     0 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/bundle/
-rwxr-xr-x user/user 141527 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/bundle/teepee
drwxr-xr-x user/user      0 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/
-rwxr-xr-x user/user   1142 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/update-local.sh
-rw-r--r-- user/user     83 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/data.yml
-rwxr-xr-x user/user     76 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/create-epan.sh
-rw-r--r-- user/user     44 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/template.tmpl
-rw-r--r-- user/user     98 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/eg/data.json
-rw-r--r-- user/user  32717 2017-07-19 08:09 teepee-stuff/teepee-0.7.1/README.md
drwxr-xr-x user/user      0 2019-11-01 23:33 teepee-stuff/teepee-master/
-rw-r--r-- user/user   9982 2019-02-03 00:59 teepee-stuff/teepee-master/CHEATSHEET.md
-rwxr-xr-x user/user  43006 2019-02-03 00:59 teepee-stuff/teepee-master/teepee
-rw-r--r-- user/user     31 2019-02-03 00:59 teepee-stuff/teepee-master/.gitignore
-rwxr-xr-x user/user    916 2019-02-03 00:59 teepee-stuff/teepee-master/update.sh
drwxr-xr-x user/user      0 2019-02-03 00:59 teepee-stuff/teepee-master/bundle/
-rwxr-xr-x user/user 142654 2019-02-03 00:59 teepee-stuff/teepee-master/bundle/teepee
drwxr-xr-x user/user      0 2019-02-03 00:59 teepee-stuff/teepee-master/eg/
-rwxr-xr-x user/user   1142 2019-02-03 00:59 teepee-stuff/teepee-master/eg/update-local.sh
-rw-r--r-- user/user     83 2019-02-03 00:59 teepee-stuff/teepee-master/eg/data.yml
-rwxr-xr-x user/user     76 2019-02-03 00:59 teepee-stuff/teepee-master/eg/create-epan.sh
-rw-r--r-- user/user     44 2019-02-03 00:59 teepee-stuff/teepee-master/eg/template.tmpl
-rw-r--r-- user/user     98 2019-02-03 00:59 teepee-stuff/teepee-master/eg/data.json
-rw-r--r-- user/user  33223 2019-02-03 00:59 teepee-stuff/teepee-master/README.md
-rw-r--r-- user/user 142654 2019-11-01 23:33 teepee-stuff/teepee
-rw-r--r-- user/user    293 2019-11-01 23:33 teepee-stuff/toolbag-hashes.txt
-rw-r--r-- user/user    461 2019-11-01 23:33 teepee-stuff/toolbag-config.json

As expected from the configuration file:

  • everything is put inside a directory named after field target in the configuration file;

  • the cloned repository has been put in sub-directory teepee-master;

  • the downloaded tar archive has been put in the main directory, but it has a sub-directory teepee-0.7.1 itself;

  • straight file teepee has been put in the main directory.

Additionally, files toolbag-hashes.txt contains hashing values for different files/repositories, while toolbag-config.json the configuration that led to this archive.

What Next?

Next time you will need to collect a few files, possibly versioned, in a single tarball… look no further!