Commit 24d7c34d authored by Rene Hadler's avatar Rene Hadler

pve-usb-automount: max_files var can now be set via conf file, defaults to 3

parent 5e51ce5e
[MAIN]
MAX_FILES = 3
\ No newline at end of file
pve5-usb-automount (0.3-1) precise; urgency=low
* Added config file to adjust max_files var
-- Rene Hadler <rene.hadler@iteas.at> Thu, 24 Oct 2019 9:06:07 +0100
pve5-usb-automount (0.2-3) precise; urgency=low
* is_mountpoint option added
......
......@@ -4,9 +4,10 @@
dh $@
override_dh_auto_install:
mkdir -p debian/pve5-usb-automount/etc
mkdir -p debian/pve5-usb-automount/etc/pve-usb-automount
mkdir -p debian/pve5-usb-automount/usr/local/bin
cp ../../etc/rc.local debian/pve5-usb-automount/etc/.
cp ../../etc/pve-usb-automount/main.conf debian/pve5-usb-automount/etc/pve-usb-automount/.
cp ../../usr/local/bin/mount_drive.py debian/pve5-usb-automount/usr/local/bin/.
cp ../../usr/local/bin/umount_drive.py debian/pve5-usb-automount/usr/local/bin/.
......
......@@ -3,6 +3,12 @@
import sys
import subprocess
import configparser
config = configparser.ConfigParser()
config.read('/etc/pve-usb-automount/main.conf')
MAX_FILES = config.get("MAIN", "MAX_FILES", fallback=3)
dev = sys.argv[1]
devs = dev.split("/")
......@@ -12,4 +18,4 @@ mountpoint = sys.argv[2]
mountnames = mountpoint.split("/")
mountname = mountnames[len(mountnames)-1]
subprocess.Popen("pvesm add dir 'usb-%s' -path '%s' -maxfiles 0 -content vztmpl,iso,backup -is_mountpoint 1" % (devname, mountpoint), stdout=subprocess.PIPE, shell=True)
subprocess.Popen("pvesm add dir 'usb-%s' -path '%s' -maxfiles %s -content vztmpl,iso,backup -is_mountpoint 1" % (devname, mountpoint, MAX_FILES), stdout=subprocess.PIPE, shell=True)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (c) Rene Hadler, iteas IT Services GmbH
# support@iteas.at
# www.iteas.at
#
from pyrad.client import Client
from pyrad.dictionary import Dictionary
import random
import socket
import sys
import pyrad.packet
def SendPacket(srv, req):
try:
srv.SendPacket(req)
except pyrad.client.Timeout:
print("RADIUS server does not reply")
sys.exit(1)
except socket.error as error:
print("Network error: " + error[1])
sys.exit(1)
srv = Client(server="localhost", secret=b"Kah3choteereethiejeimaeziecumi", dict=Dictionary("/usr/share/freeradius/dictionary"))
req = srv.CreateAcctPacket(User_Name="wichert")
req["NAS-IP-Address"] = "192.168.1.10"
req["NAS-Port"] = 0
req["NAS-Identifier"] = "trillian"
req["Called-Station-Id"] = "00-04-5F-00-0F-D1"
req["Calling-Station-Id"] = "00-01-24-80-B3-9C"
req["Framed-IP-Address"] = "10.0.0.100"
print("Sending accounting start packet")
req["Acct-Status-Type"] = "Start"
SendPacket(srv, req)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment