Final commit for Samba? One can hope.

This commit is contained in:
nagumii 2025-01-29 18:51:25 +02:00
parent 93f086d66c
commit c8e5fbd8db
4 changed files with 15 additions and 11 deletions

View file

@ -38,7 +38,7 @@ pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beauti
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
echo "Adding Samba configuration..." # add it manually so we're always using the most up to date smb.conf file template from the package
echo -e "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd
echo "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd
echo "Setting MOTD..."
mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak

View file

@ -13,7 +13,7 @@ install() {
output=$($package_dir/$1.sh -i)
install_status=$? # Capture the exit status of the eval command
user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present
#output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
if [ $install_status -eq 0 ]; then # if the installation was successful
dialog --no-collapse --colors --title "$title" --beep --msgbox "\ZuInstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks
@ -23,7 +23,7 @@ install() {
}
uninstall() {
dialog --no-collapse --title "$title" --yesno "\nUninstall $1\n\nProceed?" 10 40
dialog --no-collapse --title "$title" --yesno "\nUninstall $($package_dir/$1.sh -N)\n\nProceed?" 10 40
if [ $? -eq 1 ]; then #if cancel/no
return 1
fi
@ -31,7 +31,7 @@ uninstall() {
output=$(eval "$package_dir/$1.sh -u 2>&1 | tee /dev/tty")
install_status=$? # Capture the exit status of the eval command
user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present
#output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output
if [ $install_status -eq 0 ]; then # if the installation was successful
dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo -e "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks
else
@ -40,7 +40,7 @@ uninstall() {
}
upgrade() {
dialog --no-collapse --title "$title" --yesno "\nUpgrade $1\n\nProceed?" 10 40
dialog --no-collapse --title "$title" --yesno "\nUpgrade $($package_dir/$1.sh -N)\n\nProceed?" 10 40
if [ $? -eq 1 ]; then #if cancel/no
return 1
fi
@ -67,7 +67,7 @@ package_intro() {
$(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\
$(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\
\n\
$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo " \Zunot installed\Zn")\n\
$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\
$(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\
$(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\
An internet connection is required for installation.\n\
@ -105,11 +105,11 @@ package_menu() {
"Install") install $1 ;;
"Uninstall") uninstall $1 ;;
"Upgrade") upgrade $1 ;;
"Enable service") eval "$package_dir/$1.sh -e" ;;
"Disable service") eval "$package_dir/$1.sh -d" ;;
"Stop service") eval "$package_dir/$1.sh -s" ;;
"Start/restart service") eval "$package_dir/$1.sh -r" ;;
"Get service status") dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;;
"Enable service") echo "Enabling service..." && eval "$package_dir/$1.sh -e" ;;
"Disable service") echo "Disabling service..." && eval "$package_dir/$1.sh -d" ;;
"Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;;
"Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;;
"Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;;
"Back to software manager") break ;;
esac
done

View file

@ -85,7 +85,9 @@ $launch" | sudo tee /usr/local/bin/contact > /dev/null
# uninstall script
uninstall() {
rm -rf $location
echo "Removed \`$location\`."
rm /usr/local/bin/contact
echo "Removed \`contact\` shortcut."
echo "user_message: All files removed."
exit 0 # should be `exit 1` if the installation failed
}

View file

@ -93,7 +93,9 @@ uninstall() {
systemctl stop $service_name
rm /etc/systemd/system/$service_name.service
systemctl daemon-reload
echo "Disabled and removed \`$service_name\` service."
rm -rf $location
echo "Removed \`$location\`."
echo "user_message: Service removed, all files deleted."
exit 0
}