mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 08:29:59 +00:00
Manage Samba and Netatalk with Webmin (#1217)
* Display status of Samba/Netatalk/vsftp in the footer, with links to Webmin module * Add option to install Webmin and the netatalk2 module
This commit is contained in:
parent
b514440957
commit
65c1b194c5
@ -876,6 +876,8 @@ function installMacproxy {
|
||||
|
||||
# Installs vsftpd (FTP server)
|
||||
function installFtp() {
|
||||
echo
|
||||
echo "Installing packages..."
|
||||
sudo apt-get update && sudo apt-get install vsftpd --assume-yes --no-install-recommends </dev/null
|
||||
|
||||
echo
|
||||
@ -905,11 +907,11 @@ function installSamba() {
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installing dependencies..."
|
||||
echo
|
||||
echo "Installing packages..."
|
||||
sudo apt-get update || true
|
||||
sudo apt-get install samba --no-install-recommends --assume-yes </dev/null
|
||||
echo ""
|
||||
echo
|
||||
echo "Modifying $SAMBA_CONFIG_PATH/smb.conf ..."
|
||||
if [[ `sudo grep -c "server min protocol = NT1" $SAMBA_CONFIG_PATH/smb.conf` -eq 0 ]]; then
|
||||
# Allow Windows XP clients and earlier to connect to the server
|
||||
@ -927,6 +929,38 @@ function installSamba() {
|
||||
sudo smbpasswd -a "$USER"
|
||||
}
|
||||
|
||||
# Installs and configures Webmin
|
||||
function installWebmin() {
|
||||
WEBMIN_PATH="/usr/share/webmin"
|
||||
WEBMIN_MODULE_VERSION="1.0"
|
||||
|
||||
if [ -d "$WEBMIN_PATH" ]; then
|
||||
echo
|
||||
echo "Webmin dir $WEBMIN_PATH already exists."
|
||||
echo "This installation process may overwrite existing software."
|
||||
echo
|
||||
echo "Do you want to proceed with the installation? [y/N]"
|
||||
read -r REPLY
|
||||
if ! [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Installing packages..."
|
||||
sudo apt-get install curl --no-install-recommends --assume-yes </dev/null
|
||||
curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
||||
sudo sh setup-repos.sh
|
||||
rm setup-repos.sh
|
||||
sudo apt-get install webmin --install-recommends
|
||||
echo
|
||||
echo "Downloading and installing Webmin module..."
|
||||
rm netatalk2-wbm.tgz || true
|
||||
wget -O netatalk2-wbm.tgz "https://github.com/Netatalk/netatalk-webmin/releases/download/netatalk2-$WEBMIN_MODULE_VERSION/netatalk2-wbm-$WEBMIN_MODULE_VERSION.tgz" </dev/null
|
||||
sudo /usr/share/webmin/install-module.pl netatalk2-wbm.tgz
|
||||
rm netatalk2-wbm.tgz
|
||||
}
|
||||
|
||||
# updates configuration files and installs packages needed for the OLED screen script
|
||||
function installPiscsiScreen() {
|
||||
if [[ -f "$SECRET_FILE" && -z "$TOKEN" ]] ; then
|
||||
@ -1393,6 +1427,16 @@ function runChoice() {
|
||||
installPackagesStandalone
|
||||
compilePiscsi
|
||||
;;
|
||||
17)
|
||||
echo "Install Webmin"
|
||||
echo "This script will make the following changes to your system:"
|
||||
echo "- Add a 3rd party apt repository"
|
||||
echo "- Install and start the Webmin webapp"
|
||||
echo "- Install the netatalk2 Webmin module"
|
||||
installWebmin
|
||||
echo "Install Webmin - Complete!"
|
||||
echo "The Webmin webapp should now be listening to port 10000 on this system"
|
||||
;;
|
||||
99)
|
||||
echo "Hidden setup mode for running the pi-gen utility"
|
||||
echo "This shouldn't be used by normal users"
|
||||
@ -1426,8 +1470,8 @@ function runChoice() {
|
||||
function readChoice() {
|
||||
choice=-1
|
||||
|
||||
until [ $choice -ge "0" ] && ([ $choice -eq "99" ] || [ $choice -le "16" ]) ; do
|
||||
echo -n "Enter your choice (0-16) or CTRL-C to exit: "
|
||||
until [ $choice -ge "0" ] && ([ $choice -eq "99" ] || [ $choice -le "17" ]) ; do
|
||||
echo -n "Enter your choice (0-17) or CTRL-C to exit: "
|
||||
read -r choice
|
||||
done
|
||||
|
||||
@ -1460,6 +1504,7 @@ function showMenu() {
|
||||
echo "EXPERIMENTAL FEATURES"
|
||||
echo " 15) Share the images dir over AppleShare (requires Netatalk)"
|
||||
echo " 16) Compile PiSCSI binaries"
|
||||
echo " 17) Install Webmin to manage Netatalk and Samba"
|
||||
}
|
||||
|
||||
# parse arguments passed to the script
|
||||
|
@ -113,20 +113,44 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if env["netatalk_configured"] == 1 %}
|
||||
{{ _("The AppleShare server is running. No active connections.") }}
|
||||
{% if env["netatalk_configured"] %}
|
||||
{{ _("Mac AFP file sharing is enabled.") }}
|
||||
{% if env["webmin_configured"] %}
|
||||
<a href="https://{{ env["ip_addr"] }}:10000/netatalk2/" target=\"_blank\">
|
||||
{{ ("Server administration") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ _("Mac AFP file sharing is disabled.") }}
|
||||
{% endif %}
|
||||
{% if env["netatalk_configured"] == 2 %}
|
||||
{{ _("%(value)d active AFP connection", value=(env["netatalk_configured"] - 1)) }}
|
||||
{% elif env["netatalk_configured"] > 2 %}
|
||||
{{ _("%(value)d active AFP connections", value=(env["netatalk_configured"] - 1)) }}
|
||||
</div>
|
||||
<div>
|
||||
{% if env["samba_configured"] %}
|
||||
{{ _("Windows SMB file sharing is enabled.") }}
|
||||
{% if env["webmin_configured"] %}
|
||||
<a href="https://{{ env["ip_addr"] }}:10000/samba/" target=\"_blank\">
|
||||
{{ ("Server administration") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ _("Windows SMB file sharing is disabled.") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
{% if env["ftp_configured"] %}
|
||||
{{ _("FTP file sharing is enabled.") }}
|
||||
{% else %}
|
||||
{{ _("FTP file sharing is disabled.") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
{% if env["macproxy_configured"] %}
|
||||
{{ _("Macproxy is running at %(ip_addr)s (default port 5000)", ip_addr=env['ip_addr']) }}
|
||||
{{ _("Macproxy is running at %(ip_addr)s (default port 5000)", ip_addr=env['ip_addr']) }}
|
||||
{% else %}
|
||||
{{ _("Macproxy is disabled.") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ _("PiSCSI software version:") }} <b>{{ env["version"] }}</b>
|
||||
</div>
|
||||
|
@ -106,7 +106,10 @@ def get_env_info():
|
||||
"image_dir": server_info["image_dir"],
|
||||
"image_root_dir": Path(server_info["image_dir"]).name,
|
||||
"netatalk_configured": sys_cmd.running_proc("afpd"),
|
||||
"samba_configured": sys_cmd.running_proc("smbd"),
|
||||
"ftp_configured": sys_cmd.running_proc("vsftpd"),
|
||||
"macproxy_configured": sys_cmd.running_proc("macproxy"),
|
||||
"webmin_configured": sys_cmd.running_proc("miniserv.pl"),
|
||||
"cd_suffixes": tuple(server_info["sccd"]),
|
||||
"rm_suffixes": tuple(server_info["scrm"]),
|
||||
"mo_suffixes": tuple(server_info["scmo"]),
|
||||
|
Loading…
Reference in New Issue
Block a user