-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss_push.sh
79 lines (61 loc) · 1.34 KB
/
rss_push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
config=$(cat ./config.txt)
file=$(printf "$1" | sed 's/\.md$//' | sed 's/^\.\///')
url=$(printf "$config" | awk 'gsub(/^url:/,"")');
prime_folder=$(printf "$config" | awk 'gsub(/^prime_folder:/,"")');
css_file=$(printf "$config" | awk 'gsub(/^css_file:/,"")');
css_upload_folder=$(printf "$config" | awk 'gsub(/^css_upload_folder:/,"")');
post=$(printf "$config" | awk 'gsub(/^post:/,"")');
ftp=$(printf "$config" | awk 'gsub(/^ftp:/,"")');
user=$(printf "$config" | awk 'gsub(/^user:/,"")');
prime_folder_cmd=""
prime_cd_cmd=""
prime_mkdir=""
if [ "$prime_folder" != "" ]; then
prime_folder_cmd="lcd $prime_folder"
prime_cd_cmd="cd $prime_folder"
prime_mkdir="mkdir $prime_folder"
fi
read -s -p "ftp_password: " pass
printf "\n\n"
if [ "$1" == "" ]; then
#upload only index.xml/html listing and other assets
ftp -n <<EOF
open $ftp
user $user $pass
cd public_html
cd $css_upload_folder
lcd static
put $css_file
cd /public_html
$prime_mkdir
$prim_cd_cmd
$prime_folder_cmd
mkdir "$post"
cd "$post"
lcd "$post"
put index.xml
put index.html
EOF
else
ftp -n -vvv <<EOF
open $ftp
user $user $pass
cd public_html
cd $css_upload_folder
lcd static
put $css_file
cd /public_html
$prime_mkdir
$prim_cd_cmd
$prime_folder_cmd
mkdir "$post"
cd "$post"
lcd "$post"
put index.xml
put index.html
mkdir "$file"
cd "$file"
lcd "$file"
put index.html
EOF
fi