updated install script
This commit is contained in:
@@ -13,6 +13,9 @@ echo "It will create a new user called danbooru which will run the Danbooru"
|
|||||||
echo "processes. It will download the latest copy and install it in"
|
echo "processes. It will download the latest copy and install it in"
|
||||||
echo "/var/www/danbooru."
|
echo "/var/www/danbooru."
|
||||||
echo
|
echo
|
||||||
|
echo "It is mostly automated but you will receive some prompts when installing"
|
||||||
|
echo "Passenger towards the end of the script."
|
||||||
|
echo
|
||||||
echo -n "Enter the hostname for this server (ex: danbooru.donmai.us): "
|
echo -n "Enter the hostname for this server (ex: danbooru.donmai.us): "
|
||||||
read hostname
|
read hostname
|
||||||
|
|
||||||
@@ -76,10 +79,16 @@ chmod +x,g-w /etc/init.d/nginx
|
|||||||
update-rc.d -f nginx defaults
|
update-rc.d -f nginx defaults
|
||||||
mkdir -p /opt/nginx/sites
|
mkdir -p /opt/nginx/sites
|
||||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.conf > /opt/nginx/conf/nginx.conf
|
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.conf > /opt/nginx/conf/nginx.conf
|
||||||
|
mkdir -p /opt/nginx/conf/sites
|
||||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /opt/nginx/conf/sites/danbooru.conf
|
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /opt/nginx/conf/sites/danbooru.conf
|
||||||
sed -i -e 's/HOSTNAME/$hostname/g' /opt/nginx/conf/sites/danbooru.conf
|
sed -i -e 's/HOSTNAME/$hostname/g' /opt/nginx/conf/sites/danbooru.conf
|
||||||
/etc/init.d/nginx start
|
/etc/init.d/nginx start
|
||||||
|
|
||||||
|
# Setup danbooru account
|
||||||
|
echo "*************************************************"
|
||||||
|
echo "* Enter a new password for the danbooru account *"
|
||||||
|
echo "*************************************************"
|
||||||
|
passwd danbooru
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "I'm done!"
|
echo "I'm done!"
|
||||||
echo "You should probably set the password for the danbooru account (run passwd danbooru)."
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Post < ActiveRecord::Base
|
|||||||
|
|
||||||
attr_accessor :old_tag_string, :old_parent_id
|
attr_accessor :old_tag_string, :old_parent_id
|
||||||
after_destroy :delete_files
|
after_destroy :delete_files
|
||||||
|
after_destroy :delete_remote_files
|
||||||
after_save :create_version
|
after_save :create_version
|
||||||
after_save :update_parent_on_save
|
after_save :update_parent_on_save
|
||||||
before_save :merge_old_tags
|
before_save :merge_old_tags
|
||||||
@@ -61,6 +62,22 @@ class Post < ActiveRecord::Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
module FileMethods
|
module FileMethods
|
||||||
|
def distribute_files
|
||||||
|
RemoteFileManager.new(file_path).distribute
|
||||||
|
RemoteFileManager.new(real_preview_path).distribute
|
||||||
|
RemoteFileManager.new(ssd_preview_path).distribute if Danbooru.config.ssd_path
|
||||||
|
RemoteFileManager.new(medium_file_path).distribute if has_medium?
|
||||||
|
RemoteFileManager.new(large_file_path).distribute if has_large?
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_remote_files
|
||||||
|
RemoteFileManager.new(file_path).delete
|
||||||
|
RemoteFileManager.new(real_preview_path).delete
|
||||||
|
RemoteFileManager.new(ssd_preview_path).delete if Danbooru.config.ssd_path
|
||||||
|
RemoteFileManager.new(medium_file_path).delete if has_medium?
|
||||||
|
RemoteFileManager.new(large_file_path).delete if has_large?
|
||||||
|
end
|
||||||
|
|
||||||
def delete_files
|
def delete_files
|
||||||
FileUtils.rm_f(file_path)
|
FileUtils.rm_f(file_path)
|
||||||
FileUtils.rm_f(medium_file_path)
|
FileUtils.rm_f(medium_file_path)
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class Upload < ActiveRecord::Base
|
|||||||
generate_resizes(file_path)
|
generate_resizes(file_path)
|
||||||
move_file
|
move_file
|
||||||
post = convert_to_post
|
post = convert_to_post
|
||||||
|
post.distribute_files
|
||||||
if post.save
|
if post.save
|
||||||
update_attributes(:status => "completed", :post_id => post.id)
|
update_attributes(:status => "completed", :post_id => post.id)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user