forked from toolboc/psx-pi-smbshare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
89 lines (74 loc) · 3.42 KB
/
setup.sh
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
#!/bin/bash
#
# psx-pi-smbshare setup script
#
# *What it does*
# This script will install and configure an smb share at /share
# It will also compile ps3netsrv from source to allow operability with PS3/Multiman
# It also configures the pi ethernet port to act as dhcp server for connected devices and allows those connections to route through wifi on wlan0
# Finally, XLink Kai is installed for online play.
#
# *More about the network configuration*
# This configuration provides an ethernet connected PS2 or PS3 a low-latency connection to the smb share running on the raspberry pi
# The configuration also allows for outbound access from the PS2 or PS3 if wifi is configured on the pi
# This setup should work fine out the box with OPL and multiman
# Per default configuration, the smbserver is accessible on 192.168.2.1
# Update packages
sudo apt-get -y update
sudo apt-get -y upgrade
# Ensure basic tools are present
sudo apt-get -y install screen wget git curl coreutils
# Install and configure Samba
sudo apt-get install -y samba samba-common-bin
wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/samba-init.sh -O /home/pi/samba-init.sh
chmod 755 /home/pi/samba-init.sh
sudo cp /home/pi/samba-init.sh /usr/local/bin
sudo mkdir -m 1777 /share
# Install ps3netsrv
sudo rm /usr/local/bin/ps3netsrv++
sudo apt-get install -y git gcc
git clone https://github.com/dirkvdb/ps3netsrv--.git
cd ps3netsrv--
git submodule update --init
make CXX=g++
sudo cp ps3netsrv++ /usr/local/bin
# Install wifi-to-eth route settings
sudo apt-get install -y dnsmasq
wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/wifi-to-eth-route.sh -O /home/pi/wifi-to-eth-route.sh
chmod 755 /home/pi/wifi-to-eth-route.sh
# Install setup-wifi-access-point settings
sudo apt-get install -y hostapd bridge-utils
wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/setup-wifi-access-point.sh -O /home/pi/setup-wifi-access-point.sh
chmod 755 /home/pi/setup-wifi-access-point.sh
# Remove old XLink Kai Repo if present
sudo rm -rf /etc/apt/sources.list.d/teamxlink.list
# Set up teamxlink repository and install XLink Kai
sudo curl https://repo.teamxlink.co.uk/debian/KEY.asc --create-dirs -o /usr/share/keyrings/teamxlink.asc
echo 'deb [signed-by=/usr/share/keyrings/teamxlink.asc] https://repo.teamxlink.co.uk/raspbian/ /' | sudo tee /etc/apt/sources.list.d/teamxlink.list
sudo apt-get update
sudo apt-get install xlinkkai
# Write XLink Kai launch script
cat <<'EOF' > /home/pi/launchkai.sh
echo "Checking for XLink Kai updates"
sudo apt-get install xlinkkai -y
echo "Launching XLink Kai"
while true; do
screen -dmS kai kaiengine
sleep 5
done
EOF
chmod 755 /home/pi/launchkai.sh
# Install USB automount settings
wget https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/automount-usb.sh -O /home/pi/automount-usb.sh
chmod 755 /home/pi/automount-usb.sh
sudo /home/pi/automount-usb.sh
# Set samba-init + ps3netsrv, wifi-to-eth-route, setup-wifi-access-point, and XLink Kai to run on startup
{ echo -e "@reboot sudo bash /usr/local/bin/samba-init.sh\n@reboot sudo bash /home/pi/wifi-to-eth-route.sh && sudo bash /home/pi/setup-wifi-access-point.sh\n@reboot bash /home/pi/launchkai.sh"; } | crontab -u pi -
# Start services
sudo /usr/local/bin/samba-init.sh
sudo /home/pi/wifi-to-eth-route.sh
sudo /home/pi/setup-wifi-access-point.sh
ps3netsrv++ -d /share/
screen -dmS kailauncher /home/pi/launchkai.sh
# Not a bad idea to reboot
sudo reboot