Skip to content

Commit b38ccbe

Browse files
authored
Merge pull request #56 from LeChatP/develop
Fix Installation steps
2 parents eeb41db + 5fd0a0d commit b38ccbe

File tree

4 files changed

+44
-17
lines changed

4 files changed

+44
-17
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ assets = [
132132
{ source = "target/man/fr/chsr.8.gz", dest = "/usr/share/man/fr/man8/chsr.8.gz", user = "root", group = "root", mode = "0644", doc = true }
133133
]
134134
post_install_script = "resources/rh/postinst.sh"
135-
post_install_script_prog = [ "/bin/sh", "-c" ]
135+
post_install_script_flags = 0b101
136136

137137
pre_uninstall_script = "resources/rh/prerm.sh"
138-
pre_uninstall_script_prog = [ "/bin/sh", "-c" ]
138+
pre_uninstall_script_flags = 0b101
139139

140140
[package.metadata.generate-rpm.requires]
141141
pam = "*"

README.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,44 @@
3737

3838
## Installation
3939

40-
### Prerequisites
40+
### Prerequisites (for compilation)
4141

4242
* [Rust](https://www.rust-lang.org/tools/install) >= 1.76.0
4343
* You can install Rust by running the following command:
4444
```sh
4545
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
4646
```
47-
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
47+
(Do not forget to add the cargo bin directory to your PATH with `. "$HOME/.cargo/env"` command)
48+
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
49+
* You can install git by running the following commands depending on your distribution:
50+
Ubuntu : `sudo apt-get install git`, RedHat : `sudo yum install git`, ArchLinux : `sudo pacman -S git`
51+
* [clang](https://clang.llvm.org/get_started.html) (or gcc, but clang is highly recommended)
52+
* You can install clang by running the following commands depending on your distribution:
53+
Ubuntu : `sudo apt-get install clang`, RedHat : `sudo yum install clang`, ArchLinux : `sudo pacman -S clang`
4854

49-
### How to install sr and chsr
55+
Then the xtask installation will install the rest of the dependencies for you.
5056

51-
1. `git clone <https://github.com/LeChatP/RootAsRole>`
57+
### Install from source
58+
59+
1. `git clone https://github.com/LeChatP/RootAsRole`
5260
1. `cd RootAsRole`
53-
1. `sudo cargo xtask install -i -b`
61+
1. `cargo xtask install -bip sudo`
62+
63+
64+
### Install from precompiled binaries
65+
66+
You can download the precompiled binaries from the [release page](https://github.com/LeChatP/RootAsRole/releases).
67+
68+
Then you can install the package with the following commands:
69+
70+
```sh
71+
sudo apt install rootasrole_3.0.0_amd64.deb
72+
```
73+
74+
```sh
75+
sudo rpm -i rootasrole-3.0.0-1.x86_64.rpm
76+
```
77+
5478

5579
### Additional Installation Options
5680

@@ -159,16 +183,14 @@ This doesn't mean that earlier versions of these distributions are incompatible;
159183
160184
## Contributors
161185
162-
Ahmad Samer Wazan : <[email protected]>
186+
Eddie Billoir : <[email protected]>
187+
188+
Ahmad Samer Wazan : <[email protected]>
163189
164190
Rémi Venant: <[email protected]>
165191
166192
Guillaume Daumas : <[email protected]>
167193
168-
Eddie Billoir : <[email protected]>
169-
170-
Anderson Hemlee : <[email protected]>
171-
172194
Romain Laborde : <[email protected]>
173195
174196
## About Logo

resources/rh/postinst.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
#!/bin/sh
2+
if [ -z ${SUDO_USER+x} ]; then INSTALL_USER=$(id -urn); else INSTALL_USER=$SUDO_USER; fi
3+
24
filesystem() {
35
df -T "$1" | awk 'NR==2 {print $2}'
46
}
57

68
configure() {
7-
sed -i "s/ROOTADMINISTRATOR/$(id -urn)/g" /etc/security/rootasrole.json
9+
echo "Configuring rootasrole.json"
10+
sed -i "s/ROOTADMINISTRATOR/$INSTALL_USER/g" /etc/security/rootasrole.json
811
FS=$(filesystem /etc/security/rootasrole.json)
912
case $FS in
1013
"ext2" | "ext3" | "ext4" | "xfs" | "btrfs" | "ocfs2" | "jfs" | "reiserfs")
14+
echo "Setting immutable attribute on /etc/security/rootasrole.json"
1115
chattr +i /etc/security/rootasrole.json
1216
;;
1317
*)
14-
sed -i "s/\"CAP_LINUX_IMMUTABLE\"//g" /etc/security/rootasrole.json
18+
echo "filesystem $FS does not support immutable attribute"
19+
echo "Removing immutable parameter from /etc/security/rootasrole.json"
20+
sed -i "s/\"immutable\": true/\"immutable\": false/g" /etc/security/rootasrole.json
21+
sed -i "s;\"CAP_LINUX_IMMUTABLE\";;g" /etc/security/rootasrole.json
1522
;;
1623
esac
1724
}

resources/rh/prerm.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
#!/bin/sh
2-
3-
chattr -i /etc/security/rootasrole.json || true
1+
chattr -i /etc/security/rootasrole.json 2>/dev/null || true

0 commit comments

Comments
 (0)