Skip to content

Commit

Permalink
Add license header in files and set config file for licensure tool + …
Browse files Browse the repository at this point in the history
…documentation
  • Loading branch information
ddurieux committed Jun 17, 2024
1 parent 45965ca commit 6449a41
Show file tree
Hide file tree
Showing 46 changed files with 592 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .licensure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
excludes:
- \.gitignore
- .*lock
- \.git/.*
- \.licensure\.yml
- README.*
- LICENSE.*
- .*\.(md|rst|txt)

licenses:
- files: any
ident: AGPL-3.0
authors:
- name: FusionSuite Team
# auto_template: true
template: |
Copyright (C) [year] [name of author]
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see
<https://www.gnu.org/licenses/>.
comments:
- extensions:
- rs
commenter:
type: line
comment_char: "//"
trailing_lines: 1
columns: 80

17 changes: 17 additions & 0 deletions doc/set_license_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Set license header in files

## Install licensure

You need install the licensure tool:

```sh
cargo install licensure
```

## Run licensure to add / update headers

Run from root of repository:

```sh
find ./ -name "*.rs" -exec ~/.cargo/bin/licensure --in-place --verbose {} \;
```
12 changes: 12 additions & 0 deletions src/common/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

// file used to read the configuration file

use serde_derive::Deserialize;
Expand Down
12 changes: 12 additions & 0 deletions src/common/dmidecode.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.


pub fn get_dmidecode_data(args: &[&str]) {
let dmidecode_cmd: String = get_dmidecode_program();
Expand Down
12 changes: 12 additions & 0 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod dmidecode;
pub mod config;
pub mod webserver;
12 changes: 12 additions & 0 deletions src/common/webserver.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use rocket::Rocket;
use rocket::Build;
use rocket::response::{content, Redirect};
Expand Down
12 changes: 12 additions & 0 deletions src/local_inventory_sender.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use serde_json::json;
use reqwest::header::USER_AGENT;
use crate::CONFIG;
Expand Down
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

#[macro_use] extern crate rocket;

use local_inventory_sender::send_inventory;
Expand Down
12 changes: 12 additions & 0 deletions src/module/common.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::thread;
use std::time::{SystemTime, UNIX_EPOCH, Duration};

Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/chassis/dmidecode.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::{fs::File, io::Read};
use nparse::*;
use std::process::{Command, Stdio};
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/chassis/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod dmidecode;
12 changes: 12 additions & 0 deletions src/module/localinventory/data/cpu/dmidecode.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::{fs::File, io::Read};
use nparse::*;
use std::process::{Command, Stdio};
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/cpu/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod dmidecode;
12 changes: 12 additions & 0 deletions src/module/localinventory/data/filesystem/freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "freebsd")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.


use std::process::{Command, Stdio};
use regex::Regex;
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/filesystem/linux.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "linux")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.


use std::process::{Command, Stdio};
use regex::Regex;
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/filesystem/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod freebsd;
pub mod linux;
12 changes: 12 additions & 0 deletions src/module/localinventory/data/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod chassis;
pub mod cpu;
pub mod physicaldisk;
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/operatingsystem/common.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use sysinfo::System;
use chrono::Local;

Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/operatingsystem/freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "freebsd")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::fs;
use chrono::prelude::{DateTime, Utc};
// use std::process::Command;
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/operatingsystem/linux.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "linux")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::fs;
use chrono::prelude::{DateTime, Utc};
// use std::process::Command;
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/operatingsystem/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

pub mod common;
pub mod freebsd;
pub mod linux;
12 changes: 12 additions & 0 deletions src/module/localinventory/data/partition/freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "freebsd")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use sysctl::Sysctl;

pub fn run_inventory(disk: serde_json::Value) -> Vec<serde_json::Value> {
Expand Down
12 changes: 12 additions & 0 deletions src/module/localinventory/data/partition/linux.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#![cfg(target_os = "linux")]
// Copyright (C) 2024 FusionSuite Team
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details. You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::process::{Command, Stdio};

// TODO
Expand Down
Loading

0 comments on commit 6449a41

Please sign in to comment.