23 lines
562 B
Bash
Executable File
23 lines
562 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$EUID" -ne 0 ]
|
|
then echo "Please run as root"
|
|
exit
|
|
fi
|
|
|
|
LOCALIP=$(hostname -I)
|
|
|
|
source .passwd.cfg
|
|
|
|
[ -d "webdir" ] && echo "Old config found. Removing." && rm -r webdir
|
|
|
|
#copy the pre-preseed file and update the passwords from the .passwd.cfg file
|
|
mkdir webdir
|
|
cp input.cfg webdir/preseed.cfg
|
|
sed -i "s/@ROOTHASH/$roothash/g" webdir/preseed.cfg
|
|
sed -i "s/@USERHASH/$userhash/g" webdir/preseed.cfg
|
|
|
|
echo "Starting server. Press CTRL+C to stop."
|
|
echo -e "Local IP address: \e[32m$LOCALIP\e[0m"
|
|
|
|
python3 -m http.server 80 --directory ./webdir |