2023-07-30 11:44:44 +02:00
# bit-inspector
2023-08-08 18:24:48 +02:00
"Bit Inspector" (Bir) is a tool to manage files.
* It is inspired by Git, but its goals are slightly different.
Features
* Tracking hash sum of files
* Backing up directory to another location (local, FTP(S), SFTP, HTTP(S), S3, Bir server
* Optionally you can set a password to protect your files (if a not trusted external location like FTP or S3 is used)
* Detecting bit rots (to keep your files forever) - found bit rots can be repaired.
2023-08-08 18:04:04 +02:00
* Files are handled in a "Bir repository"
* You can clone a remote repository
2023-08-08 18:24:48 +02:00
* You can save your local repository to a remote repository.
* Your files are versioned. You can travel in history and return to an older version of the whole repo or only a directory or one file.
2023-07-30 11:44:44 +02:00
2023-08-08 18:24:48 +02:00
What is not supported:
* Conflict resolution is not supported. "Bir" is not intended be used by more users at once.
* Several people changing one Bir repository must be avoided.
* One Bir repository can be used by more users, but only one user can change it.
* Branches are not supported
## Requirements
Requirements to run "Bit Inspector":
* Java 19
2023-07-30 11:44:44 +02:00
2023-08-08 18:04:04 +02:00
## How to build "Bit Inspector" on your own
2023-08-08 18:24:48 +02:00
Requirements to build "Bit Inspector:
* Java 19
* Maven
2023-07-30 11:44:44 +02:00
2023-08-08 18:04:04 +02:00
```
git clone https://code.nanoboot.org/nanoboot/bit-inspector
cd bit-inspector
mvn clean install
```
2023-07-30 11:44:44 +02:00
2023-08-08 18:04:04 +02:00
## How to setup your environment on Linux
2023-07-30 11:44:44 +02:00
2023-08-08 18:04:04 +02:00
Add to your .bashrc:
alias bir='java -jar {path to bit-inspector jar with dependencies file}/bit-inspector-0.0.0-SNAPSHOT-jar-with-dependencies.jar'
## Syntax
bir {command} [{arg1} {arg2} {argn}]
2023-07-30 11:44:44 +02:00
Example:
2023-08-08 18:04:04 +02:00
```
bir clone dir=/home/johndoe/mydir url={local path or s3 bucket or FTP server or website url}
```
### Arguments
dir={path to directory}
* default:. (current working directory)
## Bir repository
To use Bir, a Bir repository is needed.
You can:
* clone a remote Bir repository
* or use an existing local Bir repository
* or create a new empty Bir repository
* or create a new Bir repository using an existing directory
### Cloning a remote repo
2023-08-08 18:24:48 +02:00
#### Local
```
bir clone {path to local directory = Bir repository}
```
2023-08-08 18:04:04 +02:00
#### S3
```
2023-08-08 18:24:48 +02:00
bir clone s3://http[s]://{endpoint url}/{bucket name}
2023-08-08 18:04:04 +02:00
```
Then you will be asked for access key and secret key.
2023-08-08 18:24:48 +02:00
#### FTP/FTPS/SFTP
```
bir clone {protocol}://[{user}:{password}]@{host url}:{port}/{directory}
```
#### HTTP/HTTPS
```
bir clone http[s]://[{user}:{password}]@{host url}:{port}/{directory}
```
#### Bir server (via Rest api)
```
bir clone bir:://[{user}:{password}]@{host url}:{port}/[path to repository/]{repository name}
```
### Using an existing Bir repository
2023-08-08 18:04:04 +02:00
### Creating a new empty Bir repository
Go to wanted directory or use argument dir={path to wanted directory} and run:
```
bir init [dir to wanted directory]
```
### Creating a Bir repository using an existing directory
Go to wanted directory or use argument dir={path to wanted directory} and run:
```
bir init [dir to wanted directory]
```
### Commands
2023-07-30 11:44:44 +02:00
2023-08-08 18:04:04 +02:00
### init
2023-07-30 12:15:51 +02:00
2023-08-08 18:04:04 +02:00
Init commands creates new directory .bir with its structure
```
bir init [dir={path to directory}]
```
2023-07-30 12:15:51 +02:00
2023-08-08 18:04:04 +02:00
bir – object storage – local/s3/ftp
bir remote add {remote name}
bir clone {remote name}
bir save
bir push {remote name}
bir fetch
bir pull
bir status
directories:
.bir
.bir objects
Table FILE – add new columns – linux_rights, owner, group
###
## Structure of .bir directory
.bir
.bir/objects
.bir/bir.sqlite3 ... an SQLite database
.bir/.bir.sqlite3.sha512 ...last calculated hash sum of file ".bir.sqlite3".
## File .birignore
2023-07-30 12:15:51 +02:00
You can create file .birignore containing the names of the files/directories you wish to ignore
* each line should contain exactly one name
* lines starting with # are skipped
* you may use Unix shell-style wildcards
2023-08-08 18:04:04 +02:00
## Detection of bit rots
If the file last modification date in database and on the disk are the same, but the calculated checksum is different, then a bit rot was is probably detected.
New files are added to the database, deleted files are removed from the database.
This program cannot restore files with bitrot.
* You have to backup up your files (do snapshots).
It is inspired by:
* https://github.com/ambv/bitrot
* https://github.com/laktak/chkbit-py
## Todo
New tables: FILE_HISTORY