mirror of https://framagit.org/kyodev/kyopages.git
maj
This commit is contained in:
parent
b00075c248
commit
7672bd2b37
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.0.2
|
||||
version=0.3.0
|
||||
date="07/2017"
|
||||
projet="simpledebian"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues"
|
||||
|
@ -158,6 +158,7 @@ get_distro() { # thanks neofetch
|
|||
[[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
|
||||
[[ -z "${distro// }" ]] && distro="$(awk -F '=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
||||
fi
|
||||
# for debian, add version
|
||||
grep -qi 'Debian' /etc/issue && distro="$(echo $distro | sed 's/"//g') $(cat /etc/debian_version)"
|
||||
distro="$(trim_quotes "$distro")"
|
||||
;;
|
||||
|
@ -166,17 +167,30 @@ get_distro() { # thanks neofetch
|
|||
[[ -z "$distro" ]] && distro="$os (Unknown)"
|
||||
}
|
||||
|
||||
|
||||
fi_pastebinit(){
|
||||
pastebinit -b http://markdownshare.com/ -i "$fileOutput"
|
||||
}
|
||||
|
||||
fi__curl(){
|
||||
curl -H "Accept: application/json" -X POST -F "text=<$fileOutput" https://markdownshare.com/create/
|
||||
fi_curl_markdownshare(){
|
||||
[ -e "$1" ] || f__error "fichier $1 inexistant"
|
||||
curl -H "Accept: application/json" -X POST -F "text=<$1" https://markdownshare.com/create/
|
||||
#-A, --user-agent and -e, --referer options
|
||||
#If you wish to allow a post to expire then add an expire= parameter too:
|
||||
#expire=Nh Expire in N hours.
|
||||
#expire=Nd Expire in N days.
|
||||
#-d expire ? ou --data expire
|
||||
}
|
||||
|
||||
fi_curl_pastery(){
|
||||
[ -e "$1" ] || f__error "fichier $1 inexistant"
|
||||
local testCurl
|
||||
# curl -X POST "https://www.pastery.net/api/paste/?title=getInfo&language=markdown" -F file=@$1
|
||||
#curl -X POST "https://www.pastery.net/api/paste/?title=getInfo_$version&language=markdown&duration=$((7*1440))" --data-binary @$1
|
||||
testCurl=$(curl --silent -X POST "https://www.pastery.net/api/paste/?title=getInfo_$version&language=markdown&duration=$((1*1440))" --data-binary @$1)
|
||||
local id=$(echo $testCurl | cut -d '"' -f 4)
|
||||
f__info "\n\n votre paste:" "https://www.pastery.net/$id/"
|
||||
#?api_key=<api_key>
|
||||
#&duration=<duration> en mn, 1 jour par défaut
|
||||
#&title=<title>
|
||||
#&language=<language>
|
||||
#&max_views=<max_views>
|
||||
|
||||
}
|
||||
|
||||
# initialisation
|
||||
|
@ -184,7 +198,7 @@ f__affichage
|
|||
f__architecture || f__error "Architecture non supportée" "vous pouvez contacter contacter $projet $contact pour parfaire le script"
|
||||
fileOutput="getInfo_rapport.md"
|
||||
rcmd=" " # retour ligne markdown
|
||||
f__requis "pastebinit"
|
||||
f__requis "curl"
|
||||
os="$(uname -s)"
|
||||
fileLogs="/var/log/sdeb_getFinfo.log"
|
||||
dateRapport=$(date +"%d %b %Y %H:%M %z")
|
||||
|
@ -192,33 +206,56 @@ dateRapport=$(date +"%d %b %Y %H:%M %z")
|
|||
rm "$fileOutput" &>/dev/null
|
||||
|
||||
echo -e "# getInfo $version\n" > "$fileOutput"
|
||||
echo -e "Rapport au $dateRapport sur $(uname -n)\n" >> "$fileOutput"
|
||||
echo -e "Rapport au $dateRapport sur $(uname -n)" >> "$fileOutput"
|
||||
|
||||
echo -e "## système" >> "$fileOutput"
|
||||
echo -e "\n## système\n" >> "$fileOutput"
|
||||
fi_divers | tee -a "$fileOutput"
|
||||
get_de && echo "DE: $de""$rcmd" | tee -a "$fileOutput"
|
||||
get_distro && echo "distro: $distro""$rcmd" | tee -a "$fileOutput"
|
||||
echo -e "## réseau" >> "$fileOutput"
|
||||
fi_carte_reseau && echo "$netcards""$rcmd" | tee -a "$fileOutput"
|
||||
|
||||
fi__curl
|
||||
echo -e "\n## réseau\n" >> "$fileOutput"
|
||||
echo '```' >> "$fileOutput"
|
||||
fi_carte_reseau && echo "$netcards""$rcmd" | tee -a "$fileOutput"
|
||||
echo '```' >> "$fileOutput"
|
||||
|
||||
#fi_curl_markdownshare "$fileOutput"
|
||||
fi_curl_pastery "$fileOutput"
|
||||
|
||||
echo
|
||||
exit
|
||||
|
||||
{"link":"https://markdownshare.com/view/5b934dde-473e-4d34-b1e4-7d624cedca40",
|
||||
"raw":"https://markdownshare.com/raw/5b934dde-473e-4d34-b1e4-7d624cedca40",
|
||||
"edit":"https://markdownshare.com/edit/af25b45a5b945963223f8aeb773decf8",
|
||||
"delete":"https://markdownshare.com/delete/af25b45a5b945963223f8aeb773decf8",
|
||||
"id":"5b934dde-473e-4d34-b1e4-7d624cedca40",
|
||||
"auth":"af25b45a5b945963223f8aeb773decf8"
|
||||
{
|
||||
"raw":"https://markdownshare.com/raw/b837c09d-d5ec-4d0b-afb8-a01efe31f350",
|
||||
"delete":"https://markdownshare.com/delete/cb43e94336dd5cae2d5b2b8a077f700b",
|
||||
"edit":"https://markdownshare.com/edit/cb43e94336dd5cae2d5b2b8a077f700b",
|
||||
"link":"https://markdownshare.com/view/b837c09d-d5ec-4d0b-afb8-a01efe31f350",
|
||||
"id":"b837c09d-d5ec-4d0b-afb8-a01efe31f350",
|
||||
"auth":"cb43e94336dd5cae2d5b2b8a077f700b"
|
||||
}
|
||||
|
||||
{
|
||||
"id": "ndtrys",
|
||||
"title": "getInfo_0.3.0",
|
||||
"url": "https://www.pastery.net/ndtrys/",
|
||||
"language": "markdown",
|
||||
"duration": 10079
|
||||
}
|
||||
cut -d '"' -f 4 getInfo_retour
|
||||
|
||||
bug markdownshare:
|
||||
"```" n'est pas interprété en <pre><code>
|
||||
'```' pas interprêté en <pre><code>
|
||||
|
||||
style.css ligne 167
|
||||
pre {
|
||||
padding:10px;
|
||||
margin:0 0px 20px 0px;
|
||||
font-size:0.8em
|
||||
padding:10px;
|
||||
margin:0 0px 20px 0px;
|
||||
font-size:0.8em
|
||||
}
|
||||
|
||||
toc auto markdown:
|
||||
http://ndossougbe.github.io/strapdown/
|
||||
|
||||
à voir:
|
||||
https://www.pastery.net/api/
|
||||
mais license non libre? et pas de depot
|
||||
mais ça marche
|
||||
|
|
Loading…
Reference in New Issue