11#! /bin/bash
22# Author of the script : powen
33
4+ # Get Arch
5+ ARCH=$( uname -m)
6+ NETMUXD_AVAILABLE_ARCHS=(" x86_64" )
7+ NETMUXD_IS_AVAILABLE=0
8+ NETMUXD_IS_ON=0
9+
410# Check source and permission
511cd " $( dirname " $0 " ) " || exit
612echo " Checking source"
13+ if [[ ! -e " AltServer" ]]; then
14+ curl -L https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-" $ARCH " > AltServer
15+ fi
716if [[ ! -e " AltStore.ipa" ]]; then
8- curl -L https://cdn.altstore.io/file/altstore/apps/altstore/1_4_9 .ipa > AltStore.ipa
17+ curl -L https://cdn.altstore.io/file/altstore/apps/altstore/1_5_1 .ipa > AltStore.ipa
918fi
1019if [[ ! -e " main" ]]; then
1120 wget https://github.com/powenn/AltServer-Linux-ShellScript/raw/main/main
1221fi
22+ if [[ ! -e " netmuxd" && ${NETMUXD_AVAILABLE_ARCHS[*]} =~ ${ARCH} ]]; then
23+ curl -L https://github.com/jkcoxson/netmuxd/releases/download/v0.1.2/netmuxd-" $ARCH " > netmuxd
24+ fi
1325if [[ ! -e " ipa" ]]; then
1426 mkdir ipa
1527fi
2234if [[ " stat AltServer | grep -- '-rw-r--r--'" != " " ]] ; then
2335 chmod +x AltServer
2436fi
37+ if [[ " stat netmuxd | grep -- '-rw-r--r--'" != " " ]] ; then
38+ chmod +x netmuxd
39+ fi
2540
2641# Version
2742LocalVersion=$( sed -n 1p version)
@@ -42,8 +57,10 @@ OPTIONS
4257
4358 i, --Install AltStore or ipa files
4459 Install AltStore or ipa files to your device
45- d, --Restart Daemon mode
46- Restart Daemon mode to refresh apps or AltStore
60+ w, --Switch to wifi Daemode mode (Default using it after launch)
61+ Switch and restart to wifi Daemode mode to refresh apps or AltStore
62+ t, --Switch to usb tethered Daemode mode
63+ Switch and restart to usb tethered Daemode mode to refresh apps or AltStore
4764 e, --Exit
4865 Exit script
4966 h, --Help
89106}
90107
91108# Start script
92- AltServerIcon
109+
110+ # AltServerIcon
93111HELP
94112UpdateNotification
113+ if [[ ${NETMUXD_AVAILABLE_ARCHS[*]} =~ ${ARCH} ]]; then
114+ NETMUXD_IS_AVAILABLE=1
115+ sudo -b -S ./netmuxd
116+ fi
95117
96118./AltServer & > /dev/null &
97119
@@ -102,23 +124,45 @@ while [ $RunScript = 0 ] ; do
102124 case " $option " in
103125
104126 i|--Install-AltStore-or-ipa-files )
127+ export " NETMUXD_IS_ON" =$NETMUXD_IS_ON
105128 ./main
106129 ;;
107- d|--Restart-Daemon-mode )
130+ w|--Switch-to-wifi-Daemon-mode )
131+ if [[ $NETMUXD_IS_AVAILABLE == 1 ]]; then
132+ killall AltServer
133+ sudo killall netmuxd
134+ NETMUXD_IS_ON=1
135+ for job in ` jobs -p`
136+ do
137+ wait $job
138+ done
139+ sudo -b -S ./netmuxd
140+ ./AltServer & > /dev/null &
141+ else
142+ echo " wifi-Daemon-mode is not available for your architecture"
143+ fi
144+ ;;
145+ t|--Switch-to-usb-tethered-Daemode-mode )
108146 killall AltServer
147+ if [[ $NETMUXD_IS_AVAILABLE == 1 ]]; then
148+ sudo killall netmuxd
149+ NETMUXD_IS_ON=0
150+ fi
109151 for job in ` jobs -p`
110152 do
111153 wait $job
112154 done
113-
114155 ./AltServer & > /dev/null &
115156 ;;
116157 e|--Exit )
117158 killall AltServer
159+ if [[ $NETMUXD_IS_AVAILABLE == 1 ]]; then
160+ sudo killall netmuxd
161+ fi
118162 exit
119163 ;;
120164 h|--Help )
121- AltServerIcon
165+ # AltServerIcon
122166 HELP
123167 UpdateNotification
124168 ;;
0 commit comments