add prompt

This commit is contained in:
Roy Olav Purser 2024-02-09 20:38:42 +01:00
parent e15d424a38
commit 579487db91
Signed by: roypur
GPG Key ID: 063DAA01D56E28CB
3 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,8 @@ install_basic: systemd scripts bin
cp systemd/vpnclient-wg-basic.service /etc/systemd/system/vpnclient-wg-basic.service
cp scripts/connect_basic.py /snacks/wireguard/scripts/connect_basic.py
cp scripts/inner_basic.sh /snacks/wireguard/scripts/inner_basic.sh
cp scripts/is_root_namespace.py /snacks/wireguard/scripts/is_root_namespace.py
cp scripts/vpn_prompt.sh /etc/profile.d/vpn_prompt.sh
cp bin/vpn /usr/local/bin/vpn
setcap cap_sys_admin,cap_sys_ptrace=ep /usr/local/bin/vpn
chmod -R 755 /snacks/wireguard

View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
import sys
import re
with open("/proc/self/net/dev", "r") as f:
data = f.read()
match = re.search("^enp[0-9a-z]+:", data, re.MULTILINE)
if match is None:
sys.exit(1)
else:
sys.exit(0)

4
scripts/vpn_prompt.sh Normal file
View File

@ -0,0 +1,4 @@
if ! /snacks/wireguard_scripts/is_root_namespace.py
then
export PS1='%F{red}<vpn>%f %n@%m % %c %#'
fi