Development
Table of contents
Set up environment
To start contributing to FIM repositories, you will need the following packages and dependencies:
Generic dependencies for Linux systems
- Git.
- GCC.
- RustC and Cargo.
- cURL.
- TAR.
- GZIP.
For Debian-based systems dependencies
- devscripts
- equivs
- pkg-config
- libssl-dev
For CentOS-based systems dependencies
- rpm-build
- openssl-devel
Windows systems
- Git.
- RustC and Cargo.
- Light and Candle from MSI toolset.
Installing Rust
Install Rust in the mentioned systems can be performed following the steps:
Linux systems
- Run
curl https://sh.rustup.rs -sSf | sh
to download and install Rust. Follow the required steps with the recommended installation. - Reload the terminal and try cargo with
cargo --version
.
Windows systems
- Download Rust from the official Rust page.
- Double-click on the installer and follow the UI steps.
- Reload the terminal and try cargo with
cargo --version
.
Installing dependencies
You can install each system dependency with the below code block.
Debian dependencies
sudo apt update
sudo apt install -y git curl gcc tar gzip devscripts equivs pkg-config libssl-dev
CentOS dependencies
sudo yum install -y git curl gcc tar gzip rpm-build openssl-devel
Windows dependencies
- Checkout and get Git from Git downloads page
- Checkout and get WIX Toolset from WIX page
Build FIM
FIM requires a compilation or package to run or install in the host. The repository provides tools to perform both options.
Compile and run FIM
With the dependencies installed, it will only require fetching the repository source code and building with the following steps:
- Fetch the Git repository with
git clone https://github.com/Achiefs/fim.git
. - Go to the repository
cd fim
. - Compile FIM
cargo build --release
. - Run FIM with
cargo run
(Unix systems). - Run FIM with
cargo run -- -f
to run FIM in the foreground (Windows systems only)
FIM executable is stored at the
target/release
ortarget/debug
folder, depending on cargo build performed--release
or not.
Build FIM packages
Custom FIM packages are proper to deploy FIM-customized features in specific environments. It is recommended to use Docker. It will maintain your environment clean and secure.
Build FIM package is automated. Follow the below steps to produce the FIM package:
- Run a new docker of the desired package, e.g.
docker run -it --rm ubuntu:xenial
. - Install required dependencies inside the container.
- Clone the FIM repository and go to package folder
pkg/deb
. - Run the
./builder.sh
script to perform build and package generation. - Retrieve the package produced in the current folder. This package has a
.deb
extension.
Perform the same steps to build
rpm
ormsi
packages. It is required to use ARM hardware to build ARM packages.
Setting SystemD service
You may want to set up the FIM SystemD service manually while testing. You can do it by downloading and tuning up the default FIM service file.
Modify the ExecStart path where your FIM binary is, then store the file at /lib/systemd/system/
for CentOS and Debian systems.