Complete samba support. Pretty please?

This commit is contained in:
nagumii 2025-01-30 00:09:42 +02:00
parent 464551d0bb
commit 8c5b94da52
5 changed files with 25 additions and 23 deletions

View file

@ -44,21 +44,22 @@ done
# Perform filesystem resize
log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed"
sudo resize2fs /dev/mmcblk1p5
sudo resize2fs /dev/mmcblk1p6
sudo resize2fs /dev/mmcblk1p7
resize2fs /dev/mmcblk1p5
resize2fs /dev/mmcblk1p6
resize2fs /dev/mmcblk1p7
log_message "Resizing filesystem complete"
# allocate swap file
if [ ! -f /swapfile ]; then # check if swap file already exists
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile > /dev/null
sudo swapon /swapfile > /dev/null
log_message "Allocating swap file"
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile > /dev/null
swapon /swapfile > /dev/null
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null
log_message "Swap file allocated."
else
log_message "Swap file already allocated, skipping."
log_message "Swap file already allocated, skipping"
fi
# add RTC support - looks unneeded?

View file

@ -63,8 +63,8 @@ conflicts="" # comma delineated plain-text list of packages with which this pa
# install script
install() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04"
exit 0 # should be `exit 1` if operation failed
}
@ -83,8 +83,8 @@ uninstall() {
#upgrade script
upgrade() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
exit 0 # should be `exit 1` if operation failed
}

View file

@ -63,8 +63,8 @@ conflicts="" # comma delineated plain-text list of packages with which this pa
# install script
install() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt-get install mosquitto-clients -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04"
exit 0 # should be `exit 1` if operation failed
}
@ -81,8 +81,8 @@ uninstall() {
#upgrade script
upgrade() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt upgrade -y mosquitto-clients 2>&1 | tee /dev/tty
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
exit 0 # should be `exit 1` if operation failed
}

View file

@ -63,7 +63,8 @@ conflicts="package name, other package name" # comma delineated plain-text lis
# install script
install() {
# for apt packages, this method allows onscreen output during install:
# DEBIAN_FRONTEND=noninteractive sudo apt-get install mosquitto -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
# DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty || { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
# DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty || { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
echo "user_message: Exit message to user, displayed prominently in post-install"
exit 0 # should be `exit 1` if operation failed
}

View file

@ -51,7 +51,7 @@ EOF
name="Samba File Sharing" # software name
author="Software Freedom Conservancy" # software author - OPTIONAL
description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients." # software description - OPTIONAL (but strongly recommended!)
description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." # software description - OPTIONAL (but strongly recommended!)
URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL
options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr`
launch="" # command to launch software, if applicable
@ -63,9 +63,9 @@ conflicts="" # comma delineated plain-text list of packages with which this pa
# install script
install() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
echo -e "user_message: IMPORTANT: To complete installation, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; }
echo -e "user_message: IMPORTANT: To complete installation, enable the Samba service, run \`sudo smbpasswd -a femto\` to set a Samba password, and restart the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`."
exit 0 # should be `exit 1` if operation failed
}
@ -83,8 +83,8 @@ uninstall() {
#upgrade script
upgrade() {
echo "apt update can take a long while..."
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen
DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty
DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; }
DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; }
exit 0 # should be `exit 1` if operation failed
}