Upload the files

Signed-off-by: Stefano Capitani <stefano@manjaro.org>
This commit is contained in:
Stefano Capitani 2022-11-01 18:33:16 +01:00
parent e90ca20a2e
commit 084646c0b7
4 changed files with 223 additions and 92 deletions

24
PKGBUILD Normal file
View file

@ -0,0 +1,24 @@
# Maintainer: Stefano Capitani <stefanoatmanjarodotorg>
pkgname='manjaro-iso-downloader'
pkgver=0.1
pkgrel=1
_commit=feb431bb6c04440d12327b981dcf496b9e740788
pkgdesc='Download last Official Manjaro Isos with integrity checker'
arch=('any')
url='https://gitlab.manjaro.org/ste74/manjaro-iso-downloader'
license=('GPL3')
depends=('yad' 'zenity' 'manjaro-icons' 'curl' 'wget' 'aria2' 'sed' 'gawk')
source=("$pkgname-$_commit.tar.gz::$url/-/archive/$_commit/$pkgname-$_commit.tar.gz")
sha256sums=('5a70ae45963b560e6a54778f1d71a2c152d7793053fd5eaae5429760b1a94564')
package() {
cd $pkgname-$_commit
install -Dm755 $pkgname.sh $pkgdir/usr/bin/$pkgname
install -Dm644 $pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop
}

View file

@ -1,92 +1,2 @@
# manjaro-iso-downloader
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.manjaro.org/ste74/manjaro-iso-downloader.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.manjaro.org/ste74/manjaro-iso-downloader/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
##Manjaro-Iso-Downloader
Download the last Official Manjaro Isos and check the integrity

9
manjaro-iso-downloader.desktop Executable file
View file

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Manjaro ISO downloader
Comment=Download official Manjaro Developer Isos
Exec=/usr/bin/manjaro-iso-downloader
Icon=downloader-arrow
Categories=Applications
StartupNotify=false

188
manjaro-iso-downloader.sh Normal file
View file

@ -0,0 +1,188 @@
#!/bin/env bash
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
set -x
clear
window_icon=/usr/share/icons/manjaro/maia/32x32.png
main=/usr/bin/manjaro-iso-downloader
iso_dir=$HOME/manjaro-iso
gpg_log=$(mktemp)
check_sums_log=$(mktemp)
iso_list=$iso_dir/.iso.list
missing_prog=$(mktemp)
iso_ver_url='https://gitlab.manjaro.org/webpage/iso-info/-/raw/master/file-info.json'
iso_ver=$(curl -s $iso_ver_url | grep -m1 'image' | grep -oP '(?<=kde/).*(?=/manjaro)')
edition='Xfce\!Plasma\!Gnome'
version='full\!minimal'
type='direct\!torrent'
#list of essential programs
check_prog=(curl wget aria2c zenity yad awk sed)
#grab iso link
curl -s $iso_ver_url | grep 'image' | grep 'download.manjaro.org' | awk '{print $2}' | tr -d '",' | head -n -8 > "$iso_list"
trap 'rm -f $check_sums_log $gpg_log ; killall aria2c ; exit' ERR EXIT
#Main Window settings
gui() {
icon=/usr/share/icons/manjaro/maia/maia.svg
if [ -r "$icon" ] ; then
GDK_BACKEND=x11 /usr/bin/yad --center --window-icon="$icon" --title="Manjaro Isos $iso_ver Downloader and Checker" "$@"
else
GDK_BACKEND=x11 /usr/bin/yad --center --title="Manjaro Isos Downloader and Checker" "$@"
fi
}
Welcome()
{ ISO=$(gui --image="$window_icon" --text-align=center --text="<b>Welcome to Manjaro Isos Downloader and Checker</b>\nA simple <b>GUI</b> for download lastes Official Isos and check the integrity" \
--form --separator=" " \
--field="Edition::CB" $edition \
--field="Version::CB" $version \
--field="Type::CB" $type)
}
get_iso() {
iso_full_link=$(grep "$DE" $iso_list | grep -v 'minimal')
iso_minimal_link=$(grep "$DE" $iso_list | grep 'minimal')
iso_full_torrent=$(grep "$DE" $iso_list | grep -v 'minimal').torrent
iso_minimal_torrent=$(grep "$DE" $iso_list | grep 'minimal').torrent
iso_full_sha1=$(grep "$DE" $iso_list | grep -v 'minimal').sha1
iso_minimal_sha1=$(grep "$DE" $iso_list | grep 'minimal').sha1
iso_full_sig=$(grep "$DE" $iso_list | grep -v 'minimal').sig
iso_minimal_sig=$(grep "$DE" $iso_list | grep 'minimal').sig
if [[ $TYPE == 'direct' ]] ; then
[[ $VERSION == 'full' ]] && \
wget -nc -P "$iso_dir" "$iso_full_link" "$iso_full_sha1" "$iso_full_sig" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver..." --auto-close --no-buttons || \
wget -nc -P "$iso_dir" "$iso_minimal_link" "$iso_minimal_sha1" "$iso_minimal_sig" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver..." --auto-close --no-buttons
else
[[ $VERSION == 'full' ]] && \
wget -nc -P "$iso_dir" "$iso_full_torrent" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver torrent..." --auto-close --no-buttons || \
wget -nc -P "$iso_dir" "$iso_minimal_torrent" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver torrent..." --auto-close --no-buttons
fi
if [[ $TYPE == 'torrent' ]] ; then
[[ $VERSION == 'full' ]] && \
wget -nc -P "$iso_dir" "$iso_full_sha1" "$iso_full_sig" "$iso_full_torrent" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver..." --auto-close --no-buttons || \
wget -nc -P "$iso_dir" "$iso_minimal_sha1" "$iso_minimal_sig" "$iso_minimal_torrent" 2>&1 | \
sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | \
gui --image=download --progress --pulsate --title="Downloading $DE $iso_ver..." --auto-close --no-buttons
cd $iso_dir
(aria2c --continue=true --max-concurrent-downloads=5 --max-connection-per-server=4 --min-split-size=10M --split=5 --disable-ipv6=true \
--seed-time=0 --summary-interval=0 --console-log-level=warn --dir="$iso_dir" $iso_dir/*.torrent 2>&1) &
pid=$!; while kill -0 $pid 2>&1; do echo 'working'; done | zenity --progress --pulsate --text="Waiting for Torrent download..." \
--title="Manjaro Isos $iso_ver Downloader and Checker" --auto-close --no-cancel
fi
}
check_programs() {
for i in "${check_prog[@]}"; do
command -v "$i" >/dev/null 2>&1 || echo "$i" >> "$missing_prog"
done
if [[ -s $missing_prog ]]; then
gui --width=850 --height=270 --image=dialog-error --button=Ok --text-align=center --text='You need the following programs for continue' --text-info < "$missing_prog"
exit 1
fi
}
check_integrity() {
if [[ "$(ls -A $iso_dir)" ]]; then
cd $iso_dir
last_iso=$(echo $(ls -Art *.iso) | tail -n1)
last_sig=$(echo $(ls -Art *.sig) | tail -n1)
last_chksum=$(echo $(ls -Art *.sha1) | tail -n1)
gui --timeout=5 --timeout-indicator=top --text='Next step: checksums integrity' --button=Skip:0 --width=550 --height=150
if [[ $? != 0 ]]; then
(sha1sum -c $last_chksum > $check_sums_log) &
pid=$!
while kill -0 $pid 2>&1; do echo 'working'; done | zenity --progress --pulsate --text="Waiting for SHA1SUM check..." \
--title="Manjaro Isos $iso_ver Downloader and Checker" --auto-close --no-cancel
gui --width=850 --height=270 --button=Ok --image=dialog-error --text-align=center --text='SHA1SUM check result:' --text-info < $check_sums_log
fi
gui --timeout=5 --timeout-indicator=top --text='Next step: GPG integrity' --button=Skip:0 --width=550 --height=150
if [[ $? != 0 ]]; then
(gpg --verify $last_sig $last_iso &> $gpg_log) &
pid=$!
while kill -0 $pid 2>&1; do echo 'working'; done | zenity --progress --pulsate --text="Waiting for GPG check..." \
--title="Manjaro Isos $iso_ver Downloader and Checker" --auto-close --no-cancel
gui --width=850 --height=270 --button=Ok --image=dialog-error --text-align=center --text='GPG signatur result:' --text-info < $gpg_log
fi
fi
}
check_connection() {
wget -q --tries=10 --timeout=20 --spider https://google.com
if [[ $? != 0 ]]; then
gui --text-align=center --text="Check your internet connection \nyou are offline" --button="Ok":0 --button="Exit":1
case $? in
0) exec $main ;;
1) exit 1
esac
fi
}
final_msg() {
gui --text="Done, the Iso can be found at $iso_dir " --button="Exit":0 --button="Open folder":1 --button="New Iso":2
case $? in
0) exit 1 ;;
1) xdg-open $iso_dir ;;
2) exec $main
esac
}
#Main program
check_programs
check_connection
[[ ! -d $/HOME/$iso_dir ]] && mkdir -p $iso_dir
Welcome
DE=$(echo $ISO | awk '{print $1}' | tr '[:upper:]' '[:lower:]')
VERSION=$(echo $ISO | awk '{print $2}')
TYPE=$(echo $ISO | awk '{print $3}')
[[ $DE == 'plasma' ]] && DE=kde
get_iso
check_integrity
final_msg
$main
#Done