Skip to content

Commit 67f8e5c

Browse files
f76 custom ini install
1 parent 46bfe07 commit 67f8e5c

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/sh -e
2+
3+
. ../../common-script.sh
4+
5+
# Check for required commands
6+
for cmd in find curl unzip stty; do
7+
if ! command_exists "$cmd"; then
8+
printf "%b\n" "${RED}$cmd is not installed.${RC}"
9+
exit 1
10+
fi
11+
done
12+
13+
# Search for possible Fallout compatdata directory structures
14+
printf "%b\n" "${YELLOW}Searching for Fallout 76 compatdata settings in document folders...${RC}"
15+
possible_paths=$(find "$HOME" -type d -path "*/compatdata/1151340/pfx/drive_c/users/steamuser/Documents/My Games/Fallout 76" 2>/dev/null)
16+
17+
if [ -z "$possible_paths" ]; then
18+
printf "%b\n" "${RED}No folders found.${RC}"
19+
exit 1
20+
fi
21+
22+
# Display possible paths and allow selection
23+
printf "%b\n" "Possible folder locations:"
24+
paths_string=""
25+
i=0
26+
IFS='
27+
'
28+
for path in $possible_paths; do
29+
paths_string="$paths_string|$path"
30+
i=$((i + 1))
31+
done
32+
IFS=' '
33+
paths_string="${paths_string#|}"
34+
total=$i
35+
selected=0
36+
37+
print_menu() {
38+
clear
39+
max_display=$((total < 10 ? total : 10))
40+
start=$((selected - max_display / 2))
41+
if [ $start -lt 0 ]; then start=0; fi
42+
if [ $((start + max_display)) -gt $total ]; then start=$((total - max_display)); fi
43+
if [ $start -lt 0 ]; then start=0; fi
44+
45+
printf "%b\n" "Please select the installation path:"
46+
i=0
47+
echo "$paths_string" | tr '|' '\n' | while IFS= read -r path; do
48+
if [ $i -ge $start ] && [ $i -lt $((start + max_display)) ]; then
49+
if [ $i -eq $selected ]; then
50+
printf "> %s\n" "$path"
51+
else
52+
printf " %s\n" "$path"
53+
fi
54+
fi
55+
i=$((i + 1))
56+
done
57+
}
58+
59+
select_path() {
60+
last_selected=-1
61+
62+
while true; do
63+
if [ $last_selected -ne $selected ]; then
64+
print_menu
65+
last_selected=$selected
66+
fi
67+
68+
stty -echo
69+
key=$(dd bs=1 count=1 2>/dev/null)
70+
stty echo
71+
72+
case "$key" in
73+
"$(printf '\033')A" | k)
74+
if [ $selected -gt 0 ]; then
75+
selected=$((selected - 1))
76+
fi
77+
;;
78+
"$(printf '\033')B" | j)
79+
if [ $selected -lt $((total - 1)) ]; then
80+
selected=$((selected + 1))
81+
fi
82+
;;
83+
'')
84+
game_path=$(echo "$paths_string" | cut -d '|' -f $((selected + 1)))
85+
break
86+
;;
87+
esac
88+
done
89+
90+
clear
91+
}
92+
93+
# Use the select_path function
94+
select_path
95+
96+
# Validate the path
97+
if [ ! -d "$game_path" ]; then
98+
printf "%b\n" "${RED}The specified path does not exist.${RC}"
99+
exit 1
100+
fi
101+
102+
# Download the latest release
103+
printf "%b\n" "Downloading the latest custom settings..."
104+
if ! curl -sSLo /tmp/Fallout76Custom.ini https://github.com/ChrisTitusTech/fallout76-configs/releases/latest/download/Fallout76Custom.ini; then
105+
printf "%b\n" "${RED}Failed to download.${RC}"
106+
exit 1
107+
fi
108+
109+
mv /tmp/Fallout76Custom.ini "$game_path/Fallout76Custom.ini"
110+
111+
printf "%b\n" "${GREEN}Settings installed successfully.${RC}"

0 commit comments

Comments
 (0)