Skip to content

Instantly share code, notes, and snippets.

@michelve
Last active June 9, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michelve/8b7e373253788c27f03c14abfadd8975 to your computer and use it in GitHub Desktop.
Save michelve/8b7e373253788c27f03c14abfadd8975 to your computer and use it in GitHub Desktop.
Helps install dnsmasq, filezilla and mysql
#!/usr/bin/env bash
USER=$(logname)
osascript -e 'display notification "Fixing PilotKit files and core." with title "PilotKit"'
# fix scripts permissions
sudo chmod 777 /Applications/PilotKit/core/shell/repair/repair.sh
sudo chown -R "${USER}":admin /Applications/PilotKit
sudo chmod 775 /Applications/PilotKit
sudo chmod 777 /Applications/PilotKit/core/setup.php
sudo chmod 777 /Applications/PilotKit/install/lib/setup_server.php
sudo chmod -R 777 /Applications/PilotKit/cache
sudo chmod 777 /Applications/PilotKit/cache/temp
sudo chmod 777 /Applications/PilotKit/cache/tasks
sudo chmod 777 /Applications/PilotKit/cache/backups
sudo chmod 777 /Applications/PilotKit/Sites
sudo chmod 777 /Applications/PilotKit/Sites/htdocs
sudo chmod 777 /Applications/PilotKit/Sites/wp
sudo chmod 777 /Applications/PilotKit/Sites/wp/themes
sudo chmod 777 /Applications/PilotKit/Sites/wp/lang
sudo chmod 777 /Applications/PilotKit/Sites/logs
sudo chmod 777 /Applications/PilotKit/Sites/config/apache
sudo chmod -R 777 /Applications/PilotKit/Sites/config/apache/*
sudo chmod 777 /etc/hosts
sudo chmod 777 /Applications/PilotKit/core/shell/
sudo chmod -R 777 /Applications/PilotKit/core/shell/
sudo chmod 777 /private/etc/apache2/extra/httpd-vhosts.conf
sudo chmod 777 /Applications/PilotKit/core/shell/OSX/restart_apache.sh
sudo chmod 777 /Applications/PilotKit/core/shell/repair/repair.sh
osascript -e 'display notification "Fixed PilotKit files and core." with title "PilotKit"'
exit 0
<VirtualHost *:80>
# Do not edit this file.
ServerAdmin support@pilotkit.co
DocumentRoot /Applications/PilotKit/
ServerName pilotkit.dev
ServerAlias pilotkit.dev.*.xip.io
DirectoryIndex index.php index.html index.htm
Options All -Indexes
AddDefaultCharset UTF-8
DefaultLanguage en-US
Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
#Pages
ErrorDocument 401 /core/views/html/errors/401.php
ErrorDocument 403 /core/views/html/errors/403.php
ErrorDocument 404 /core/views/html/errors/404.php
ErrorDocument 500 /core/views/html/errors/500.php
ErrorDocument 503 /core/views/html/errors/503.php
<filesMatch ".(html|htm|php|js|css|jpg|png)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
LogLevel error
ErrorLog /Applications/PilotKit/Sites/logs/php_error.log
CustomLog /Applications/PilotKit/Sites/logs/apache_error.log combined
<FilesMatch "^.*(error_log|config\.php|php.ini|\.[hH][tT][aApP].*)$">
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</FilesMatch>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin support@pilotkit.co
DocumentRoot /Applications/PilotKit/Sites/phpmyadmin/
ServerName phpmyadmin.local
ServerAlias *.phpmyadmin.local phpmyadmin.local.*.xip.io
</VirtualHost>
<VirtualHost *:80>
ServerAdmin support@pilotkit.co
DocumentRoot /Applications/PilotKit/manage/adminer/
ServerName adminer.local
ServerAlias *.adminer.local adminer.local.*.xip.io
</VirtualHost>
<Directory "/Applications/PilotKit/Sites/htdocs">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Applications/PilotKit/Sites/htdocs/%3/%2/%1"
ServerAlias *.*.*.dev
UseCanonicalName Off
<FilesMatch "^.*(error_log|config\.php|php.ini|\.[hH][tT][aApP].*)$">
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</FilesMatch>
Options All
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/Applications/PilotKit/Sites/htdocs/%2/%1"
ServerAlias *.*.dev
UseCanonicalName Off
<FilesMatch "^.*(error_log|config\.php|php.ini|\.[hH][tT][aApP].*)$">
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</FilesMatch>
Options All
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/Applications/PilotKit/Sites/htdocs/%1"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
<FilesMatch "^.*(error_log|config\.php|php.ini|\.[hH][tT][aApP].*)$">
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</FilesMatch>
Options All
</Virtualhost>
#!/bin/bash
# bash <(curl -Ls https://git.io/vHP1s)
clear
echo "---------------------------------------"
echo "Enter your computer password: ..."
echo "---------------------------------------"
clear
me=$(logname)
if ! command -v brew >/dev/null; then
echo "Installing Homebrew ..."
curl -fsS \
'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
else
echo "Homebrew already installed. Skipping ..."
fi
echo "Updating Homebrew formulas ..."
brew update
echo "Installing Homebrew packages ..."
if brew ls --versions dnsmasq > /dev/null; then
echo "Skipping dnsmasq package ..."
else
echo "Installing dnsmasq package ..."
brew install dnsmasq
fi
echo "Configuring apache ..."
sudo mkdir -p "/etc/resolver"
sudo sh -c "echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf"
sudo sh -c "echo 'nameserver 127.0.0.1\ndomain dev\nsearch_order 1' > /etc/resolver/dev"
sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
brew services start dnsmasq
brew services restart dnsmasq
echo "Restarting apache ..."
curl -o ~/.pilotkit/pilotkit.conf https://gist.githubusercontent.com/michelve/8b7e373253788c27f03c14abfadd8975/raw/4a97647c038c540126d53f066df020cbbcfb8ee0/pilotkit.conf
cp -fr ~/.pilotkit/pilotkit.conf /Applications/PilotKit/Sites/config/apache/pilotkit.conf
sudo chmod 777 /Applications/PilotKit/Sites/config/apache/pilotkit.conf
sudo apachectl restart
echo "Installing apps ..."
app_list=(launchrocket filezilla)
for item in "${app_list[@]}"; do
brew cask info "${item}" | grep --quiet 'Not installed' && brew cask install "${item}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment