2015-03-04 11:29:10 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Paths and settings
|
|
|
|
#
|
|
|
|
TARGET_D="webroot/imgd.php"
|
|
|
|
TARGET_P="webroot/imgp.php"
|
|
|
|
TARGET_S="webroot/imgs.php"
|
|
|
|
NEWLINES="\n\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Specify the utilities used
|
|
|
|
#
|
|
|
|
ECHO="printf"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Main, start by checking basic usage
|
|
|
|
#
|
|
|
|
if [ $# -gt 0 ]
|
|
|
|
then
|
|
|
|
$ECHO "Usage: $0\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Print out details on cache-directory
|
|
|
|
#
|
|
|
|
$ECHO "Creating '$TARGET_D', '$TARGET_P' and '$TARGET_S' by combining the following files:"
|
|
|
|
$ECHO "\n"
|
|
|
|
$ECHO "\n webroot/img_header.php"
|
2016-08-08 09:29:26 +02:00
|
|
|
$ECHO "\n defines.php"
|
|
|
|
$ECHO "\n functions.php"
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "\n CHttpGet.php"
|
|
|
|
$ECHO "\n CRemoteImage.php"
|
|
|
|
$ECHO "\n CWhitelist.php"
|
2015-09-01 16:46:44 +02:00
|
|
|
$ECHO "\n CAsciiArt.php"
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "\n CImage.php"
|
2015-12-07 15:31:41 +01:00
|
|
|
$ECHO "\n CCache.php"
|
2016-08-08 09:29:26 +02:00
|
|
|
$ECHO "\n CFastTrackCache.php"
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "\n webroot/img.php"
|
|
|
|
$ECHO "\n"
|
|
|
|
$ECHO "\n'$TARGET_D' is for development mode."
|
|
|
|
$ECHO "\n'$TARGET_P' is for production mode (default mode)."
|
|
|
|
$ECHO "\n'$TARGET_S' is for strict mode."
|
|
|
|
$ECHO "\n"
|
|
|
|
|
|
|
|
$ECHO "\nPress enter to continue. "
|
|
|
|
read answer
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create the $TARGET_? files
|
|
|
|
#
|
|
|
|
cat webroot/img_header.php > $TARGET_P
|
|
|
|
cat webroot/img_header.php | sed "s|//'mode' => 'production',|'mode' => 'development',|" > $TARGET_D
|
2015-10-21 00:13:56 +02:00
|
|
|
cat webroot/img_header.php | sed "s|//'mode' => 'production',|'mode' => 'strict',|" > $TARGET_S
|
2015-03-04 11:29:10 +01:00
|
|
|
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2016-08-08 09:29:26 +02:00
|
|
|
tail -n +2 defines.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
|
|
|
tail -n +2 functions.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-03-04 11:29:10 +01:00
|
|
|
tail -n +2 CHttpGet.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
|
|
|
tail -n +2 CRemoteImage.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-09-01 16:46:44 +02:00
|
|
|
tail -n +2 CWhitelist.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-09-01 16:46:44 +02:00
|
|
|
tail -n +2 CAsciiArt.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
|
|
|
tail -n +2 CImage.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-12-07 15:31:41 +01:00
|
|
|
tail -n +2 CCache.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2016-08-08 09:29:26 +02:00
|
|
|
tail -n +2 CFastTrackCache.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-03-04 11:29:10 +01:00
|
|
|
tail -n +2 webroot/img.php | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
$ECHO "$NEWLINES" | tee -a $TARGET_D $TARGET_P $TARGET_S > /dev/null
|
|
|
|
|
2015-10-21 00:13:56 +02:00
|
|
|
php -w $TARGET_S > tmp && mv tmp $TARGET_S
|
|
|
|
|
2015-03-04 11:29:10 +01:00
|
|
|
$ECHO "\nDone."
|
|
|
|
$ECHO "\n"
|
|
|
|
$ECHO "\n"
|