Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cloaks.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ GOTO intro
REM Let the user know the options they have
ECHO Type one of the following (use the number)
ECHO 1) Install (Install Cloaks+ on this computer)
ECHO 2) UnInstall (Remove Cloaks+ from the computer)
ECHO 2) Uninstall (Remove Cloaks+ from the computer)
ECHO 3) Exit (Close this application)
REM Take in user input and store it as %OPTION%
SET /p choice=Type the number representing an option:

if '%choice%'=='' (
ECHO "%choice%" is not valid please try again
ECHO "%choice%" is not valid, please try again.
GOTO options
)
if '%choice%'=='1' GOTO install
Expand All @@ -37,19 +37,19 @@ GOTO intro

:permissions
REM This attempts to add a registry key (This will fail without admin rights)
REM the key already exists so will not be affected
REM The key already exists so it will not be affected
REG ADD HKLM /F>nul 2>&1
if %ERRORLEVEL% == 0 (
REM The user has admin permissions and can continue
GOTO options
) else (
REM The user does not have admin perms give them an error message
REM The user does not have admin permissions, give them an error message
ECHO ---------------------------------------------------------
ECHO NO ADMIN PERMISSIONS
ECHO ---------------------------------------------------------
ECHO You did not run this with Admin permissions please run
ECHO it again but with Admin permission. To do so right click
ECHO this file and click "Run as administrator"
ECHO You did not run this with Admin permissions, please run
ECHO it again but with Admin permissions. To do so right click
ECHO this file and click "Run as administrator".
REM Pausing execution so the user can read the message
PAUSE
EXIT
Expand All @@ -63,7 +63,7 @@ GOTO intro
ECHO 159.203.120.188 s.optifine.net # INSERTED BY CLOAKS+ >> "%TEMP_HOSTS_FILE%"
REM Replace the Hosts file with the Temp file
COPY /b/v/y "%TEMP_HOSTS_FILE%" "%HOSTS_FILE%"
ECHO Install Complete
ECHO Install has been completed
REM Pausing execution so the user can read the message
PAUSE
EXIT
Expand All @@ -74,7 +74,7 @@ GOTO intro
FINDSTR /V "159.203.120.188 s.optifine.net # INSERTED BY CLOAKS+" "%HOSTS_FILE%" > "%TEMP_HOSTS_FILE%"
REM Replace the Hosts file with the Temp file
COPY /b/v/y "%TEMP_HOSTS_FILE%" "%HOSTS_FILE%"
ECHO UnInstall Complete
ECHO Uninstall has been completed
REM Pausing execution so the user can read the message
PAUSE
EXIT
16 changes: 8 additions & 8 deletions cloaks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

# The path to the linux host file
HOSTS_FILE=/etc/hosts
# The IP address for cloaks+
# The IP address for Cloaks+
IP="159.203.120.188"
# The domain to redirect to cloaks+
# The domain to redirect to Cloaks+
REDIRECT_DOMAIN="s.optifine.net"
# The value to be inserted into the hosts file
INSERT_VALUE="$IP $REDIRECT_DOMAIN"
# The argument provided by the user
OPTION=${1?You need to provide an option! please provide --install or --uninstall as an argument}
OPTION=${1?You need to provide an option! Please provide --install or --uninstall as an argument.}

if [ "$OPTION" = "--install" ]; then
if grep -q "$INSERT_VALUE" "$HOSTS_FILE"; then
Expand All @@ -20,21 +20,21 @@ if [ "$OPTION" = "--install" ]; then
if grep -q "$INSERT_VALUE" "$HOSTS_FILE"; then
echo "Cloaks+ was successfully installed";
else
echo "Failed to install cloaks+"
echo "Failed to install Cloaks+."
fi
fi
elif [ "$OPTION" = "--uninstall" ]; then
if grep -q "$INSERT_VALUE" "$HOSTS_FILE"; then
echo "Removing cloaks+"
echo "Removing Cloaks+"
sudo sed -i".bak" "/$INSERT_VALUE/d" $HOSTS_FILE
if grep -q "$INSERT_VALUE" "$HOSTS_FILE"; then
echo "Failed to remove cloaks+";
echo "Failed to remove Cloaks+";
else
echo "Successfully removed cloaks+"
echo "Successfully removed Cloaks+"
fi
else
echo "Cloaks+ is not installed 1"
fi
else
echo "Unknown option please use '--install' or '--uninstall'."
echo "Unknown option, please use '--install' or '--uninstall'."
fi