-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
user='pqvfumqbqp' | ||
password='ioweb123GUIweb' | ||
|
||
apt install samba | ||
cat <<EOF | sudo tee /etc/samba/smb.conf | ||
[global] | ||
usershare allow guests = no | ||
# Does not work. Somehow hangs indefinitely during systemctl restart smbd nmbd | ||
#bind interfaces only = yes | ||
#interfaces = lo | ||
[test-share] | ||
path = /tmp/smbshare | ||
browsable = yes | ||
guest ok = no | ||
read only = yes | ||
create mask = 0755 | ||
EOF | ||
|
||
# Unfortunately, we need a user because anonymous/guest login does not seem to work with smbprotocol: | ||
# https://github.com/jborean93/smbprotocol/issues/168 | ||
adduser --quiet --no-create-home --disabled-password --disabled-login "$user" | ||
smbpasswd -a "$user" -w "$password" # type password here ioweb123GUIweb | ||
|
||
systemctl restart smbd nmbd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import math | ||
import socket | ||
import sys | ||
import time | ||
from contextlib import closing | ||
|
||
timeout = int(sys.argv[2]) if len(sys.argv) > 2 else 60 | ||
|
||
t0 = time.time() | ||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: | ||
n = max(1, int(math.ceil(timeout / 5))) | ||
for i in range(n): | ||
if sock.connect_ex(("127.0.0.1", int(sys.argv[1]))) == 0: | ||
print(f"Weed port opened after {time.time() - t0:.1f} s.") | ||
sys.exit(0) | ||
# Do not wait after the last test. | ||
if i < n - 1: | ||
time.sleep(5) | ||
sys.exit(1) |