forked from pocketncmichelle/PocketNC_Config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·98 lines (89 loc) · 2.88 KB
/
Copy pathinstall
File metadata and controls
executable file
·98 lines (89 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
if (( $EUID != 0 )); then
echo "Try sudo ./install"
exit
fi
clear
echo '#!/bin/bash' > /usr/bin/PocketNC
echo "linuxcnc $PWD/PocketNC.ini" >> /usr/bin/PocketNC
chown 750 /usr/bin/PocketNC
chmod +x /usr/bin/PocketNC
chmod +x dtc.sh
./dtc.sh
declare mountdir=/mnt/usbdrive
read -p "Would you like to enable windows drag&drop file uploading? (y/n)" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
#Test for inet access to repository.
wget -q --spider http://repos.rcn-ee.net
if [ $? -gt 0 ]; then
#Not online. Try to connect.
echo "Your BBB may need to gather some additional files from the internet."
read -p "Would you like to use the ethernet jack to download them?(y/n)" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Getting IP address..."
dhclient eth0
else
echo "Skipping internet connection."
fi
fi
#check if mount directory exists.
if [ -d $mountdir ]; then
#Check for for existing mount point.
echo "Found existing mount point."
else
echo "Creating mount point to access USB storage."
mkdir -p /mnt/usbdrive
fi
#Now that the mount point is setup, add it to /etc/fstab for auto-mount at boot.
if ! grep -Fq "$mountdir" /etc/fstab
if ! mount | grep -q /mnt/usbdrive;then
mount /dev/sda1 /mnt/usbdrive > /dev/null
fi
then
#Found an existing entry.
echo "Existing mount point entry found in /etc/fstab"
echo " If you are just re-installing PocketNC settings dont worry about it."
echo " Otherwise you will need edit the file by hand to mount"
echo " your storage device to /mnt/usbdrive"
else
echo "Adding auto-mount entry to /etc/fstab"
echo "/dev/sda1 /mnt/usbdrive autofs rw,users,exec,nofail" >> /etc/fstab
fi
#Check for samba, and if needed, install it.
if ! which smbstatus > /dev/null; then
wget -q --spider http://repos.rcn-ee.net
if [ $? -gt 0 ]; then
echo "Samba server not found, unable to continue without downloading it."
exit 1;
else
echo "Updating package lists."
apt-get update
echo "Installing Samba server."
apt-get install samba
#wait for samba server to init.
echo "waiting 10sec for samba to setup..."
sleep 10
fi
if grep -Fxq "[PocketNC]" /etc/samba/smb.conf
then
echo "PocketNC networking share previously setup, skipped."
else
echo "Creating PocketNC network share."
echo "[PocketNC]" >> /etc/samba/smb.conf
echo "comment = PocketNC G-Code Files" >> /etc/samba/smb.conf
echo "path = /mnt/usbdrive" >> /etc/samba/smb.conf
echo "browseable = yes" >> /etc/samba/smb.conf
echo "writeable = yes" >> /etc/samba/smb.conf
echo "guest ok = yes" >> /etc/samba/smb.conf
echo "read only = no" >> /etc/samba/smb.conf
fi
fi
echo "Network file sharing (aka Drive-mapping) should now be available to any"
echo " computers the BBB is networked with."
else
echo "Sharing skipped."
fi
echo "To start LinuxCNC preconfigured for PocketNC, simply type:"
echo " PocketNC"