Skip to content

Commit

Permalink
Merge pull request #39 from LeChatP/LeChatP-patch-install
Browse files Browse the repository at this point in the history
Patch install process
  • Loading branch information
LeChatP authored Sep 26, 2023
2 parents f972e58 + 6630224 commit 2097dc1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- name: Install Dependencies
run: |
sudo ./configure.sh -yd
sudo cp /root/.cargo/bin/bpf-linker /usr/bin/
echo "/home/runner/.cargo/bin" >> $GITHUB_PATH
- name: Configure PAM
run: |
Expand All @@ -42,4 +41,4 @@ jobs:
- name: Run Sr
run: /usr/bin/sr -h
- name: Run Chsr
run: /usr/bin/chsr -h
run: /usr/bin/chsr -h
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ Requirement: rustc >= 1.70.0
3. sudo sh ./configure.sh
4. sudo make install

Note: The `configure.sh` installs `cargo` and `bpf-linker` rust programs manually into `/usr/local/bin`. You can refuse to install it this way, but these are mandatory to build the program. Depending on your distribution or how you want to install this software, you may know that most rust binaries are installed to `$HOME/.cargo/bin`. When you use sudo to configure, these binaries are installed in the effective user home directory. You may need to move these binaries to a known-user path.

> [!WARNING]
> **This installation process gives by default the entire privileges set for the user which execute sudo. This means that the user which install this program will be privileged.**

### Usage

<pre>
Expand Down
22 changes: 18 additions & 4 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while getopts "yd" opt; do
esac
done

echo "Install Rust"
echo "Install Rust Cargo compiler"
if [ $(which cargo &>/dev/null ; echo $?) -eq 0 ]; then
echo "Cargo is installed"
elif [ "${YES}" == "-y" ]; then
Expand All @@ -27,7 +27,8 @@ else
fi

if [ ! -f "/usr/bin/cargo" ]; then
cp ~/.cargo/bin/cargo /usr/bin
mv -f ~/.cargo/bin/cargo /usr/local/bin
echo "$HOME/.cargo/bin/cargo program is copied to /usr/local/bin"
fi

echo "Capabilities & PAM packages installation"
Expand Down Expand Up @@ -60,8 +61,21 @@ else
exit 2
fi

echo "Install cargo bpf-linker"
cargo install --force bpf-linker
# ask for user to install bpf-linker
if [ "${YES}" == "-y" ]; then
echo "cargo install bpf-linker into /usr/local/bin"
cargo install --force bpf-linker
mv -f ~/.cargo/bin/bpf-linker /usr/local/bin
else
read -r -p "Install bpf-linker in /usr/local/bin? (mandatory for build) [y/N] " response
case "$response" in
[yY][eE][sS]|[yY]|[oO])
echo "cargo install bpf-linker into /usr/local/bin"
cargo install --force bpf-linker
mv -f ~/.cargo/bin/bpf-linker /usr/local/bin
;;
esac
fi

export $(grep -h '^ID' /etc/*-release)

Expand Down

0 comments on commit 2097dc1

Please sign in to comment.