Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[package]
name = "akon"
version = "1.2.0"
version = "1.2.1"
edition = "2021"
authors = ["vcwild"]
description = "A CLI tool for managing VPN connections with OpenConnect"
Expand Down
2 changes: 1 addition & 1 deletion akon-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "akon-core"
version = "1.2.0"
version = "1.2.1"

[features]
default = []
Expand Down
33 changes: 24 additions & 9 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,34 @@ set -e
# Post-installation script for akon
# Configures passwordless sudo for required commands

OPENCONNECT_PATH=$(command -v openconnect)
PKILL_PATH=$(command -v pkill)
KILL_PATH=$(command -v kill || echo "/usr/bin/kill")
# Find command paths
OPENCONNECT_PATH=$(command -v openconnect 2>/dev/null || echo "")
PKILL_PATH=$(command -v pkill 2>/dev/null || echo "")
KILL_PATH=$(command -v kill 2>/dev/null || echo "/usr/bin/kill")

# Verify paths exist
if [ -z "$OPENCONNECT_PATH" ]; then
echo "Warning: openconnect not found. Please install it: sudo apt install openconnect"
OPENCONNECT_PATH="/usr/sbin/openconnect"
fi

if [ -z "$PKILL_PATH" ]; then
PKILL_PATH="/usr/bin/pkill"
fi

if [ ! -f "$KILL_PATH" ]; then
KILL_PATH="/usr/bin/kill"
fi

# Create sudoers.d file for akon
SUDOERS_FILE="/etc/sudoers.d/akon"

cat > "$SUDOERS_FILE" << EOF
# Allow all users to run akon-required commands without password
# This file is automatically managed by the akon package
ALL ALL=(ALL) NOPASSWD: $OPENCONNECT_PATH
ALL ALL=(ALL) NOPASSWD: $PKILL_PATH
ALL ALL=(ALL) NOPASSWD: $KILL_PATH
ALL ALL=(ALL) NOPASSWD: $OPENCONNECT_PATH *
ALL ALL=(ALL) NOPASSWD: $PKILL_PATH *
ALL ALL=(ALL) NOPASSWD: $KILL_PATH *
EOF

# Set proper permissions on sudoers file
Expand All @@ -31,9 +46,9 @@ fi

echo "akon has been installed successfully!"
echo "The following commands are now available without sudo password:"
echo " - openconnect"
echo " - pkill"
echo " - kill"
echo " - openconnect ($OPENCONNECT_PATH)"
echo " - pkill ($PKILL_PATH)"
echo " - kill ($KILL_PATH)"
echo ""
echo "Run 'akon --help' to get started."

Expand Down
33 changes: 24 additions & 9 deletions rpm/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@
# RPM post-installation script for akon
# Configures passwordless sudo for required commands

OPENCONNECT_PATH=$(command -v openconnect)
PKILL_PATH=$(command -v pkill)
KILL_PATH=$(command -v kill || echo "/usr/bin/kill")
# Find command paths
OPENCONNECT_PATH=$(command -v openconnect 2>/dev/null || echo "")
PKILL_PATH=$(command -v pkill 2>/dev/null || echo "")
KILL_PATH=$(command -v kill 2>/dev/null || echo "/usr/bin/kill")

# Verify paths exist
if [ -z "$OPENCONNECT_PATH" ]; then
echo "Warning: openconnect not found. Please install it: sudo dnf install openconnect"
OPENCONNECT_PATH="/usr/sbin/openconnect"
fi

if [ -z "$PKILL_PATH" ]; then
PKILL_PATH="/usr/bin/pkill"
fi

if [ ! -f "$KILL_PATH" ]; then
KILL_PATH="/usr/bin/kill"
fi

# Create sudoers.d file for akon
SUDOERS_FILE="/etc/sudoers.d/akon"

cat > "$SUDOERS_FILE" << EOF
# Allow all users to run akon-required commands without password
# This file is automatically managed by the akon package
ALL ALL=(ALL) NOPASSWD: $OPENCONNECT_PATH
ALL ALL=(ALL) NOPASSWD: $PKILL_PATH
ALL ALL=(ALL) NOPASSWD: $KILL_PATH
ALL ALL=(ALL) NOPASSWD: $OPENCONNECT_PATH *
ALL ALL=(ALL) NOPASSWD: $PKILL_PATH *
ALL ALL=(ALL) NOPASSWD: $KILL_PATH *
EOF

# Set proper permissions on sudoers file
Expand All @@ -29,9 +44,9 @@ fi

echo "akon has been installed successfully!"
echo "The following commands are now available without sudo password:"
echo " - openconnect"
echo " - pkill"
echo " - kill"
echo " - openconnect ($OPENCONNECT_PATH)"
echo " - pkill ($PKILL_PATH)"
echo " - kill ($KILL_PATH)"
echo ""
echo "Run 'akon --help' to get started."

Expand Down