Compare commits
16 Commits
v0.2-test
...
update-fea
Author | SHA1 | Date | |
---|---|---|---|
9ad538862e | |||
ee1f89e45f | |||
79f6c09cc9 | |||
b0869a94c9 | |||
a5f84f35de | |||
0b64402f74 | |||
c8d667f5c5 | |||
dc37b6a2da | |||
8890ed1b26 | |||
6b6c9bb368 | |||
7acc61d80d | |||
ecf1281290 | |||
6350241a35 | |||
8d64b3bc9a | |||
6790b17f86 | |||
5a133d0d17 |
@ -55,11 +55,19 @@
|
||||
this.set_lang();
|
||||
})
|
||||
.catch(error => { console.log(error) });
|
||||
},
|
||||
get_version: function() {
|
||||
axios.get('/api/update/get-version', { timeout: 60000 })
|
||||
.then(response => {
|
||||
if(response.data.status) window.current_version = response.data.current_version
|
||||
})
|
||||
.catch(error => { console.log(error) });
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
window.config = {}
|
||||
this.get_config();
|
||||
this.get_version();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -683,17 +683,6 @@ ul {
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.no-update-icon {
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMwMHB4JyB3aWR0aD0nMzAwcHgnICBmaWxsPSIjMDBkYjU1IiB4bWxuczp4PSJodHRwOi8vbnMuYWRvYmUuY29tL0V4dGVuc2liaWxpdHkvMS4wLyIgeG1sbnM6aT0iaHR0cDovL25zLmFkb2JlLmNvbS9BZG9iZUlsbHVzdHJhdG9yLzEwLjAvIiB4bWxuczpncmFwaD0iaHR0cDovL25zLmFkb2JlLmNvbS9HcmFwaHMvMS4wLyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDEwMCAxMDA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3dpdGNoPjxmb3JlaWduT2JqZWN0IHJlcXVpcmVkRXh0ZW5zaW9ucz0iaHR0cDovL25zLmFkb2JlLmNvbS9BZG9iZUlsbHVzdHJhdG9yLzEwLjAvIiB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIj48L2ZvcmVpZ25PYmplY3Q+PGcgaTpleHRyYW5lb3VzPSJzZWxmIj48cGF0aCBkPSJNNTAsMi41QzIzLjgsMi41LDIuNSwyMy44LDIuNSw1MGMwLDI2LjIsMjEuMyw0Ny41LDQ3LjUsNDcuNVM5Ny41LDc2LjIsOTcuNSw1MEM5Ny41LDIzLjgsNzYuMiwyLjUsNTAsMi41eiBNNzMsMzkuMyAgICBMNDUuNyw2OS40Yy0wLjcsMC44LTIsMC44LTIuOCwwLjFMMjUuOSw1Mi40Yy0wLjgtMC44LTAuOC0yLDAtMi43bDUtNWMwLjgtMC44LDItMC44LDIuNywwTDQ0LDU1LjJMNjUsMzIgICAgYzAuNy0wLjgsMS45LTAuOCwyLjctMC4xbDUuMiw0LjdDNzMuNywzNy4zLDczLjcsMzguNSw3MywzOS4zeiI+PC9wYXRoPjwvZz48L3N3aXRjaD48L3N2Zz4=");
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: block;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
background-size: cover;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.update-icon {
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMwMHB4JyB3aWR0aD0nMzAwcHgnICBmaWxsPSIjZmY4YjAwIiB4bWxuczp4PSJodHRwOi8vbnMuYWRvYmUuY29tL0V4dGVuc2liaWxpdHkvMS4wLyIgeG1sbnM6aT0iaHR0cDovL25zLmFkb2JlLmNvbS9BZG9iZUlsbHVzdHJhdG9yLzEwLjAvIiB4bWxuczpncmFw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FjMCwwLjYsMC40LDEsMSwxaDQuM2MwLjYsMCwxLTAuNCwxLTFjMC0wLjYtMC40LTEtMS0xSDUyNjguNHoiPjwvcGF0aD48cGF0aCBkPSJNNTI3Mi43LDI0MTMuN2gtNC4zYy0wLjYsMC0xLDAuNC0xLDFjMCwwLjYsMC40LDEsMSwxaDQuM2MwLjYsMCwxLTAuNCwxLTFDNTI3My43LDI0MTQuMSw1MjczLjMsMjQxMy43LDUyNzIuNywyNDEzLjd6Ij48L3BhdGg+PHBhdGggZD0iTTUyNzIuNywyNDE3aC00LjNjLTAuNiwwLTEsMC40LTEsMWMwLDAuNiwwLjQsMSwxLDFoNC4zYzAuNiwwLDEtMC40LDEtMUM1MjczLjcsMjQxNy41LDUyNzMuMywyNDE3LDUyNzIuNywyNDE3eiI+PC9wYXRoPjwvZz48cGF0aCBkPSJNNTAsMi41QzIzLjgsMi41LDIuNSwyMy44LDIuNSw1MGMwLDI2LjIsMjEuMyw0Ny41LDQ3LjUsNDcuNVM5Ny41LDc2LjIsOTcuNSw1MEM5Ny41LDIzLjgsNzYuMiwyLjUsNTAsMi41eiBNNDQuNywyNi4zICAgIGMwLTIuOSwyLjQtNS4zLDUuMy01LjNjMi45LDAsNS4zLDIuNCw1LjMsNS4zdjI2LjVjMCwyLjktMi40LDUuMy01LjMsNS4zYy0yLjksMC01LjMtMi40LTUuMy01LjNWMjYuM3ogTTUwLDc4LjcgICAgYy0zLjgsMC02LjktMy4xLTYuOS02LjlzMy4xLTYuOSw2LjktNi45czYuOSwzLjEsNi45LDYuOVM1My44LDc4LjcsNTAsNzguN3oiPjwvcGF0aD48L2c+PC9zd2l0Y2g+PC9zdmc+");
|
||||
width: 30px;
|
||||
@ -705,16 +694,6 @@ ul {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.fail-update-icon {
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMwMHB4JyB3aWR0aD0nMzAwcHgnICBmaWxsPSIjMzUzNT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XRoPjwvZz48L3N3aXRjaD48L3N2Zz4=");
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: block;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
background-size: cover;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.off-icon:hover {
|
||||
opacity: 0.3;
|
||||
@ -726,26 +705,19 @@ ul {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.no-update-icon:hover {
|
||||
opacity: 0.3;
|
||||
cursor:pointer;
|
||||
}
|
||||
.fail-update-icon:hover {
|
||||
opacity: 0.3;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.update-icon:hover {
|
||||
opacity: 0.4;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.green-strong {
|
||||
font-weight: bold;
|
||||
color: #54dc4b;
|
||||
sup {
|
||||
top: -2em;
|
||||
font-size: 12px;
|
||||
left: -0.2em;
|
||||
color: #CCC;
|
||||
font-family: 'Lobster';
|
||||
}
|
||||
|
||||
.orange-strong {
|
||||
font-weight: bold;
|
||||
color: #f57d16cf;
|
||||
.color-green {
|
||||
color:#35c435;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
<div class="controls" v-if="display">
|
||||
<i class="off-icon" v-on:click="action('shutdown')" v-if="off_available"></i>
|
||||
<i class="quit-icon" v-on:click="action('quit')" v-if="quit_available"></i>
|
||||
<i :class="[ update_available ? 'update-icon' :'no-update-icon' ]" @click="$router.push({ name: 'update' })"></i>
|
||||
<i class="update-icon" v-if="update_available&&update_possible" @click="$router.push({ name: 'update' })"></i>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -14,7 +14,7 @@ export default {
|
||||
return {
|
||||
display: true,
|
||||
update_available: false,
|
||||
update_possible: true,
|
||||
update_possible: false,
|
||||
quit_available: false,
|
||||
off_available: false
|
||||
}
|
||||
@ -33,11 +33,14 @@ export default {
|
||||
.then(response => {
|
||||
if(response.data.status) {
|
||||
if(response.data.message == "A new version is available"){
|
||||
|
||||
// Allow to show the warning chip.
|
||||
this.update_available = true
|
||||
this.update_possible = true
|
||||
} else if(response.data.message == "This is the latest version"){
|
||||
this.update_available = false
|
||||
this.update_possible = true
|
||||
|
||||
// Pass the versions as "global vars" through window variable.
|
||||
window.current_version = response.data.current_version
|
||||
window.next_version = response.data.next_version
|
||||
}
|
||||
} else {
|
||||
this.update_possible = false
|
||||
|
@ -78,5 +78,12 @@
|
||||
"tap_msg": "Podeu tocar la tecla USB per iniciar una nova captura.",
|
||||
"capture_download": "La descàrrega de la captura començarà ...",
|
||||
"start_capture_btn": "Inicia una altra captura"
|
||||
},
|
||||
"update": {
|
||||
"tinycheck_needs": "TinyCheck ha d´actualitzar-se a la propera versió",
|
||||
"please_click": "Feu click al botó de sota per actualitzar",
|
||||
"the_process": "El procés pot trigar uns minuts, si us plau esperi ...",
|
||||
"update_finished": "Actualització finalitzada, actualitzant la interfície...",
|
||||
"update_it": "Actualitzar ara"
|
||||
}
|
||||
}
|
@ -78,5 +78,12 @@
|
||||
"tap_msg": "You can tap the USB key to start a new capture.",
|
||||
"capture_download": "The capture download is going to start...",
|
||||
"start_capture_btn": "Start another capture"
|
||||
},
|
||||
"update": {
|
||||
"tinycheck_needs": "TinyCheck needs to be updated to the next version",
|
||||
"please_click": "Please click on the button below to update it.",
|
||||
"the_process": "The process can take few minutes, please wait...",
|
||||
"update_finished": "Update finished, let's refresh the interface...",
|
||||
"update_it": "Update it now"
|
||||
}
|
||||
}
|
@ -78,5 +78,12 @@
|
||||
"tap_msg": "Puede tocar la llave USB para iniciar una nueva captura",
|
||||
"capture_download": "La descarga de la captura va a comenzar ...",
|
||||
"start_capture_btn": "Iniciar otra captura"
|
||||
},
|
||||
"update": {
|
||||
"tinycheck_needs": "TinyCheck debe actualizarse a la próxima versión",
|
||||
"please_click": "Haga click en el botón de abajo para actualizar",
|
||||
"the_process": "El proceso puede tardar unos minutos, por favor espere ...",
|
||||
"update_finished": "Actualización finalizada, actualizando la interfaz...",
|
||||
"update_it": "Actualizar ahora"
|
||||
}
|
||||
}
|
@ -78,5 +78,12 @@
|
||||
"tap_msg": "Vous pouvez appuyer sur l'animation pour lancer une nouvelle capture.",
|
||||
"capture_download": "Le téléchargement de la capture va se lancer...",
|
||||
"start_capture_btn": "Lancer une nouvelle capture"
|
||||
},
|
||||
"update": {
|
||||
"tinycheck_needs": "Une nouvelle mise à jour de TinyCheck est disponible",
|
||||
"please_click": "Cliquez sur le bouton ci-dessous pour le mettre à jour",
|
||||
"the_process": "La mise à jour peut prendre plusieurs minutes, merci d'attendre...",
|
||||
"update_finished": "Mise à jour terminée, vous allez être redirigé...",
|
||||
"update_it": "Mettre TinyCheck à jour"
|
||||
}
|
||||
}
|
@ -25,8 +25,7 @@ export default {
|
||||
question: true,
|
||||
running: false,
|
||||
check_alerts: false,
|
||||
long_waiting: false,
|
||||
translation: {}
|
||||
long_waiting: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -29,8 +29,7 @@ export default {
|
||||
loading: false,
|
||||
stats_interval: false,
|
||||
chrono_interval: false,
|
||||
sparklines: false,
|
||||
translation: {}
|
||||
sparklines: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -55,8 +55,7 @@ export default {
|
||||
interval: false,
|
||||
error: false,
|
||||
reboot_option: window.config.reboot_option,
|
||||
attempts: 3,
|
||||
translation: {}
|
||||
attempts: 3
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="center">
|
||||
<h3 class="lobster">{{ $t("home.welcome_msg") }}</h3>
|
||||
<h3 class="lobster">{{ $t("home.welcome_msg") }}<sup>{{current_version}}</sup></h3>
|
||||
<p>{{ $t("home.help_msg") }}</p>
|
||||
<button class="btn btn-primary" v-on:click="next()">{{ $t("home.start_btn") }}</button>
|
||||
</div>
|
||||
@ -14,7 +14,7 @@ export default {
|
||||
props: { saved_ssid: String, list_ssids: Array, internet: Boolean },
|
||||
data() {
|
||||
return {
|
||||
translation: {},
|
||||
current_version:""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -31,6 +31,10 @@ export default {
|
||||
internet: internet } });
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
if ('current_version' in window)
|
||||
this.current_version = window.current_version
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -99,8 +99,7 @@ export default {
|
||||
name: 'report',
|
||||
data() {
|
||||
return {
|
||||
results: true,
|
||||
translation: {}
|
||||
results: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -144,8 +144,7 @@ export default {
|
||||
usb: false,
|
||||
saved: false,
|
||||
save_usb: false,
|
||||
init: false,
|
||||
translation: {}
|
||||
init: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -20,7 +20,7 @@
|
||||
},
|
||||
methods: {
|
||||
internet_check: function() {
|
||||
axios.get('/api/network/status', { timeout: 10000 })
|
||||
axios.get('/api/network/status', { timeout: 30000 })
|
||||
.then(response => {
|
||||
if (response.data.internet) this.internet = true
|
||||
if (window.config.iface_out.charAt(0) == 'e') {
|
||||
@ -32,7 +32,7 @@
|
||||
.catch(err => (console.log(err)))
|
||||
},
|
||||
get_wifi_networks: function() {
|
||||
axios.get('/api/network/wifi/list', { timeout: 10000 })
|
||||
axios.get('/api/network/wifi/list', { timeout: 30000 })
|
||||
.then(response => {
|
||||
this.list_ssids = response.data.networks
|
||||
this.goto_home();
|
||||
|
@ -1,20 +1,11 @@
|
||||
<template>
|
||||
<div class="center">
|
||||
<div v-if="update_possible">
|
||||
<div v-if="update_available">
|
||||
<p><span class="orange-strong">TinyCheck needs to be updated.</span><br />
|
||||
<span v-if="!update_launched">Please click on the button below to update it.</span>
|
||||
<span v-else>The process can take few minutes, please wait...</span>
|
||||
</p>
|
||||
<button class="btn btn-primary" :class="[ update_launched ? 'loading' : '' ]" v-on:click="launch_update()">Update it now</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p><span class="green-strong">Your TinyCheck instance is up-to-date!</span><br />You'll be redirected in few seconds.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p><strong>You dont have Internet or the rights to update Tinycheck.</strong><br />You'll be redirected in few seconds.</p>
|
||||
</div>
|
||||
<p><strong>{{ $t("update.tinycheck_needs") }} ({{next_version}}).</strong><br />
|
||||
<span v-if="!update_launched">{{ $t("update.please_click") }}</span>
|
||||
<span v-if="update_launched&&!update_finished">{{ $t("update.the_process") }}</span>
|
||||
<span v-if="update_launched&&update_finished" class="color-green">✓ {{ $t("update.update_finished") }}</span>
|
||||
</p>
|
||||
<button class="btn btn-primary" :class="[ update_launched ? 'loading' : '' ]" v-on:click="launch_update()" v-if="!update_finished">{{ $t("update.update_it") }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -26,30 +17,24 @@
|
||||
data() {
|
||||
return {
|
||||
translation: {},
|
||||
update_available: null,
|
||||
update_possible: true,
|
||||
update_launched: null,
|
||||
check_interval: null
|
||||
check_interval: null,
|
||||
next_version: null,
|
||||
current_version: null,
|
||||
update_finished: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
check_update: function() {
|
||||
axios.get('/api/update/check', { timeout: 60000 })
|
||||
check_version: function() {
|
||||
axios.get('/api/update/get-version', { timeout: 60000 })
|
||||
.then(response => {
|
||||
console.log(response.data.status)
|
||||
if(response.data.status) {
|
||||
if(response.data.message == "A new version is available"){
|
||||
this.update_available = true
|
||||
this.update_possible = true
|
||||
} else if (response.data.message == "This is the latest version"){
|
||||
this.update_available = false
|
||||
this.update_possible = true
|
||||
if(response.data.current_version == window.next_version){
|
||||
window.current_version = response.data.current_version
|
||||
this.update_finished = true
|
||||
clearInterval(this.check_interval);
|
||||
setTimeout(function () { window.location.href = "/"; }.bind(this), 3000);
|
||||
setTimeout(function () { window.location.href = "/"; }, 10000)
|
||||
}
|
||||
} else {
|
||||
this.update_possible = false
|
||||
setTimeout(function () { window.location.href = "/"; }.bind(this), 3000);
|
||||
}
|
||||
})
|
||||
.catch(error => { console.log(error) });
|
||||
@ -60,7 +45,7 @@
|
||||
if(response.data.status) {
|
||||
if(response.data.message == "Update successfully launched"){
|
||||
this.update_launched = true
|
||||
this.check_interval = setInterval(function(){ this.check_update(); }.bind(this), 3000);
|
||||
this.check_interval = setInterval(function(){ this.check_version(); }.bind(this), 3000);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -68,7 +53,16 @@
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
this.check_update();
|
||||
if ('next_version' in window && 'current_version' in window){
|
||||
if (window.current_version != window.next_version){
|
||||
this.next_version = window.next_version
|
||||
this.current_version = window.current_version
|
||||
} else {
|
||||
window.location.href = "/";
|
||||
}
|
||||
} else {
|
||||
window.location.href = "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -72,8 +72,7 @@ export default {
|
||||
virtual_keyboard: window.config.virtual_keyboard,
|
||||
have_internet: false,
|
||||
enter_creds: false,
|
||||
refreshing: false,
|
||||
translation: {}
|
||||
refreshing: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -118,7 +118,7 @@ create_directory() {
|
||||
}
|
||||
|
||||
get_version() {
|
||||
git tag | tail -n 1 > /usr/share/tinycheck/VERSION
|
||||
git tag | tail -n 1 | xargs echo -n > /usr/share/tinycheck/VERSION
|
||||
}
|
||||
|
||||
generate_certificate() {
|
||||
@ -465,6 +465,7 @@ else
|
||||
set_userlang
|
||||
set_credentials
|
||||
set_kioskmode
|
||||
set_update
|
||||
check_dependencies
|
||||
configure_dnsmask
|
||||
configure_dhcpcd
|
||||
|
@ -13,6 +13,12 @@ def check():
|
||||
return jsonify(Update().check_version())
|
||||
|
||||
|
||||
@update_bp.route("/get-version", methods=["GET"])
|
||||
def get_version():
|
||||
""" Check the current version """
|
||||
return jsonify(Update().get_current_version())
|
||||
|
||||
|
||||
@update_bp.route("/process", methods=["GET"])
|
||||
def process():
|
||||
""" Check the presence of new version """
|
||||
|
@ -20,7 +20,8 @@ class Update(object):
|
||||
"""
|
||||
Check if a new version of TinyCheck is available
|
||||
by quering the Github api and comparing the last
|
||||
tag with the VERSION file content.
|
||||
tag inside the VERSION file.
|
||||
:return: dict containing the available versions.
|
||||
"""
|
||||
if read_config(("frontend", "update")):
|
||||
try:
|
||||
@ -28,23 +29,44 @@ class Update(object):
|
||||
res = json.loads(res.content.decode("utf8"))
|
||||
|
||||
with open(os.path.join(self.app_path, "VERSION")) as f:
|
||||
if f.read() != res[0]["name"]:
|
||||
cv = f.read()
|
||||
if cv != res[0]["name"]:
|
||||
return {"status": True,
|
||||
"message": "A new version is available"}
|
||||
"message": "A new version is available",
|
||||
"current_version": cv,
|
||||
"next_version": res[0]["name"]}
|
||||
else:
|
||||
return {"status": True,
|
||||
"message": "This is the latest version"}
|
||||
"message": "This is the latest version",
|
||||
"current_version": cv}
|
||||
except:
|
||||
return {"status": False,
|
||||
"message": "Something went wrong (no internet nor version file)"}
|
||||
"message": "Something went wrong (no API access nor version file)"}
|
||||
else:
|
||||
return {"status": False,
|
||||
"message": "You don't have rights to do this operation."}
|
||||
|
||||
def get_current_version(self):
|
||||
"""
|
||||
Get the current version of the TinyCheck instance
|
||||
:return: dict containing the current version or error.
|
||||
"""
|
||||
if read_config(("frontend", "update")):
|
||||
try:
|
||||
with open(os.path.join(self.app_path, "VERSION")) as f:
|
||||
return {"status": True,
|
||||
"current_version": f.read()}
|
||||
except:
|
||||
return {"status": False,
|
||||
"message": "Something went wrong - no version file ?"}
|
||||
else:
|
||||
return {"status": False,
|
||||
"message": "You don't have rights to do this operation."}
|
||||
|
||||
def update_instance(self):
|
||||
"""
|
||||
Update the instance by executing
|
||||
the update script.
|
||||
Update the instance by executing the update script.
|
||||
:return: dict containing the update status.
|
||||
"""
|
||||
if read_config(("frontend", "update")):
|
||||
try:
|
||||
|
@ -7,7 +7,7 @@ fi
|
||||
if [ $PWD = "/usr/share/tinycheck" ]; then
|
||||
echo "[+] Cloning the current repository to /tmp/"
|
||||
rm -rf /tmp/tinycheck/ &> /dev/null
|
||||
cd /tmp/ && git clone --branch update-feature https://github.com/KasperskyLab/tinycheck
|
||||
cd /tmp/ && git clone https://github.com/KasperskyLab/tinycheck
|
||||
cd /tmp/tinycheck && bash update.sh
|
||||
elif [ $PWD = "/tmp/tinycheck" ]; then
|
||||
|
||||
@ -75,7 +75,7 @@ elif [ $PWD = "/tmp/tinycheck" ]; then
|
||||
service tinycheck-watchers restart
|
||||
|
||||
echo "[+] Updating the TinyCheck version"
|
||||
cd /tmp/tinycheck && git tag | tail -n 1 > /usr/share/tinycheck/VERSION
|
||||
cd /tmp/tinycheck && git tag | tail -n 1 | xargs echo -n > /usr/share/tinycheck/VERSION
|
||||
|
||||
echo "[+] TinyCheck updated!"
|
||||
fi
|
Reference in New Issue
Block a user