Compare commits

..

67 Commits
0.1.2 ... main

Author SHA1 Message Date
1c72887160 Update 'README.md'
Updated logo to use, now using the newly created logos.

Updated the opening section to be more clear and reflective of the software (was somewhat outdated).

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-03-13 22:34:26 +00:00
a794d16bc3 Delete 'msedge-updater-logo.svg'
Removed old graphic

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-03-13 22:31:48 +00:00
8fafc52c8c Delete 'msedge-updater-logo.png'
Removed old graphic.

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-03-13 22:31:34 +00:00
19f30e07e0 Delete 'assets/msedge-updater-logo(icon).png'
Removed graphic that should not have been part of the upload.

Potential bug which should be reported to admin to determine if Gitea related bug, or backend configuration.

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-03-13 22:31:05 +00:00
d3bad0d47a Uploaded new icon graphics
Newly revised msedge-updater graphics which can also be used as system icons.

Both SVG and PNG files available.

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-03-13 22:29:41 +00:00
9a3c516fe3 Merge pull request 'program-rename (LTS)' (#1) from program-rename into main
Reviewed-on: #1
2022-02-20 14:37:20 +00:00
4f58db256e
Ammended bug fix
The bug fix in commit 9ff1b6e has been re-addressed due to a potential
edge case to cause another bug to occur as a result. This fix was
implemented as a result from the review on PR: #1 (comment)
2022-02-17 23:27:03 +00:00
c25a6fc062
Updated README.md
Updated contact information for Ethan.
2022-02-15 22:39:29 +00:00
1757548491
Updated README.md 2021-12-09 17:33:01 +00:00
a44a69e568
Updated version
Updated the version to 0.2.1 for minor changes
2021-12-09 17:23:05 +00:00
9ff1b6e40e
Fixed bug
Since file was renamed to `msedge-updater`, check if Edge process is
running with simply "msedge" is no longer suitable.
    - changed this to "msedge-$edge-channel"
2021-12-09 17:15:06 +00:00
203640aa3b Updated name of program
Renamed the program from 'updater' to 'msedge-updater'.
Updated all files related to the original name to adopt new name.
2021-09-09 15:47:38 +01:00
TheOnePath
1100a67d0b Update 'README.md'
Added the Microsoft Edge Updater logo to the README.md

Signed-off-by: TheOnePath <theonepath@noreply.localhost>
2021-09-09 14:59:20 +01:00
TheOnePath
c4510b2bef Added logos
Added the Microsoft Edge Updater logos to the main branch.

Signed-off-by: TheOnePath <theonepath@noreply.localhost>
2021-09-09 14:49:51 +01:00
2d00ffeda4 Updated updater and fixed bugs
Fixed minor bugs that do not cause major issues for updating.
Changed the behaviour of killing the msedge process
    - enter a loop if process is still identified as running.
    - attempted to kill process 3 times and wait 2 seconds between each
      attempt.
    - if failed 3 times, log and exit 253.
2021-07-02 13:38:05 +01:00
05ef201cff Updated README.md
Changed usage message respectable to the help screen.
2021-07-01 14:12:27 +01:00
e1c95d1b73 Updated help message
Changed help message to match documentation
2021-07-01 14:11:54 +01:00
e1c3f9f1cc Fixed bug
Identified bug around line 400 where line started with 'r[['. Removed 'r' from the start of the line.
2021-07-01 13:56:14 +01:00
664655bc65 Merge branch 'main' of https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater 2021-07-01 13:53:55 +01:00
TheOnePath
0dc7f2ca17 Merge pull request 'documentation' (#5) from documentation into main
Reviewed-on: https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/pulls/5
2021-07-01 13:53:22 +01:00
4a8f5a3a8b Fixed spelling 2021-07-01 13:49:27 +01:00
6c46a42e78 Fixed spelling
Fixed typos identified in PR review.
Updated manpage accordingly by generation.
2021-07-01 13:32:24 +01:00
bb181e630c Updated README.md to v0.2.0 2021-06-30 15:49:38 +01:00
24dfa44ba7 Merge remote-tracking branch 'origin/main' into documentation 2021-06-30 15:43:18 +01:00
f7dff7e7d8 Changed version to no longer be in alpha. 2021-06-30 15:42:52 +01:00
4cf35ddf28 Updated documentation to v0.2.0
Updated markdown form of manpage to v0.2.0 with respectable changes to
what was changed in updater v0.2.0.

Manpage updated via pandoc generation of markdown form.
2021-06-30 15:39:05 +01:00
21889a7362 Updated updater
Added quiet operation
    - this will prevent STDOUT and STDERR from being displayed to the
      terminal, unless a decision is encountered - will not assume yes.
    - notifications are still sent since '--no-notify' can be used.

All echo statements responsible for outputting have been changed to
initial check if script is running in quiet mode.

'printf' statements which do not serve a specific purpose have been
changed to 'echo' commands.

'echo' statements that are responsible for displaying error messages are
now sent over STDERR instead of STDOUT.

Added '--full-clean' argument which will remove any possibly generated
files, by updater, from the system, including logs.
2021-06-24 15:51:05 +01:00
0f397879d7 Merge branch 'main' of https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater 2021-06-24 00:01:06 +01:00
9094d209df Updated updater to v0.2
The channel for Edge to be updated can be changed between dev and beta.
    - all hardcoded values which contained the keyword "beta" have been
      replaced with a variable substitute.

Moved the source.list check statement before checking if Edge is
installed to determine which channel is being used that session.
    - the channel is determined from the source.list file, alternatively
      using the '-c | --set-channel=' flag.

Updated preamble and help message display.
Other fixes.
2021-06-23 23:50:54 +01:00
f48c5a8a22 Updated .gitignore
Added to ignore my TODO list file.
2021-06-23 23:48:30 +01:00
54326d7052 Updated source.list to v0.2
source.list now takes an extra parameter in [dists]; the architecture
followed by the Edge channel to update.
2021-06-23 23:47:09 +01:00
TheOnePath
fd95779cdd Merge pull request 'documentation' (#4) from documentation into main
Reviewed-on: https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/pulls/4
2021-06-23 11:28:54 +01:00
f2ca9217ba Updated documentation according to review
Chnaged documentation based on suggests in the PR review by Robert
Morrison.
2021-06-23 11:26:17 +01:00
a68ac1cbac Merge remote-tracking branch 'origin/main' into documentation 2021-06-22 17:21:42 +01:00
4e68936a6a Committing extra changes missed
Addition changes which are part of the previous commit but weren't added
for tracking before committing.
2021-06-22 17:20:44 +01:00
8522783a12 Updated updater
Changed preamble and comments

Changed the wording of some messages to the user and log. Program adds
the backup archive to the garbage list if the restoration was successful.
2021-06-22 17:18:14 +01:00
a2fcbb0512 Updated common
Changed comments and preamble of script.

'backup_file' variable in 'restore_function' is now global to allow for
removal of backup archive if the restoration was successful.
2021-06-22 17:16:09 +01:00
198ee1d4dc Updated documentation to v0.1.4
Added the '--mode' flag and desciption.

Updated the dependencies required for updater to run. With these
installed on any system, the program should run.

Adjusted spacing layout of document.
Updated manpage according to markdown using pandoc
2021-06-22 16:26:18 +01:00
3ee9ca3936 Updated README.md to v0.1.4 2021-06-22 12:55:12 +01:00
8f21f3903d Fixed bug with debugging mode
Script now takes flag '--mode=' appended with a mode.
    - only current mode is 'debug'. Use this to enter debug run mode.
    - script now outputs the session log is mode is in debug.
2021-06-21 18:31:52 +01:00
39b0b06a8c Updated .gitignore 2021-06-21 15:58:49 +01:00
05e178b38b Fixed bug with testing variable 2021-06-21 15:54:50 +01:00
d2e13eb940 Updated common and fixed bugs
Refactored 'archive_system' function
    - function now explicitly identifies which require compressing.
    - symbolic links are removed from the list(s) due to causing issues
      during the decompression stage when restoring the system. Symlinks
      are then stored in a record with the symlink name followed by the
      target. Both prefixed with paths to location and ':' delimited,
      respectfully.
    - system is then compressed using tar gzip compression, overwriting
      any previously generated archive generated.

Refactored 'restore_system' function
    - changed 'backup_file' to no longer require the final sed command
      similar what's found in 'archive_function' - unnecessary
      processing.
    - fixed tar statement to correctly output the contents of the
      decompression to the root of the system ("/").
    - added function to recreate the symlink files. It's unlikely that
      symlink files need replacing due to their behaviour; however, for
      clarity, the identified symlink files during archiving are recreated
      to their original location and linked to their target location.

Removed trailing whitespaces.
2021-06-21 15:06:18 +01:00
da6922a337 Updated updater and fixed bugs
Added basic testing implementations
    - WIP: only outputs the log file at end of a run.
    - added option '--dev-test' to be used when running and testing the
      program.
    - practice of feature will be within a docker container but can
      equally been used on a native system.

Created 'check_restoration' function for optimisation of repetition
    - simply ensures that the restoration at any point was successful.
    - if the restoration fails, the program logs and exits accordingly;
      otherwise, if it succeeded then at this point the program exits
      with a different exit code since something else went wrong to
      trigger a system restoration.
    - takes 2 arguments, the exit code of the restoration system and
      the exit code of the section which triggered the restoration.
    - refactored sections can be identified containing the
      'check_restoration' function call.

Removed trailing whitespaces.
2021-06-21 14:35:48 +01:00
9ec3bacc9d Fixed bug
Logic error identifying if a backup file exists.
2021-06-15 23:51:25 +01:00
0fb16f178d Fixed bug
Fixed issue with subshell command not being completed.
2021-06-15 23:33:19 +01:00
00275314d7 Fixed bug
Syntax bug in common file.
Updated .gitignore to exclude Dockerfile during testing.
2021-06-15 16:47:18 +01:00
11a90f8f92 Fixed bugs
Changed the behaviour of tar to not be verbose and any output it placed
in a tmp file, STDERR is redirected to logs.

Bug with the format of exit code capture in updater that was fixed in
common; however, those changes hadn't been made until now in updater.
2021-06-13 21:41:33 +01:00
8340f56d2f Updated documentation version number to 0.1.4 2021-06-05 16:56:44 +01:00
a7bb0d2d80 Updated to v0.1.4
Fixed bugs and issues
    - Fixed issue in common script with incorrect exit code capture of
      subshells.
    - Changed tar command for decompressing data.tar.gz file to only log
      STDERR and void STDOUT.
    - Log function was called without correct arguments @ln:239. Message
      related to there being a new version available but wasn't logged.
2021-06-05 16:51:12 +01:00
0cc68dff4c Added .gitignore file 2021-06-04 21:49:15 +01:00
3dc97f6d35 Removed log files 2021-06-04 21:49:00 +01:00
TheOnePath
f88fb0ee10 Merge pull request 'documentation' (#3) from documentation into main
Reviewed-on: https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/pulls/3
2021-06-04 21:21:54 +01:00
8254c00f91 Merge branch 'documentation' of https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater into documentation 2021-06-04 21:05:18 +01:00
5163e7c6b9 Applied patch to markdown provided by @robert 2021-06-04 21:04:44 +01:00
TheOnePath
27c75b3c9b Merge branch 'main' into documentation 2021-06-04 19:23:01 +01:00
4b7c9ba709 Updated documentation to v0.1.3 2021-06-04 19:22:28 +01:00
5f5f97b106 Updated markdown manpage to match v0.1.3 2021-06-04 18:33:00 +01:00
TheOnePath
82b12aec1d Merge pull request 'Formatting of Markdown' (#2) from robert/Microsoft-Edge-Updater:documentation into documentation
Reviewed-on: https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/pulls/2
2021-06-03 23:41:58 +01:00
Robert Morrison
93c0db0201 Updated To fix issues in review 2021-06-01 18:04:38 +01:00
9665f610a5 Updated README.md to reflect license 2021-05-28 18:39:18 +01:00
ad955c44a5 Updated README.md to v0.1.3 2021-05-28 18:37:06 +01:00
eb1ed051d2 Updated common to v0.1.3
Common now contains a notify function which uses notify-send to provide
a user with a notification when the function is called.
    - Function takes 2 inputs, {summary} and {body} which are respectful
      to the basic arguments for notify-send.
    - Function returns an issue with required amount of arguments aren't
      met.
    - Default arguments are used with notify-send, no other interaction
      is made possible.

Updated backup functions to only log STDERR to file, which files are
(de)compressed aren't fundamental to logging information and exact files
can be checked appropriately via other means.

Fixed bug with relative path being incorrect for operation of updater
when sourcing in common.
2021-05-28 18:26:55 +01:00
2add5afc7c Updated updater to v0.1.3
Implemented notification system.
    - Send a notification to the user's system using the `notify` function in common.
    - Notifications are send on most important outcomes of the update
      session meaning program can have STDOUT piped to another location
      and still receive a message after operation.
    - Added the `--no-notify` flag to prevent notifications from being
      sent to the user. By default, notifications will be sent without
      this flag.

- Program now checks to ensure the script is being ran with root
  privilages. Program will exit otherwise without notification.

- Program now keeps track of garbage data to ensure a proper clean up
  after operation of a session.
    - Unnecessary large volumes of data sat in /tmp/ can be removed
      instantly to prevent taking up space which isn't required. File
      sizes significantly less can remain and cleared out on next
      restart of the system.

- Updated usage message.
- Changed some of the output messages.
- Fixed bug with relative paths.
2021-05-28 18:09:13 +01:00
Robert Morrison
21c208a326 Formatting of Markdown
I have formatted the markdown so it does what I understand you want.

The dash used is an em dash `—`
The pandoc command for converting the markdown into a manpage is
`pandoc INFILE -s -t man -o OUTFILE`

I have also provided a generated manpage
2021-05-24 16:29:15 +01:00
59f8991c61 Updated manpage markdown 2021-05-24 13:26:33 +01:00
d87f446ae4 Added manpage markdown file 2021-05-23 23:33:09 +01:00
10 changed files with 1232 additions and 393 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
logs/
TODO

View File

@ -1,25 +1,47 @@
# (WIP) Microsoft Edge (Beta) Updater ![msedge-updater logo](./assets/msedge-updater-logo.svg)
An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures. # Microsoft Edge Updater
An updater program which can install the latest available version of Microsoft Edge to non-APT or DNF-based Linux distros.
Currently this program can update both the Beta and Dev releases of Microsoft Edge for amd64 architectures.
## Usage ## Usage
``` ```
Usage: updater [OPTION] Usage: msedge-updater [OPTION]
Microsoft Edge Updater (0.1.2) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros. Microsoft Edge Updater (0.2.1) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
DISCLAIMER: Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures. DISCLAIMER: Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures might be possible but not tested.
Options: Options:
-nn, --no-notify Prevent notifications from being set after a session.
-c, --set-channel= Change the channel to be updated for Microsoft Edge. Will default to the value defined in source.list if flag is not present.
* beta - update Beta channel release.
* dev - update Dev channel release.
-q, --quiet Operate strictly with no output on STDOUT or STDERR, prompts will NOT assume yes however. Logging still occurs in background.
--mode= Set the mode of the program to be ran in. Default mode occurs without this flag.
* debug - run program in debug mode. (WIP)
--full-clean Remove all content generated by the updater after a session, this includes all logs.
-y, --yes-all Assume yes to all yes/no decisions. -y, --yes-all Assume yes to all yes/no decisions.
-v, --version Print out the version of the script and exit. -v, --version Print out the version of the script and exit.
--help Print this help message and exit -h, --help Print this help message and exit.
``` ```
## Information ## Information
* Program Name - Microsoft Edge Updater * Program Name - Microsoft Edge Updater
* Script Name - updater * Script Name - `msedge-updater`
* Version - 0.1.2 (Beta) * Version - 0.2.1
* Synopsis - update Microsoft Edge (Beta) to the latest release. * Synopsis - update Microsoft Edge to the latest release.
* Author(s) - Ethan Smith-Coss (No contact) * Author(s) - Ethan Smith-Coss (ethan.sc@closedless.xyz)
* License - No License * Contributors - Robert Morrison, Documentation
* License - GNU GPLv3+
## Documentation
For more in-depth documentation on `msedge-updater`, view the manpage in markdown form
[here](https://git.closedless.xyz/ClosedLess/Microsoft-Edge-Updater/src/branch/main/msedge-updater.1.md).
Alternatively you can view the manpage from your terminal by downloading the project.
```bash
$ git clone https://git.closedless.xyz/ClosedLess/Microsoft-Edge-Updater/src/branch/main
$ cd Microsoft-Edge-Updater/
$ man ./msedge-updater.1
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="256"
height="256"
viewBox="0 0 67.733334 67.733334"
version="1.1"
id="svg9394"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
sodipodi:docname="msedge-updater-logo.svg"
inkscape:export-filename="C:\Users\Ethan\Pictures\ClosedLess\msedge-updater-logo(icon).png"
inkscape:export-xdpi="192"
inkscape:export-ydpi="192"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview9396"
pagecolor="#ffffff"
bordercolor="#cccccc"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:snap-intersection-paths="false"
inkscape:object-paths="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="2"
inkscape:cx="112.75"
inkscape:cy="105.25"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
showguides="false" />
<defs
id="defs9391">
<linearGradient
inkscape:collect="always"
id="linearGradient53164">
<stop
style="stop-color:#50cf5b;stop-opacity:1"
offset="0"
id="stop53160" />
<stop
style="stop-color:#34c0ed;stop-opacity:1"
offset="1"
id="stop53162" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient53164"
id="linearGradient12766"
gradientUnits="userSpaceOnUse"
x1="205.14612"
y1="127.73593"
x2="189.50475"
y2="112.09451"
gradientTransform="matrix(1.5312535,0,0,1.5312535,-101.03359,-43.835143)" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-89.879784,-99.596502)">
<rect
style="opacity:1;fill:#5685a2;fill-opacity:1;stroke:none;stroke-width:1.54531;stroke-linecap:round;stroke-linejoin:round"
id="rect857"
width="67.73333"
height="67.73333"
x="89.879784"
y="99.596504"
rx="8"
ry="8" />
<path
style="opacity:1;fill:#41647a;fill-opacity:1;stroke:none;stroke-width:5.84054;stroke-linecap:round;stroke-linejoin:round"
d="M 1.4863281,235.16602 C 5.4236166,247.28403 16.772079,256 30.236328,256 H 225.76367 c 13.46425,0 24.81271,-8.71597 28.75,-20.83398 C 249.05228,242.93596 240.02363,248 229.76367,248 H 26.236328 C 15.976374,248 6.9477232,242.93596 1.4863281,235.16602 Z"
transform="matrix(0.26458333,0,0,0.26458333,89.879783,99.596502)"
id="path1948" />
<path
style="opacity:1;fill:#80a4b9;fill-opacity:1;stroke:none;stroke-width:5.84054;stroke-linecap:round;stroke-linejoin:round"
d="M 30.236328,0 C 16.772079,0 5.4236166,8.7159737 1.4863281,20.833984 6.9477232,13.064041 15.976374,8 26.236328,8 H 229.76367 c 10.25996,0 19.28861,5.064041 24.75,12.833984 C 250.57638,8.7159737 239.22792,0 225.76367,0 Z"
transform="matrix(0.26458333,0,0,0.26458333,89.879783,99.596502)"
id="rect1925" />
<g
aria-label="UPDATER"
id="text2229"
style="font-size:7.05556px;line-height:1.25;font-family:'IBM Plex Mono';-inkscape-font-specification:'IBM Plex Mono';letter-spacing:0px;fill:#4b748e;stroke-width:0.529166" />
<g
aria-label="UPDATER"
id="text2429"
style="font-size:7.05556px;line-height:1.25;font-family:'IBM Plex Mono';-inkscape-font-specification:'IBM Plex Mono';letter-spacing:0px;stroke-width:0.529166" />
<g
id="g40301">
<path
style="fill:#4b748e;fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="m 131.52366,133.04382 -0.008,0.003 c -1.19585,0.60504 -2.01918,1.72259 -2.7621,2.80138 -1.76031,2.69762 -2.99037,5.69569 -4.13774,8.69301 -0.26674,0.71437 -0.52519,1.43176 -0.77721,2.15129 h 7.6848 z"
id="path24231" />
<path
style="fill:#4b748e;fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="m 126.54205,124.31257 5.3e-4,0.002 c -0.24246,-5.3e-4 -0.47971,0.005 -0.71107,0.0165 -0.30848,0.0159 -0.60607,0.0441 -0.89451,0.0827 -0.28845,0.0386 -0.56701,0.0887 -0.8351,0.15038 -0.26808,0.0617 -0.52615,0.13405 -0.77359,0.2191 -0.24744,0.085 -0.48459,0.18176 -0.71107,0.29043 -0.22646,0.1085 -0.44282,0.22959 -0.64802,0.36225 -0.20522,0.1326 -0.39928,0.27762 -0.58291,0.4346 -0.18363,0.15697 -0.35605,0.32532 -0.5178,0.50694 -0.16175,0.18163 -0.3126,0.37579 -0.45217,0.58239 -0.13949,0.2066 -0.26792,0.42595 -0.38499,0.65785 -0.117,0.23189 -0.22303,0.47679 -0.31729,0.73432 -0.0943,0.25753 -0.17688,0.5273 -0.24805,0.8108 -0.0712,0.28348 -0.13056,0.5806 -0.17828,0.89039 -0.0478,0.30978 -0.0835,0.63307 -0.10749,0.96945 -0.024,0.3364 -0.0367,0.68571 -0.0367,1.04903 v 16.12098 c 0,-0.831 0.66919,-1.49965 1.50017,-1.49965 h 2.21795 c 0.0504,-0.14649 0.0992,-0.29204 0.15038,-0.43874 0.29016,-0.83202 0.59253,-1.66669 0.90537,-2.49183 0.31282,-0.82515 0.63592,-1.64035 0.96842,-2.43396 0.16623,-0.3968 0.33533,-0.78877 0.50591,-1.17306 0.17058,-0.38431 0.34273,-0.76093 0.51728,-1.12964 0.17455,-0.36873 0.35155,-0.72947 0.52968,-1.07953 0.17814,-0.35006 0.35815,-0.69024 0.5395,-1.01854 0.18135,-0.32831 0.36411,-0.64424 0.54829,-0.94774 0.18418,-0.30348 0.36993,-0.59414 0.55656,-0.86972 0.18663,-0.27558 0.37354,-0.53622 0.56223,-0.78083 0.18872,-0.2446 0.37854,-0.47314 0.56896,-0.68368 0.19039,-0.21053 0.38139,-0.40279 0.57309,-0.57619 0.0958,-0.0866 0.1917,-0.16916 0.28784,-0.24598 0.0962,-0.0768 0.19252,-0.14894 0.28887,-0.21549 0.0963,-0.0666 0.1934,-0.12742 0.28991,-0.18345 0.0964,-0.0559 0.19278,-0.10601 0.28939,-0.1509 0.0966,-0.0448 0.1927,-0.0848 0.28938,-0.11834 0.0966,-0.0336 0.19373,-0.0614 0.29043,-0.0832 5.71795,-1.18525 11.90734,-1.78101 19.73988,1.39113 -1.23372,-0.67301 -2.43873,-1.31308 -3.61374,-1.91823 -1.17501,-0.60513 -2.31955,-1.1753 -3.43338,-1.70997 -1.11382,-0.53469 -2.19661,-1.03392 -3.24683,-1.49551 -1.0502,-0.46161 -2.06789,-0.88534 -3.05201,-1.27124 -0.49205,-0.19294 -0.97598,-0.37683 -1.45107,-0.55036 -0.47507,-0.17352 -0.94162,-0.33662 -1.3994,-0.49041 -0.4578,-0.15379 -0.907,-0.29779 -1.3472,-0.4315 -0.44023,-0.13368 -0.87167,-0.25771 -1.29398,-0.37103 -0.42232,-0.1133 -0.83562,-0.21591 -1.23972,-0.30851 -0.40411,-0.0926 -0.79935,-0.17444 -1.18494,-0.24598 -0.38558,-0.0715 -0.76134,-0.13276 -1.1281,-0.18294 -0.36679,-0.0502 -0.72411,-0.0893 -1.07177,-0.11782 -0.34764,-0.0284 -0.6862,-0.0463 -1.01441,-0.0527 -0.0821,-10e-4 -0.1636,-10e-4 -0.24443,-0.004 z"
id="path24233" />
<path
id="path24235"
style="fill:#4b748e;fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="m 125.33401,107.53393 -25.929226,25.92923 c 7.469116,-3.02498 13.438166,-2.61534 18.934946,-1.54383 0.007,-0.36756 0.0214,-0.73517 0.0451,-1.10227 0.14929,-1.99097 0.80649,-4.06144 2.32799,-5.43225 1.49435,-1.37389 3.58193,-1.85376 5.56203,-1.87934 2.95872,-0.0195 5.86182,0.72353 8.65917,1.62532 4.97559,1.64805 9.71434,3.92784 14.35096,6.35413 z" />
<path
id="path24237"
style="fill:#4b748e;fill-opacity:1;stroke-width:0.961888;stroke-linecap:round;stroke-linejoin:round"
d="m 120.6435,146.6924 h 28.74996 c 0.831,0 1.5,0.669 1.5,1.5 v 9.7 c 0,0.831 -0.669,1.5 -1.5,1.5 H 120.6435 c -0.83098,0 -1.49998,-0.669 -1.49998,-1.5 v -9.7 c 0,-0.831 0.669,-1.5 1.49998,-1.5 z" />
<path
id="path24243"
style="fill:#4b748e;fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="m 131.52366,133.04382 -0.008,0.003 c -1.19585,0.60504 -2.01918,1.72259 -2.7621,2.80138 -1.76031,2.69762 -2.99037,5.69569 -4.13774,8.69301 -0.26674,0.71437 -0.52519,1.43176 -0.77721,2.15129 h 1.3193 c 0.56481,-1.79909 1.18552,-3.59513 1.84175,-5.3356 0.15712,-0.41246 0.3336,-0.86247 0.48937,-1.24643 0.5525,-1.35828 1.1567,-2.69151 1.84795,-3.96669 0.58234,-1.05869 1.21013,-2.11008 2.0314,-2.95279 0.0517,-0.0492 0.10333,-0.0981 0.15503,-0.14727 z" />
<path
id="path24245"
style="fill:#4b748e;fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="m 126.54205,124.31257 5.3e-4,0.002 c -0.24246,-5.3e-4 -0.47971,0.005 -0.71107,0.0165 -0.30848,0.0159 -0.60607,0.0441 -0.89451,0.0827 -0.28845,0.0386 -0.56701,0.0887 -0.8351,0.15038 -0.26808,0.0617 -0.52615,0.13405 -0.77359,0.2191 -0.24744,0.085 -0.48459,0.18176 -0.71107,0.29043 -0.22646,0.1085 -0.44282,0.22959 -0.64802,0.36225 -0.20522,0.1326 -0.39928,0.27762 -0.58291,0.4346 -0.18363,0.15697 -0.35605,0.32532 -0.5178,0.50694 -0.16175,0.18163 -0.3126,0.37579 -0.45217,0.58239 -0.13949,0.2066 -0.26792,0.42595 -0.38499,0.65785 -0.117,0.23189 -0.22303,0.47679 -0.31729,0.73432 -0.0943,0.25753 -0.17688,0.5273 -0.24805,0.8108 -0.0712,0.28348 -0.13056,0.5806 -0.17828,0.89039 -0.0478,0.30978 -0.0835,0.63307 -0.10749,0.96945 -0.024,0.3364 -0.0367,0.68571 -0.0367,1.04903 v 1.05885 c 0,-0.36332 0.0127,-0.71262 0.0367,-1.04903 0.024,-0.33637 0.0597,-0.65967 0.10749,-0.96945 0.0477,-0.30979 0.10708,-0.60691 0.17828,-0.89039 0.0712,-0.2835 0.15375,-0.55327 0.24805,-0.8108 0.0943,-0.25753 0.2003,-0.50242 0.31729,-0.73432 0.11707,-0.2319 0.2455,-0.45124 0.38499,-0.65784 0.13957,-0.20661 0.29042,-0.40077 0.45217,-0.5824 0.16175,-0.18162 0.33417,-0.34997 0.5178,-0.50694 0.18363,-0.15697 0.37769,-0.30201 0.58291,-0.4346 0.2052,-0.13266 0.42156,-0.25374 0.64802,-0.36225 0.22648,-0.10867 0.46363,-0.20543 0.71107,-0.29043 0.24744,-0.0851 0.50551,-0.1574 0.77359,-0.2191 0.26809,-0.0617 0.54665,-0.11178 0.8351,-0.15038 0.28844,-0.0386 0.58603,-0.0668 0.89451,-0.0827 0.23136,-0.0115 0.4686,-0.0171 0.71107,-0.0165 l -5.3e-4,-0.002 c 0.0808,0.003 0.16233,0.003 0.24443,0.004 0.32821,0.006 0.66677,0.0243 1.01441,0.0527 0.34766,0.0285 0.70497,0.0676 1.07177,0.11782 0.36676,0.0502 0.74252,0.11143 1.1281,0.18293 0.38559,0.0715 0.78083,0.15338 1.18494,0.24598 0.4041,0.0926 0.8174,0.19521 1.23972,0.30851 0.4223,0.11333 0.85374,0.23736 1.29397,0.37104 0.44021,0.13371 0.88941,0.27771 1.34721,0.4315 0.45778,0.15379 0.92433,0.31689 1.3994,0.49041 0.47509,0.17353 0.95902,0.35741 1.45107,0.55035 0.98412,0.3859 2.00181,0.80963 3.05201,1.27124 1.05021,0.46159 2.13302,0.96083 3.24683,1.49552 0.64426,0.30926 1.29997,0.63137 1.96474,0.96428 1.6201,0.36886 3.30709,0.88609 5.08238,1.60507 -1.23372,-0.67301 -2.43873,-1.31308 -3.61374,-1.91823 -1.17501,-0.60514 -2.31955,-1.1753 -3.43338,-1.70997 -1.11382,-0.53469 -2.19661,-1.03393 -3.24683,-1.49552 -1.0502,-0.46161 -2.06789,-0.88534 -3.05201,-1.27124 -0.49205,-0.19294 -0.97598,-0.37682 -1.45107,-0.55035 -0.47507,-0.17352 -0.94162,-0.33662 -1.3994,-0.49041 -0.4578,-0.15379 -0.907,-0.29779 -1.34721,-0.4315 -0.44023,-0.13368 -0.87167,-0.25772 -1.29397,-0.37104 -0.42232,-0.1133 -0.83563,-0.21591 -1.23972,-0.30851 -0.40411,-0.0926 -0.79935,-0.17444 -1.18494,-0.24598 -0.38558,-0.0715 -0.76134,-0.13275 -1.1281,-0.18293 -0.36679,-0.0502 -0.72411,-0.0893 -1.07177,-0.11782 -0.34764,-0.0284 -0.6862,-0.0463 -1.01441,-0.0527 -0.0821,-0.001 -0.1636,-0.001 -0.24443,-0.004 z" />
</g>
<g
id="g24229"
transform="translate(-65.399676,-20.276016)">
<path
style="opacity:1;fill:#0c4e92;fill-opacity:1;stroke:none;stroke-width:0.828083;stroke-linecap:round;stroke-linejoin:round"
d="m 398.57422,203.04883 -0.0293,0.0117 c -4.51975,2.28676 -7.63156,6.51057 -10.43945,10.58789 -6.65314,10.19573 -11.30216,21.52705 -15.63867,32.85547 -1.00815,2.69998 -1.985,5.41138 -2.9375,8.13086 h 29.04492 z"
id="path3962"
transform="matrix(0.26458333,0,0,0.26458333,89.879784,99.596502)" />
<path
style="opacity:1;fill:#108edc;fill-opacity:1;stroke:none;stroke-width:0.828083;stroke-linecap:round;stroke-linejoin:round"
d="m 379.74609,170.04883 0.002,0.006 c -0.91639,-0.002 -1.81307,0.0183 -2.6875,0.0625 -1.16591,0.0601 -2.29066,0.16661 -3.38086,0.3125 -1.09017,0.14589 -2.143,0.33524 -3.15625,0.56836 -1.01322,0.23319 -1.98862,0.50667 -2.92383,0.82812 -0.93521,0.32126 -1.83151,0.68694 -2.6875,1.09766 -0.85591,0.41011 -1.67366,0.86775 -2.44922,1.36914 -0.77563,0.50116 -1.50909,1.0493 -2.20312,1.64258 -0.69404,0.59327 -1.3457,1.22957 -1.95704,1.91601 -0.61133,0.68648 -1.18147,1.42029 -1.70898,2.20117 -0.52721,0.78085 -1.01261,1.60986 -1.45508,2.48633 -0.4422,0.87644 -0.84296,1.80205 -1.19922,2.77539 -0.35641,0.97334 -0.66851,1.99296 -0.9375,3.06446 -0.2691,1.07142 -0.49347,2.19437 -0.67383,3.36523 -0.18066,1.17082 -0.31561,2.39271 -0.40624,3.66406 -0.0907,1.27144 -0.13868,2.59167 -0.13868,3.96485 v 60.92968 c 0,-3.14078 2.52921,-5.66796 5.66992,-5.66796 h 8.38282 c 0.19043,-0.55364 0.375,-1.10375 0.56836,-1.65821 1.09666,-3.14464 2.23948,-6.29933 3.42187,-9.41797 1.18231,-3.11867 2.4035,-6.19974 3.66016,-9.19921 0.62827,-1.49972 1.2674,-2.98116 1.91211,-4.4336 0.64471,-1.45251 1.29536,-2.87598 1.95508,-4.26953 0.65971,-1.39359 1.3287,-2.75705 2.00195,-4.08008 0.67328,-1.32306 1.35364,-2.60879 2.03906,-3.84961 0.68542,-1.24085 1.37615,-2.43494 2.07227,-3.58203 0.69611,-1.14701 1.39814,-2.24555 2.10351,-3.28711 0.70541,-1.04156 1.41181,-2.02666 2.125,-2.95117 0.71324,-0.92447 1.4307,-1.78824 2.15039,-2.58398 0.71959,-0.79571 1.44145,-1.52237 2.16602,-2.17774 0.36208,-0.32731 0.72453,-0.63934 1.08789,-0.92969 0.36359,-0.29026 0.72764,-0.56292 1.0918,-0.81445 0.36396,-0.25172 0.73094,-0.48159 1.0957,-0.69336 0.36435,-0.21127 0.72861,-0.40065 1.09375,-0.57031 0.3651,-0.16932 0.72831,-0.32046 1.09375,-0.44727 0.3651,-0.12699 0.73218,-0.23206 1.09766,-0.31445 21.61118,-4.47969 45.00412,-6.73138 74.60742,5.25781 -4.66288,-2.54366 -9.21722,-4.96282 -13.65821,-7.25 -4.44098,-2.28714 -8.76681,-4.44209 -12.97656,-6.46289 -4.20971,-2.02087 -8.30215,-3.90775 -12.27148,-5.65234 -3.96926,-1.74467 -7.81565,-3.34617 -11.53516,-4.80469 -1.85972,-0.72922 -3.68876,-1.42422 -5.48437,-2.08008 -1.79554,-0.65582 -3.55887,-1.27226 -5.28907,-1.85351 -1.73026,-0.58126 -3.42801,-1.1255 -5.09179,-1.63086 -1.66386,-0.50525 -3.2945,-0.97405 -4.89063,-1.40235 -1.59617,-0.42822 -3.15824,-0.81603 -4.68554,-1.16601 -1.52735,-0.34999 -3.02117,-0.6593 -4.47852,-0.92969 -1.45731,-0.27024 -2.87749,-0.50175 -4.26367,-0.69141 -1.3863,-0.18973 -2.73679,-0.33736 -4.05078,-0.44531 -1.31392,-0.10734 -2.59351,-0.17503 -3.83399,-0.19922 -0.3103,-0.004 -0.61836,-0.004 -0.92383,-0.0156 z"
id="path2082"
transform="matrix(0.26458333,0,0,0.26458333,89.879784,99.596502)" />
<path
id="path5286"
style="opacity:1;fill:url(#linearGradient12766);fill-opacity:1;stroke:none;stroke-width:0.219097;stroke-linecap:round;stroke-linejoin:round"
d="M 189.14623,127.80995 163.217,153.73918 c 7.46912,-3.02498 13.43817,-2.61534 18.93495,-1.54383 0.007,-0.36756 0.0214,-0.73517 0.0451,-1.10227 0.14929,-1.99097 0.80649,-4.06144 2.32799,-5.43225 1.49435,-1.37389 3.58193,-1.85376 5.56203,-1.87934 2.95872,-0.0195 5.86182,0.72353 8.65917,1.62532 4.97559,1.64805 9.71434,3.92784 14.35096,6.35413 z" />
<path
id="rect36345-4"
style="fill:#50e6ff;fill-opacity:1;stroke-width:0.961888;stroke-linecap:round;stroke-linejoin:round"
d="m 184.45572,166.96842 h 28.74996 c 0.831,0 1.5,0.669 1.5,1.5 v 9.7 c 0,0.831 -0.669,1.5 -1.5,1.5 h -28.74996 c -0.83098,0 -1.49998,-0.669 -1.49998,-1.5 v -9.7 c 0,-0.831 0.669,-1.5 1.49998,-1.5 z" />
<text
xml:space="preserve"
style="font-size:7.05556px;line-height:1.25;font-family:'IBM Plex Mono';-inkscape-font-specification:'IBM Plex Mono';letter-spacing:0px;stroke-width:0.529166"
x="183.91176"
y="175.73848"
id="text44288-9"><tspan
sodipodi:role="line"
id="tspan44286-7"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:7.05556px;font-family:'IBM Plex Mono';-inkscape-font-specification:'IBM Plex Mono Bold';stroke-width:0.529166"
x="183.91176"
y="175.73848">UPDATER</tspan></text>
<path
id="path14541"
style="opacity:1;fill:#0b4682;fill-opacity:1;stroke:none;stroke-width:0.828083;stroke-linecap:round;stroke-linejoin:round"
d="m 398.57422,203.04883 -0.0293,0.0117 c -4.51975,2.28676 -7.63156,6.51057 -10.43945,10.58789 -6.65314,10.19573 -11.30216,21.52705 -15.63867,32.85547 -1.00815,2.69998 -1.985,5.41138 -2.9375,8.13086 h 4.98632 c 2.13472,-6.79968 4.4807,-13.58787 6.96094,-20.16602 0.59384,-1.5589 1.26087,-3.25975 1.84961,-4.71094 2.08819,-5.13365 4.37178,-10.17264 6.98438,-14.99219 2.20097,-4.00138 4.57372,-7.97511 7.67773,-11.16015 0.1954,-0.18595 0.39054,-0.37069 0.58594,-0.55664 z"
transform="matrix(0.26458333,0,0,0.26458333,89.879784,99.596502)" />
<path
id="path17457"
style="opacity:1;fill:#0f82c9;fill-opacity:1;stroke:none;stroke-width:0.828083;stroke-linecap:round;stroke-linejoin:round"
d="m 379.74609,170.04883 0.002,0.006 c -0.91639,-0.002 -1.81307,0.0183 -2.6875,0.0625 -1.16591,0.0601 -2.29066,0.16661 -3.38086,0.3125 -1.09017,0.14589 -2.143,0.33524 -3.15625,0.56836 -1.01322,0.23319 -1.98862,0.50667 -2.92383,0.82812 -0.93521,0.32126 -1.83151,0.68694 -2.6875,1.09766 -0.85591,0.41011 -1.67366,0.86775 -2.44922,1.36914 -0.77563,0.50116 -1.50909,1.0493 -2.20312,1.64258 -0.69404,0.59327 -1.3457,1.22957 -1.95704,1.91601 -0.61133,0.68648 -1.18147,1.42029 -1.70898,2.20117 -0.52721,0.78085 -1.01261,1.60986 -1.45508,2.48633 -0.4422,0.87644 -0.84296,1.80205 -1.19922,2.77539 -0.35641,0.97334 -0.66851,1.99296 -0.9375,3.06446 -0.2691,1.07142 -0.49347,2.19437 -0.67383,3.36523 -0.18065,1.17082 -0.31562,2.39271 -0.40624,3.66406 -0.0907,1.27144 -0.13868,2.59167 -0.13868,3.96485 v 4.00195 c 0,-1.37318 0.048,-2.69337 0.13868,-3.96484 0.0906,-1.27132 0.22558,-2.49324 0.40624,-3.66407 0.18036,-1.17086 0.40473,-2.29381 0.67383,-3.36523 0.26899,-1.0715 0.58109,-2.09111 0.9375,-3.06445 0.35626,-0.97335 0.75705,-1.89892 1.19922,-2.77539 0.44247,-0.87648 0.92787,-1.70548 1.45508,-2.48633 0.52751,-0.78089 1.09765,-1.5147 1.70898,-2.20117 0.61134,-0.68644 1.263,-1.32275 1.95704,-1.91602 0.69403,-0.59327 1.42749,-1.14145 2.20312,-1.64258 0.77556,-0.50139 1.59331,-0.95902 2.44922,-1.36914 0.85599,-0.41072 1.75229,-0.7764 2.6875,-1.09766 0.93521,-0.32144 1.91061,-0.59492 2.92383,-0.82812 1.01325,-0.23308 2.06608,-0.42247 3.15625,-0.56836 1.0902,-0.14589 2.21495,-0.2524 3.38086,-0.3125 0.87443,-0.0435 1.77107,-0.0645 2.6875,-0.0625 l -0.002,-0.006 c 0.30547,0.0113 0.61353,0.0119 0.92383,0.0156 1.24048,0.0242 2.52007,0.0919 3.83399,0.19921 1.31399,0.1078 2.66445,0.25559 4.05078,0.44532 1.38618,0.18965 2.80636,0.42117 4.26367,0.6914 1.45735,0.27039 2.95117,0.57971 4.47852,0.92969 1.5273,0.34999 3.08937,0.7378 4.68554,1.16602 1.59613,0.42833 3.22677,0.89709 4.89063,1.40234 1.66378,0.50536 3.36153,1.04961 5.09179,1.63086 1.7302,0.58125 3.49353,1.19769 5.28907,1.85352 1.79561,0.65586 3.62465,1.35085 5.48437,2.08007 3.71951,1.45852 7.5659,3.06002 11.53516,4.80469 3.9693,1.74459 8.06181,3.63147 12.27148,5.65235 2.43499,1.16886 4.91329,2.38628 7.42578,3.64453 6.12323,1.3941 12.49924,3.34899 19.20899,6.0664 -4.66288,-2.54366 -9.21722,-4.96282 -13.65821,-7.25 -4.44098,-2.28714 -8.76681,-4.44209 -12.97656,-6.46289 -4.20971,-2.02087 -8.30215,-3.90775 -12.27148,-5.65234 -3.96926,-1.74467 -7.81565,-3.34617 -11.53516,-4.80469 -1.85972,-0.72922 -3.68876,-1.42422 -5.48437,-2.08008 -1.79554,-0.65582 -3.55887,-1.27226 -5.28907,-1.85351 -1.73026,-0.58126 -3.42801,-1.1255 -5.09179,-1.63086 -1.66386,-0.50525 -3.2945,-0.97405 -4.89063,-1.40235 -1.59617,-0.42822 -3.15825,-0.81603 -4.68554,-1.16601 -1.52735,-0.34999 -3.02117,-0.6593 -4.47852,-0.92969 -1.45731,-0.27024 -2.87749,-0.50175 -4.26367,-0.69141 -1.3863,-0.18973 -2.73679,-0.33736 -4.05078,-0.44531 -1.31392,-0.10734 -2.59351,-0.17503 -3.83399,-0.19922 -0.3103,-0.004 -0.61836,-0.004 -0.92383,-0.0156 z"
transform="matrix(0.26458333,0,0,0.26458333,89.879784,99.596502)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 20 KiB

510
msedge-updater Executable file
View File

@ -0,0 +1,510 @@
#!/bin/bash
#########################################################################
# #
# msedge-updater - Automatically update Microsoft Edge on Solus #
# #
# Dependencies: #
# bash #
# wget #
# git #
# gunzip #
# tar #
# coreutils (>= 8.32) #
# binutils (>=2.35.1) #
# procps (only BusyBox-based systems) #
# notify-send #
# #
# #
# Disclaimer: This version only works for amd64 architectures. #
# A later release may allow for update of Dev builds #
# and potentially both. #
# #
# Author: Ethan Smith-Coss #
# Version: 0.2.1 #
# Created: 2021-12-09T16:51+0000 #
# Last Modified: 2021-09-9T15:43+0100 #
# #
# #################################### #
# #
# msedge-updater - Automatically update Microsoft Edge on Solus #
# Copyright ©️ 2021 Ethan Smith-Coss #
# #
# 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, either version 3 of the License, or #
# (at your option) any later version. #
# #
# 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. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
#########################################################################
## program name
prog_name="Microsoft Edge Updater"
## version
version="0.2.1"
## usage statement
usage="Usage: $(basename $0) [OPTION]
$prog_name ($version) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
DISCLAIMER: Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures might be possible but not tested.
Options:
-nn, --no-notify Prevent notifications from being set after a session.
-c, --set-channel= Change the channel to be updated for Microsoft Edge. Will default to the value defined in source.list if flag is not present.
* beta - update Beta channel release.
* dev - update Dev channel release.
-q, --quiet Operate strictly with no output on STDOUT or STDERR, prompts will NOT assume yes however. Logging still occurs in background.
--mode= Set the mode of the program to be ran in. Default mode occurs without this flag.
* debug - run program in debug mode. (WIP)
--full-clean Remove all content generated by the updater after a session, this includes all logs.
-y, --yes-all Assume yes to all yes/no decisions.
-v, --version Print out the version of the script and exit.
-h, --help Print this help message and exit.
"
runtime_dir=$(realpath "${BASH_SOURCE[0]}" | xargs -r dirname)
## runtime locations
log_file="$runtime_dir/.log.1"
logs_dir="$runtime_dir/logs"
tmp_path="/tmp/microsoft-edge-autoupdater"
garbage="$tmp_path/garbage.tmp"
## program timer
SECONDS=0
## create the logs directory and tmp location if they don't already exist
[[ ! -d "$logs_dir" ]] && mkdir "$logs_dir"
[[ ! -d "$tmp_path" ]] && mkdir "$tmp_path"
# function responsible for cleaning up after a session execution
function clean_up {
log "DEBUG" "EXIT signal was raised, cleaning up system after session before exiting..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Cleaning up system after session..."
cp "$log_file" "$logs_dir/updater.log"
while read -r garbage_collection ; do
[[ -f "$garbage_collection" || -d "$garbage_collection" ]] && rm -r "$garbage_collection"
done < <(cat "$garbage")
[[ -f "$garbage" ]] && rm "$garbage"
log "CLEANER" "Finished cleaning up system after session. Nice and clean :D Goodbye." "$runtime_dir/logs/updater.log"
[[ ! $quiet -eq 0 ]] && echo "done. Goodbye."
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
log "END" "Total time for script execution was: $script_time" "$runtime_dir/logs/updater.log"
echo >> "$runtime_dir/logs/updater.log"
cat "$logs_dir/updater.log" >> "$logs_dir/updater.history"
[[ $debug_run -eq 0 ]] && cat "$logs_dir/updater.log"
}
# ensure that the restoration was sucessful in reverting the system back
function check_restoration {
[[ ! $1 -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && echo "failed." && >&2 echo "There was an error trying to restore system files." \
"Either there no back was made or another issue occurred. Consult $log_file for more information." ; exit $1 ; }
log "DEBUG" "System restoration was successful, safe to use; however, the update was still failed. Exiting...($2+$1)" \
"$log_file"
[[ ! $quiet -eq 0 ]] && echo "completed." && >&2 echo "However, there was still an issue trying to update Microsoft Edge" \
"($edge_channel) to the latest version. Consult $log_file for more information. Exiting..."
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "There was an issue installing the update to your system." \
"The previous version, v$current_version, has been restored."
echo "$backup_file" >>"$garbage"
}
## iterate over all user inputs
while test $# -gt 0 ; do
case $1 in
-nn | --no-notify)
nn_flag=0 ; shift
;;
-c | --set-channel=*)
## if long flag, check if value is equal to beta or dev, set flag respectfully if so
[[ "$1" =~ "beta" || "$1" =~ "dev" ]] && edge_channel=$(echo "$1" | cut -d= -f2)
## if short flag, check if the next value is beta or dev, set flag respectfully if so
[[ "$1" == "-c" && "$2" == "beta" || "$2" == "dev" ]] && edge_channel="$2"
shift
;;
-q | --quiet)
quiet=0 ; shift
;;
--full-clean)
echo -n "Fully cleaning system of generated content..."
[[ -d "$tmp_path" ]] && rm -rf "$tmp_path"
[[ -d "$runtime_dir/logs" ]] && rm -rf "$runtime_dir/logs"
echo "done."
exit 0
;;
--mode=*)
[[ "$1" == "--mode=debug" ]] && debug_run=0
shift
;;
-y | --yes-all)
yes_flag=0 ; shift
;;
-h | --help)
echo "$usage"
exit 0
;;
-v | --version)
echo "$prog_name ($version)"
exit 0
;;
*)
shift
;;
esac
done
## check if the script is being ran as root - exit otherwise
[[ $(id -u) -ne 0 ]] && { >&2 echo "Please run script with root privilages." ; exit 1 ; }
# set trap to trigger clean up function on any exit
trap clean_up EXIT
source "$runtime_dir/utils/common"
log "PREINIT" "----[New instance of script has been started: $(date -Iseconds)]----" "$log_file"
echo "$log_file" >> "$garbage"
# initialise all flags which require a value
## setup the yes flag to automatically accept all yes/no inputs
yes_flag=${yes_flag:-1}
log "DEBUG" "The yes flag has been set to: $yes_flag." "$log_file"
## setup the no-notify (nn) flag if notify-send isn't installed
command -v notify-send >/dev/null 2>&1 || nn_flag=0
nn_flag=${nn_flag:-1}
## set the debugging flag if not already
debug_run=${debug_run:-1}
[[ $debug_run -eq 0 ]] && log "DEBUG" "The mode flag has been set so script will operate in debug mode." "$log_file"
## setup the quiet flag to determine if program should be slient
quiet=${quiet:-1}
log "DEBUG" "The quiet flag has been set to: $quiet." "$log_file"
## ensure source.list exists
source_list="$runtime_dir/source.list"
log "DEBUG" "Checking for a source.list in current runtime directory..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Checking for source.list..."
[[ ! -f "$source_list" ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo -e "\nUpdater encountered an issue: source.list not found. Exiting..." ;
log "ERROR" "Cannot find source.list in runtime directory ($source_list). Exiting...(2)" "$log_file" ; exit 2 ; }
log "DEBUG" "Found a souce.list in $runtime_dir." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "found."
## set the channel flag
log "DEBUG" "Determining the channel of Edge and checking if it is installed to the system..."
edge_channel="${edge_channel:-$(grep -o "\[dists.*\]" "$source_list" | sed -E 's/\[dists=(.*)\]/\1/' | cut -d, -f2)}"
## if for some reason there is no value, exit 254
[[ "$edge_channel" == "" ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "There is no channel specified for Microsoft Edge. Please check the source.list file has a correct value, or use --set-channel to set the channel for that session." ;
log "ERROR" "Encountered an issue trying to determine the channel of Microsoft Edge to update on the system. source.list is potentially corrupt since no default value was found. Exiting...(254)" ; exit 254 ; }
## check if Microsoft Edge is already installed - :@Ethan: this is some Tom Foolery, Bashism Fuckery
command -v microsoft-edge-$edge_channel &>/dev/null
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "Microsoft Edge ($edge_channel) is not installed. Exiting updater..." ;
log "DEBUG" "Microsoft Edge ($edge_channel) not recognised as an installed program. Exiting...(1)" ; exit 1 ; }
log "DEBUG" "Microsoft Edge ($edge_channel) is installed to system. Proceeding with update..." "$log_file"
## ensure host is reachable
host=$(grep "\[host\]" "$source_list" | cut -d' ' -f 2)
log "DEBUG" "Checking if host is available according to defined value of [host]: $host..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Checking to see if the host is known and reachable..."
if ! wget --spider "$host" >/dev/null 2>&1 ; then
>&2 echo "Cannot reach end-point for distribution information. Check your Internet connection and try again. Exiting..."
log "DEBUG" "Upstream end-point is cannot be contacted. Potential Internet connection issue or end-point address ($dist_upstream). Exiting...(3)" "$log_file"
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "There seems to be an issue connecting to the end-point of Microsoft. Check your Internet connection and try again."
exit 3
fi
log "DEBUG" "Host is known and reachable. Continuing update to fetch data..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "host known and reachable: (host) $host"
## identify the end-point URL for distribution information
dist_upstream=$(grep "\[dists.*\]" "$source_list" | cut -d' ' -f 2-4 --output-delimiter '/')
archi=$(grep -o "\[dists.*\]" "$source_list" | sed -E 's/\[dists=(.*)\]/\1/' | cut -d, -f1)
log "DEBUG" "Fetching Packages file from $dist_upstream for $archi architectures..." "$log_file"
## fetch the file - :@Ethan: there's no reason to inform the user of this operation unless it fails
wget -a "$log_file" -O "$tmp_path/Packages.gz" "$dist_upstream/binary-$archi/Packages.gz"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "There was an issue retrieving the package information for the update. Please check $logs_dir/updater.log, for more information. Exiting..." ;
log "DEBUG" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release package information." "$log_file"
log "DEBUG" "Fetching Contents-$archi.gz from ${dist_upstream::-4}" "$log_file"
wget -a "$log_file" -O "$tmp_path/Contents-$archi.gz" "${dist_upstream::-4}/Contents-$archi.gz"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "There was an issue retrieving the package contents for the update. Please check $log_file/updater.log, so more information. Exiting..." ;
log "ERROR" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release contents information." "$log_file"
## decompress the packages file
log "DEBUG" "Uncompressing downloaded gz file using gunzip, $tmp_path/Packages.gz..." "$log_file"
## force gunzip to overwrite decompressed file if it already exists
gunzip -f "$tmp_path/Packages.gz" "$tmp_path/Contents-$archi.gz" >/dev/null 2>&1
log "DEBUG" "Successfully uncompressed content." "$log_file"
## get the most recent package entry from Packages list for Beta version of browser
log "DEBUG" "Identifying the most recent package information from Packages catelogue..." "$log_file"
## find the earliest entry for Edge Beta release
start_point=$(grep -n "Package:.*-$edge_channel" "$tmp_path/Packages" | tr '\n' ' ' | cut -d: -f1)
## make a list of all lines which are blank - used to identify end of package information entry
end_points=( $(grep -n '^\s*$' "$tmp_path/Packages" | sed 's/://g') )
## loop over all potential end points
for (( i=0 ; i<"${#end_points[@]}"; i++)) ; do
## if the end point is greater than start point, set $end_point to the index of i
### :@NOTE: this will more often then not be the first value in the array. However,
### if a dev release comes out before the next beta version, the package entry may be
### much later in the file. We break once the correct end point is found.
[[ "${end_points[$i]}" -gt $start_point ]] && end_point="${end_points[$i]}" && break
done
## adjust the start and end point values
((start_point--)) ; ((end_point++))
## this ensures end_point is set. :@Ethan: I could just test if the variable exists but I like the clarity of this for now
end_point="${end_point:--1}"
## if for some reason $end_point is set to -1, we have an issue with the Packages file and should exit
[[ $end_point -eq -1 ]] && { log "ERROR" "EOF reached and indexing out of bounds value has been set. Exiting...(5)" "$log_file" ; exit 255 ; }
## extrapolate the package information and save to Release
package_entry=$(awk -v start=$start_point -v end=$end_point 'NR>1*start&&NR<1*end' "$tmp_path/Packages" > "$tmp_path/Release")
log "DEBUG" "Extrapolated most recent package information entry from $tmp_path/Release. Package information selected is as below:" "$log_file"
## pretty print each line when appending to make it easier to read in log file
sed 's/^/ (Release Info) /' "$tmp_path/Release" | sed -E 's/(^\s*\(Release Info\)\s*$)/\1(END)/' >> "$log_file"
### :@Ethan: at this point we can start ensuring that a newer release is available, inform the user of the new size,
### check dependences, and just ensure the user wants to go ahead with the update.
## get the current version number and the version in Release
current_version=$(microsoft-edge-$edge_channel --version | cut -d' ' -f3)
release_version=$(grep 'Version' "$tmp_path/Release" | sed -E 's/Version:\s*(.*)-.*/\1/')
log "DEBUG" "Checking if there is an update available (release: $release_version) or if most recent version is already installed to the system..." "$log_file"
## compare the versions - using sort -V.
if [[ "$release_version" == "$current_version" ]]; then
upgradeable=1
else
[[ "$current_version" != "$(echo -e "$current_version\n$release_version" | sort -V | head -n2)" ]] && upgradeable=0
fi
## this should never be substituted to 1 - but it's a cover if the release version happens to be behind the current version
##"${upgradeable:=1}"
upgradeable=${upgradeable:-1}
## check if we can upgrade, can exit 1 for passive exit - exit not notifying a failure for another reason
if [[ $upgradeable -eq 1 ]] ; then
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
[[ ! $quiet -eq 0 ]] && >&2 echo "Most recent version of Microsoft Edge ($edge_channel) [v$current_version] is already installed on this system, no need to update. Finished in $script_time"
log "DEBUG" "Most recent version of Microsoft Edge ($edge_channel) is already installed to the system (v$current_version). Completed in $script_time. Exiting...(1)" "$log_file"
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "There is no newer version of Microsoft Edge ($edge_channel) to install. Newest version is already installed: v$current_version"
exit 0
fi
log "DEBUG" "There is a more recent release of Microsoft Edge ($edge_channel) available for download (v$release_version). Continuing with update." "$log_file"
[[ ! $quiet -eq 0 ]] && >&2 echo "Identified a new release of Microsoft Edge ($edge_channel) [Current: v$current_version. New: v$release_version]. Starting the download and installation process..."
## check if msedge process is already running
is_running="$(pidof msedge | xargs ps -ocmd -p | grep -m1 "msedge-$edge_channel")"
if [[ ! -z "$is_running" ]] ; then
log "DEBUG" "Identified running processes for msedge. Determining how script should handle process..." "$log_file"
if [[ ! $yes_flag -eq 0 ]] ; then
echo -n "Microsoft Edge ($edge_channel) is already open. To continue update, the browser must be closed. Are you sure you wish to proceed? [(Y)es/No]: " && read -n 1 choice ; echo
[[ $(echo $choice | awk '{print tolower($0)}') == "n" ]] && { log "DEBUG" "User opted against allowing the script to close Microsoft Edge ($edge_channel) by default. Exiting...(1)" "$log_file" ; exit 1 ; }
fi
log "DEBUG" "Confirmation has been given to proceed with killing Microsoft Edge ($edge_channel) processes. Killing msedge..." "$log_file"
kill_attempts=0
while [[ -n $(pidof msedge) ]] ; do
[[ $? -eq 0 && $kill_attempts -ge 1 ]] && {
log "WARNING" "Process is refusing to exit. Attempting to kill process again after 2 seconds..." "$log_file" ;
sleep 2 ; }
[[ $kill_attempts -eq 3 ]] && {
echo "There was an issue trying to close Microsoft Edge ($edge_channel). Please close the browser and restart the updater." ;
log "ERROR" "Process has refused to close $kill_attempts time(s). Update cannot continue in current state, exiting...(253)" "$log_file" ;
exit 253 ; }
pkill msedge
done
# killall_stdout="$(killall msedge 2>&1)"
# exit_code=$?
# [[ ! $exit_code -eq 0 ]] && {
## :@TODO: employ a similar mechanism to that created by Rob in autostart script (https://robmc.duckdns.org/git/robert/dotfiles/src/branch/master/.local/share/dwm/autostart.sh) to keep attempting to end msedge process if it refuses.
# if [[ "$killall_stdout" == "msedge: no process found" ]] ; then
# log "DEBUG" "Process has already been closed by another means, either by an external process or user."
# else
# pkill -9 msedge
# fi ; }
fi
log "DEBUG" "Microsoft Edge ($edge_channel) has been closed, either by yes flag enabled or by user decision. Process may not have been running thus never killed." "$log_file"
# Download the newest version of Microsoft Edge ($edge_channel)
## get the end-point for .deb file location and filename
pool=$(grep '\[pool\]' "$source_list" | cut -d' ' -f2)
filename=$(grep 'Filename:.*' "$tmp_path/Release" | cut -d' ' -f2)
url="$pool$filename" ## set URL to be concatenation of pool + filename
## check if the file end-point is actually reachable before trying to download
log "DEBUG" "Checking the following release version file end-point is accessible ($url)..." "$log_file"
### :@Ethan: This is trying to download the file for a response so effectively we will be doing the same work twice
### so is inefficient for testing if the end-point is reachable. ping and telnet are not suitable for this operation.
### An assumption will have to be made for now.
### :@Ethan: The above message has been addressed and wget commands for checking end-points has been changed from
### `wget -qO- [URL] >/dev/null 2>&1` to: `wget --spider [URL] >/dev/null 2>&1`. Check manpage for more about the
### spider argument.
if ! wget --spider "$url" >/dev/null 2>&1 ; then
[[ ! $quiet -eq 0 ]] && >&2 echo "Cannot reach end-point for latest release. Check your Internet connection and try again."
log "DEBUG" "Pool end-point is cannot be contacted. Potential Internet connection issue or end-point address ($url). Exiting...(5)" "$log_file"
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "There seems to be an issue connecting to the end-point of Microsoft. Check your Internet connection and try again."
exit 5
fi
log "DEBUG" "Pool is known and reachable. Beginning download..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "Host known and reachable: (download) $url"
## set filename to not be pool address but the name of file
filename=$(echo "$url" | rev | cut -d'/' -f1 | rev)
filesize=$(grep '^Size:.*' "$tmp_path/Release" | cut -d' ' -f2)
log "DEBUG" "Checking if user wishes to proceed with the update installation..." "$log_file"
## inform the user of the new download size before downloading
if [[ $yes_flag -eq 1 ]] ; then
echo -n "The following package will be installed, $filename [$filesize]. Are you sure you wish to continue? [(Y)es/No]: " && read -n 1 choice && echo
[[ "$(echo $choice | awk '{print tolower($0)}')" == "n" ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "The following update to Microsoft Edge ($edge_channel) v$release_version will not be installed. Exiting updater..." ;
log "DEBUG" "User opted out for updating from $current_version to $release_version. Exiting...(1)" "$log_file" ; exit 1 ; }
fi
log "DEBUG" "Confirmation has been given to proceed with the following update of Microsoft Edge ($edge_channel) [v$release_version]." "$log_file"
# download the debian file
log "DEBUG" "Checking if the file is already downloaded to the system..." "$log_file"
if [[ ! -f "$tmp_path/$filename" ]] ; then
log "DEBUG" "Downloading the latest release version [v$release_version], file: $filename (URL: $url)" "$log_file"
[[ ! $quiet -eq 0 ]] && echo "Downloading the following release file: $filename. This may take a moment..."
# wget_timed=$(\time --format "%x:%e" wget -a "$tmp_path/wget_dump.log" -O "$tmp_path/$filename" "$url" 2>&1)
wget -a "$tmp_path/wget_dump.log" --progress=bar --show-progress -O "$tmp_path/$filename" "$url"
exit_code=$? # $(echo $wget_timed | cut -d: -f1)
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "There was an issue downloading the Debian version of Microsoft Edge ($edge_channel)." \
"Please check $logs_dir/updater.log, for more information. Exiting update..." ;
log "DEBUG" "Encountered an issue with wget. Exiting...(6)" "$log_file" ; exit 6 ; }
awk -v end=$(grep -n '^\s*$' "$tmp_path/wget_dump.log" | tr '\n' ' ' | cut -d: -f1) 'NR>1*0&&NR<1*end+1' "$tmp_path/wget_dump.log" >> "$log_file"
log "DEBUG" "Download completed successfully, wget log shown above." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Download complete. Validating checksums..."
else
log "DEBUG" "File already downloaded to system. Skipped download and verifying checksum..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Latest Debian release file is downloaded to the system, skipping download. Validating checksums..."
fi
## add the .deb file to garbage list
echo "$tmp_path/$filename" >> "$garbage"
## verify the downloaded file
if [[ "$(sha256sum "$tmp_path/$filename" | cut -d' ' -f1)" != "$(grep 'SHA256:.*' "$tmp_path/Release" | cut -d' ' -f2)" ]] ; then
## automatically remove the file - :@Ethan: it's either corrupt or hazardous to the health of the system
rm "$tmp_path/$filename"
log "DEBUG" "Checksum (SHA256) failed and integrity of file lost. File has been removed as either corrupt or hazardous/dangerous. Exiting...(7)" "$log_file"
[[ ! $quiet -eq 0 ]] && echo "failed." && \
>&2 echo "The checksum (SHA256) failed for some reason and removed either because it was corrupt or dangerous. Exiting updater..."
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "There was an issue with the checksum to verify the latest release. The Debian file has been automatically removed to prevent potential danger to the system."
exit 7
fi
[[ ! $quiet -eq 0 ]] && echo "complete."
# unarchive the .deb file and extract data.tar.gz
log "DEBUG" "Unarchiving the downloaded DEB file ($tmp_path/$filename)..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Unzipping download..."
## use ar to unarchive .deb file
ar vx "$tmp_path/$filename" --output "$tmp_path" >/dev/null 2>&1
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && echo "incomplete." && \
>&2 echo "There was an issue unarchiving $filename. Exiting updater...\n" ;
log "ERROR" "There was an issue when unarchiving $filename. Exiting...(8)" "$log_file" ; exit 8 ; }
log "DEBUG" "Successfully unarchived $filename, decompressing the data.tar.gz file..." "$log_file"
## extract data from data.tar.gz
tar --overwrite -xf "$tmp_path/data.tar.xz" --directory "$tmp_path" 1>"$tmp_path/tar_dump.log" 2>>"$log_file"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { [[ ! $quiet -eq 0 ]] && echo "incomplete." && \
>&2 echo "There was an extracting data.tar.gz. Exiting updater..." ;
log "ERROR" "There was an issue when decompressing data.tar.gz using tar -xvf. Exiting...(8)" "$tmp_path" ; exit 8 ; }
log "DEBUG" "Successfully extracted files from data.tar.gz." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "completed."
## etc/ directory only contains a cron daily directory, remove it
[[ ! $quiet -eq 0 ]] && rm -r "$tmp_path/etc/"
## add data.tar.xz to the garbage list
echo "$tmp_path/data.tar.xz" >> "$garbage"
# compress archive the currently installed version of Edge ($edge_channel) for restoration on failure
log "DEBUG" "Creating an archive gzip tarball of system /opt/ and /usr/ directories..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Installing new version to system. This may take a few minutes..."
archive_system "microsoft/msedge-$edge_channel"
exit_code=$?
if [[ ! $exit_code -eq 0 ]] ; then
### :@Ethan: there was an issue with creating an archive, should probably inform the user to make a decision (unless -y is set)
[[ ! $quiet -eq 0 ]] && echo "failed." && >&2 echo "There was an issue creating a backup of the system. Exiting..."
log "ERROR" "There was an issue creating a gzip tarball of the system. Exiting...($exit_code)" "$log_file"
exit $exit_code
fi
log "DEBUG" "Successfully created an archive gzip tarball of the system. Safe to continue with installation." "$log_file"
### :@NOTE: used to terminate the program at a certain point for incremental testing of functionality recently added up to the point of this exit.
### exit 0
# install the new version to system
log "DEBUG" "Copying files to there appropriate location..." "$log_file"
cp -ar "$tmp_path/opt" "/" >>"$log_file" 2>&1
exit_code=$?
if [[ ! $exit_code -eq 0 ]] ; then
[[ ! $quiet -eq 0 ]] && echo "failed." && \
>&2 echo -n "There was an issue installing files to the system. Reverting to previous version..."
log "DEBUG" "There was an issue copying $tmp_path/opt/ file to system /opt/. Reverting system files and exiting...(9)" \
"$log_file"
## attempt restoration of system
restore_files "microsoft_msedge-$edge_channel"
return_code=$?
## check the restoration was successful
check_restoration $return_code 9
exit 9
fi
cp -ar "$tmp_path/usr" "/" >>"$log_file" 2>&1
exit_code=$?
if [[ ! $exit_code -eq 0 ]] ; then
[[ ! $quiet -eq 0 ]] && echo "failed." && \
>&2 echo -n "There was an issue installing files to the system. Reverting to previous version..."
log "DEBUG" "There was an issue copying $tmp_path/usr/ file to system /usr/. Reverting system files and exiting...(9)" \
"$log_file"
## attempt restoration of system
restore_files "microsoft_msedge-$edge_channel"
return_code=$?
## check the restoration was successful
check_restoration $return_code 9
exit 9
fi
log "DEBUG" "Successfully installed files to their appropriate location." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "installation complete."
## add directories usr/ and opt/ to garbage
echo "$tmp_path/usr" >> "$garbage"
echo "$tmp_path/opt" >> "$garbage"
## confirm the update was successful - try to restore system otherwise
if [[ "$(microsoft-edge-$edge_channel --version | cut -d' ' -f3)" != "$release_version" ]] ; then
log "ERROR" "There was an issue with the update and installation. Restoring to previous version..." "$log_file"
printf "Update was unsuccessful. Restoring to previous version..."
## attempt restoration of system
restore_files "microsoft_msedge-$edge_channel"
return_code=$?
## check the restoration was successful
check_restoration $return_code 11
exit 11
fi
## end of update. Inform user of time taken to complete, notify and log.
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
log "DEBUG" "Installation and update was successful (completed in: $script_time) and system can be cleaned up to remove any waste." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "Microsoft Edge ($edge_channel) has been successfully updated to the latest version: v$current_version -> v$release_version, in $script_time."
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge ($edge_channel) Update" "Successfully updated Microsoft Edge ($edge_channel) to the latest version: v$release_version"
# exit from script, clean up function is called by default exit of script (EOF)

289
msedge-updater.1 Normal file
View File

@ -0,0 +1,289 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "MSEDGE\-UPDATER" "1" "December 9, 2021" "updater 0.2.1" "User Manual"
.hy
.SH NAME
.PP
\f[C]msedge\-updater\f[R] \[em] Automatically update Microsoft Edge on
Solus
.SH SYNOPSIS
.PP
\f[B]\f[CB]msedge\-updater\f[B]\f[R] [ \f[I]option\f[R] ]
.SH OPTIONS
.IP \[bu] 2
\f[C]\-nn, \-\-no\-notify\f[R]
.PD 0
.P
.PD
Prevent notifications from being sent after a session.
.IP \[bu] 2
\f[C]\-c, \-\-set\-channel=\f[R]
.PD 0
.P
.PD
Change the channel to be updated for Microsoft Edge.
Will default to the value defined in \f[C]source.list\f[R] if flag is
not present.
.RS 2
.IP \[bu] 2
beta \- update the Beta channel release.
.IP \[bu] 2
dev \- update the Dev channel release.
.RE
.IP \[bu] 2
\f[C]\-q, \-\-quiet\f[R]
.PD 0
.P
.PD
Operate strictly with no output on \f[C]STDOUT\f[R] or \f[C]STDERR\f[R],
prompts will \f[B]NOT\f[R] assume yes however.
Logging still occurs in background.
.IP \[bu] 2
\f[C]\-\-mode=\f[R]
.PD 0
.P
.PD
Set the mode of the program to be ran in.
Default mode occurs without this flag.
.RS 2
.IP \[bu] 2
\f[B]\f[BI]debug\f[B]\f[R] \- run program in debug mode.
(\f[B]WIP\f[R])
.RE
.IP \[bu] 2
\f[C]\-\-full\-clean\f[R]
.PD 0
.P
.PD
Remove all content generated by the updater after a session, this
includes all logs.
.IP \[bu] 2
\f[C]\-y, \-\-yes\-all\f[R]
.PD 0
.P
.PD
Assume yes to all yes/no decisions.
.IP \[bu] 2
\f[C]\-v, \-\-version\f[R]
.PD 0
.P
.PD
Print out the version of the script and exit.
.IP \[bu] 2
\f[C]\-h, \-\-help\f[R]
.PD 0
.P
.PD
Print this help message and exit
.SH DESCRIPTION
.PP
Microsoft Edge Updater is a program which will download and update your
installation of Microsoft Edge to the latest release version identified.
The main script is \f[C]msedge\-updater\f[R] and while the system is
akin to a package manager, it\[cq]s much, much simpler.
.PP
Systems that run Debian\-based distros (using the \f[C]apt\f[R] package
manager) or Fedora/openSUSE (using the \f[C]dnf\f[R] package manager),
should install Microsoft Edge to their package manager according to the
official guide over at Microsoft Edge Insider \- Command line
installation (https://www.microsoftedgeinsider.com/en-us/download/).
.PP
For those systems that use the amd64 architecture but not the perviously
mentioned bases/distros, or package managers, may benefit from this
program.
\f[C]msedge\-updater\f[R] uses the Debian (\f[C].deb\f[R]) release
versions of Microsoft Edge and automatically installs them to your
system so you don\[cq]t have to again!
.SS NOTE
.PP
\f[C]msedge\-updater\f[R] must be ran with root privileges.
If the script fails to identify its elevation, it will exit and display
a message to STDOUT.
.SS DISCLAIMER!!
.PP
Currently this program has only updated Microsoft Edge for amd64
architectures, other architectures might be possible but not tested.
.SS Testing Systems
.PP
\f[C]msedge\-updater\f[R] has been known to successfully run, download
and update Microsoft Edge (Beta) on Solus 4.2 Fortitude, Kernel version
5.11.21\-179 and later.
.PP
The test environment is a custom Docker image built from the Alpine
base.
Due to certain dependencies of Microsoft Edge, \f[C]msedge\-updater\f[R]
will currently finish with exit code 11 on a successful session due to
the binary, \f[C]msedge\f[R], not being able to run.
This issue is only known for Busybox systems using \f[C]musl\f[R], and
not \f[C]glibc\f[R], which Microsoft Edge is built using.
.SH DEPENDENCIES
.IP \[bu] 2
bash
.IP \[bu] 2
wget
.IP \[bu] 2
git
.IP \[bu] 2
gunzip
.IP \[bu] 2
tar
.IP \[bu] 2
coreutils (>=8.32)
.IP \[bu] 2
binutils (>=2.35.1)
.IP \[bu] 2
procps (only Busybox\-based systems)
.SH FILES
.IP \[bu] 2
\f[C]source.list\f[R] \[em]
.RS 2
.PP
This file contains a list of URL end\-points to the official Microsoft
Edge packages page.
There are 3 lines with dedicated purposes:
.IP \[bu] 2
\f[C][host]\f[R] \[em]
.PD 0
.P
.PD
A URL to the front page of Microsoft\[cq]s Packages site, used to check
connectivity and if the site is reachable.
.IP \[bu] 2
\f[C][dists]\f[R] \[em]
.PD 0
.P
.PD
Most iconic line and resembles that of an APT entry for package
information.
This line can be broken into 4 parts
.RS 2
.IP "1." 3
\f[C][dists=amd64,<beta | dev>]\f[R] \[em]
.PD 0
.P
.PD
This tells the updater which package architecture it should download for
the system.
Comma delimited to that, determine which channel of Microsoft Edge to
update by default, and can be changed or override by flag arguments.
The default value of \f[C]dists\f[R] is \f[C]amd64,beta\f[R].
.IP "2." 3
\f[C]<https URL>\f[R] \[em]
.PD 0
.P
.PD
The URL which points to the distribution repository on the Microsoft
Packages server.
.IP "3." 3
\f[C]main\f[R] \[em]
.PD 0
.P
.PD
The main branch of the distribution repository.
.IP "4." 3
\f[C]stable\f[R] \[em]
.PD 0
.P
.PD
The type of release that should be installed to the system.
.RE
.IP \[bu] 2
\f[C][pool]\f[R] \[em]
.PD 0
.P
.PD
The prefix URL to the repository end\-point that stores the latest
releases.
The suffix comes from the Release information.
.RE
.IP \[bu] 2
\f[C]logs/\f[R] \[em]
.RS 2
.PP
This is a directory which holds the session and history logs.
.IP \[bu] 2
\f[C]logs/updater.log\f[R] \[em]
.PD 0
.P
.PD
A full report log of the previous update session.
Replaced after every next update session.
.IP \[bu] 2
\f[C]logs/updater.history\f[R] \[em]
.PD 0
.P
.PD
A history of all the previous update sessions.
Never replaced, only appended to after every next update session.
.RE
.IP \[bu] 2
\f[C]utils/\f[R] \[em]
.RS 2
.PP
Resource directory which contains any utility scripts.
These are stand\-alone; however, don\[cq]t have any specific purpose
being executed by a user.
.IP \[bu] 2
\f[C]utils/common\f[R] \[em]
.PD 0
.P
.PD
A utility file with common functions for the updater.
.RE
.SH EXIT STATUS
.IP \[bu] 2
0 \[em] Successful
.IP \[bu] 2
1 \[em] General Error (Errors not severe enough to the cause of the
updater to stop)
.IP \[bu] 2
2 \[em] Could not find \f[C]source.list\f[R] for the update
.IP \[bu] 2
3 \[em] Host could not be reached.
Check Internet connectivity and/or host URL
.IP \[bu] 2
4 \[em] Failed to download either the Packages information or Content
information files
.IP \[bu] 2
5 \[em] Pool end\-point could not be reached
.IP \[bu] 2
6 \[em] Failed to download the identified Debian (\f[C].deb\f[R]) file
from the host\[cq]s pool
.IP \[bu] 2
7 \[em] Checksum verification of Debian (\f[C].deb\f[R]) file failed.
At this point, the downloaded file is removed
.IP \[bu] 2
8 \[em] Failed to unarchive the Debian (\f[C].deb\f[R]) file or
decompress the \f[C]data.tar.gz\f[R] file
.IP \[bu] 2
9 \[em] Failed to copy the new files to the system.
At this point, the backup is restored to the system to prevent
corruption
.IP \[bu] 2
10 \[em] The archive function failed to create an archive of the system
.IP \[bu] 2
11 \[em] If the system successfully restored files on an update failure,
the updater will exit with this code stating the update failed but
restoration was successful
.IP \[bu] 2
12 \[em] The restore function failed to restore the files to their
original location
.IP \[bu] 2
254 \[em] The channel to update cannot be identified.
Most likely cause is \f[C]source.list\f[R] is corrupt and \f[C]\-c\f[R]
was not passed.
.IP \[bu] 2
255 \[em] EOF flag was set when reading the Packages information file
.IP \[bu] 2
Other \[em] an exit code not related to the updater may have been
raised.
Consult the logs to identify which command returned the exit code.
.SH AUTHORS
.IP \[bu] 2
Ethan Smith\-Coss
.SH CONTRIBUTORS
.IP \[bu] 2
Robert Morrison \[em] Documentation
.SS Contacting
.PP
All contacts should be done through Issues on Gitea.

158
msedge-updater.1.md Normal file
View File

@ -0,0 +1,158 @@
---
title: MSEDGE-UPDATER
section: 1
header: User Manual
footer: updater 0.2.1
date: December 9, 2021
---
# NAME
`msedge-updater` — Automatically update Microsoft Edge on Solus
# SYNOPSIS
**`msedge-updater`** [ _option_ ]
# OPTIONS
* `-nn, --no-notify`
Prevent notifications from being sent after a session.
* `-c, --set-channel=`
Change the channel to be updated for Microsoft Edge. Will default to the value defined in `source.list` if flag is not present.
* beta - update the Beta channel release.
* dev - update the Dev channel release.
* `-q, --quiet`
Operate strictly with no output on `STDOUT` or `STDERR`, prompts will __NOT__ assume yes however. Logging still occurs in background.
* `--mode=`
Set the mode of the program to be ran in. Default mode occurs without this flag.
* ___debug___ - run program in debug mode. (__WIP__)
* `--full-clean`
Remove all content generated by the updater after a session, this includes all logs.
* `-y, --yes-all`
Assume yes to all yes/no decisions.
* `-v, --version`
Print out the version of the script and exit.
* `-h, --help`
Print this help message and exit
# DESCRIPTION
Microsoft Edge Updater is a program which will download
and update your installation of Microsoft Edge to the latest release version identified.
The main script is `msedge-updater` and while the system is akin to a package manager,
it's much, much simpler.
Systems that run Debian-based distros (using the `apt` package manager)
or Fedora/openSUSE (using the `dnf` package manager),
should install Microsoft Edge to their package manager
according to the official guide over at
[Microsoft Edge Insider - Command line installation](https://www.microsoftedgeinsider.com/en-us/download/).
For those systems that use the amd64 architecture
but not the perviously mentioned bases/distros,
or package managers, may benefit from this program.
`msedge-updater` uses the Debian (`.deb`) release versions of Microsoft Edge
and automatically installs them to your system so you don't have to again!
## NOTE
`msedge-updater` must be ran with root privileges. If the script fails to identify its elevation,
it will exit and display a message to STDOUT.
### DISCLAIMER!!
Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures
might be possible but not tested.
### Testing Systems
`msedge-updater` has been known to successfully run,
download and update Microsoft Edge (Beta) on Solus 4.2 Fortitude,
Kernel version 5.11.21-179 and later.
The test environment is a custom Docker image built from the Alpine base. Due to certain dependencies
of Microsoft Edge, `msedge-updater` will currently finish with exit code 11 on a successful session due to
the binary, `msedge`, not being able to run. This issue is only known for Busybox systems using `musl`,
and not `glibc`, which Microsoft Edge is built using.
# DEPENDENCIES
* bash
* wget
* git
* gunzip
* tar
* coreutils (>=8.32)
* binutils (>=2.35.1)
* procps (only Busybox-based systems)
# FILES
* `source.list`
This file contains a list of URL end-points
to the official Microsoft Edge packages page.
There are 3 lines with dedicated purposes:
* `[host]`
A URL to the front page of Microsoft's Packages site,
used to check connectivity and if the site is reachable.
* `[dists]`
Most iconic line and resembles that of an APT entry for package information.
This line can be broken into 4 parts
1. `[dists=amd64,<beta | dev>]`
This tells the updater which package architecture it
should download for the system. Comma delimited to that, determine which
channel of Microsoft Edge to update by default, and can be changed or override
by flag arguments. The default value of `dists` is `amd64,beta`.
2. `<https URL>`
The URL which points to the distribution repository
on the Microsoft Packages server.
3. `main`
The main branch of the distribution repository.
4. `stable`
The type of release that should be installed to the system.
* `[pool]`
The prefix URL to the repository end-point that stores the latest releases.
The suffix comes from the Release information.
* `logs/`
This is a directory which holds the session and history logs.
* `logs/updater.log`
A full report log of the previous update session.
Replaced after every next update session.
* `logs/updater.history`
A history of all the previous update sessions.
Never replaced, only appended to after every next update session.
* `utils/`
Resource directory which contains any utility scripts.
These are stand-alone;
however, don't have any specific purpose being executed by a user.
* `utils/common`
A utility file with common functions for the updater.
# EXIT STATUS
* 0 — Successful
* 1 — General Error (Errors not severe enough to the cause of the updater to stop)
* 2 — Could not find `source.list` for the update
* 3 — Host could not be reached. Check Internet connectivity and/or host URL
* 4 — Failed to download either the Packages information or Content information files
* 5 — Pool end-point could not be reached
* 6 — Failed to download the identified Debian (`.deb`) file from the host's pool
* 7 — Checksum verification of Debian (`.deb`) file failed. At this point, the downloaded file is removed
* 8 — Failed to unarchive the Debian (`.deb`) file or decompress the `data.tar.gz` file
* 9 — Failed to copy the new files to the system. At this point, the backup is restored to the system to prevent corruption
* 10 — The archive function failed to create an archive of the system
* 11 — If the system successfully restored files on an update failure, the updater will exit with this code stating the update failed but restoration was successful
* 12 — The restore function failed to restore the files to their original location
* 254 — The channel to update cannot be identified. Most likely cause is `source.list` is corrupt and `-c` was not passed.
* 255 — EOF flag was set when reading the Packages information file
* Other — an exit code not related to the updater may have been raised. Consult the logs to identify which command returned the exit code.
# AUTHORS
* Ethan Smith-Coss
# CONTRIBUTORS
* Robert Morrison — Documentation
## Contacting
All contacts should be done through Issues on Gitea.

View File

@ -1,3 +1,3 @@
[host] https://packages.microsoft.com [host] https://packages.microsoft.com
[dists=amd64] https://packages.microsoft.com/repos/edge/dists stable main [dists=amd64,beta] https://packages.microsoft.com/repos/edge/dists stable main
[pool] https://packages.microsoft.com/repos/edge/ [pool] https://packages.microsoft.com/repos/edge/

365
updater
View File

@ -1,365 +0,0 @@
#!/bin/bash
#########################################################################
# #
# updater - Automatically update Microsoft Edge on Solus #
# #
# Dependencies: #
# wget #
# gunzip #
# tar #
# sort (coreutils >= 8.32) #
# #
# #
# Disclaimer: This version only works for MS Edge Beta. #
# A later release may allow for update of Dev builds #
# and potentially both. #
# #
# Author: Ethan Smith-Coss #
# Version: 0.1.2 #
# Created: 2021-05-20T16:47+0100 #
# Last Modified: 2021-05-23T21:18+0100 #
# #
# #################################### #
# #
# updater - Automatically update Microsoft Edge on Solus #
# Copyright ©️ 2021 Ethan Smith-Coss #
# #
# 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, either version 3 of the License, or #
# (at your option) any later version. #
# #
# 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. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
#########################################################################
## program name
prog_name="Microsoft Edge Updater"
## version
version="0.1.2"
## usage statement
usage="Usage: $(basename $0) [OPTION]
$prog_name ($version) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
DISCLAIMER: Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures.
Options:
-y, --yes-all Assume yes to all yes/no decisions.
-v, --version Print out the version of the script and exit.
--help Print this help message and exit
"
runtime_dir=$(realpath "${BASH_SOURCE[0]}" | xargs -r dirname)
log_file="$runtime_dir/.log.1"
logs_dir="$runtime_dir/logs"
tmp_path="/tmp/microsoft-edge-autoupdater"
garbage="$tmp_path/garbage.tmp"
SECONDS=0
[[ ! -d "$logs_dir" ]] && mkdir "$logs_dir"
[[ ! -d "$tmp_path" ]] && mkdir "$tmp_path"
function clean_up {
log "DEBUG" "EXIT signal was raised, cleaning up system after session before exiting..." "$log_file"
printf "Cleaning up system after session..."
cp "$log_file" "$logs_dir/updater.log" && rm "$log_file"
[[ -d "$tmp_path/opt" ]] && rm -r "$tmp_path/opt"
[[ -d "$tmp_path/usr" ]] && rm -r "$tmp_path/usr"
log "CLEANER" "Finished cleaning up system after session. Nice and clean :D Goodbye." "$runtime_dir/logs/updater.log"
echo "done. Goodbye."
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
log "END" "Total time for script execution was: $script_time" "$runtime_dir/logs/updater.log"
echo >> "$runtime_dir/logs/updater.log"
cat "$logs_dir/updater.log" >> "$logs_dir/updater.history"
}
## iterate over all user inputs
while test $# -gt 0 ; do
case $1 in
-y | --yes-all)
yes_flag=0 ; shift
;;
--help)
echo "$usage"
exit 0
;;
-v | --version)
echo "$prog_name ($version)"
exit 0
;;
*)
shift
;;
esac
done
source "$runtime_dir/utils/common"
log "PREINIT" "----[New instance of script has been started: $(date -Iseconds)]----" "$log_file"
## setup the yes flag to automatically accept all yes/no inputs
yes_flag="${yes_flag:-1}"
log "DEBUG" "The yes flag has been set to: $yes_flag." "$log_file"
# set trap to trigger clean up function on any exit
trap clean_up EXIT
## check if Microsoft Edge (Beta) is already installed
exit_code=$(command -v microsoft-edge-beta &>/dev/null)
[[ ! $exit_code -eq 0 ]] && { echo "Microsoft Edge (Beta) is not installed. Exiting updater..." ;
log "DEBUG" "Microsoft Edge (Beta) not recognised as an installed program. Exiting...(1)" ; exit 1 ; }
log "DEBUG" "Microsoft Edge (Beta) is installed to system. Proceeding with update..." "$log_file"
## ensure source.list exists
source_list="$runtime_dir/source.list"
log "DEBUG" "Checking for a source.list in current runtime directory..." "$log_file"
printf "Checking for source.list..."
[[ ! -f "$source_list" ]] && { echo -e "\nUpdater encountered an issue: source.list not found. Exiting..." ;
log "ERROR" "Cannot find source.list in runtime directory ($source_list). Exiting...(2)" "$log_file" ; exit 2 ; }
log "DEBUG" "Found a souce.list in $runtime_dir." "$log_file"
echo "found."
## ensure host is reachable
host=$(grep "\[host\]" "$source_list" | cut -d' ' -f 2)
log "DEBUG" "Checking if host is available according to defined value of [host]: $host..." "$log_file"
echo "Checking to see if the host is known and reachable..."
if ! wget --spider "$host" >/dev/null 2>&1 ; then
echo "Cannot reach end-point for distribution information. Check your Internet connection and try again. Exiting..."
log "DEBUG" "Upstream end-point is cannot be contacted. Potential Internet connection issue or end-point address ($dist_upstream). Exiting...(3)" "$log_file"
exit 3
fi
log "DEBUG" "Host is known and reachable. Continuing update to fetch data..." "$log_file"
echo "Host known and reachable: (host) $host"
## identify the end-point URL for distribution information
dist_upstream=$(grep "\[dists.*\]" "$source_list" | cut -d' ' -f 2-4 --output-delimiter '/')
archi=$(grep -o "\[dists.*\]" "$source_list" | sed -E 's/\[dists=(.*)\]/\1/')
log "DEBUG" "Fetching Packages file from $dist_upstream for $archi architectures..." "$log_file"
## fetch the file - :@Ethan: there's no reason to inform the user of this operation unless it fails
exit_code=$(wget -a "$log_file" -O "$tmp_path/Packages.gz" "$dist_upstream/binary-$archi/Packages.gz")
[[ ! $exit_code -eq 0 ]] && { echo "There was an issue retrieving the package information for the update. Please check $logs_dir/updater.log, for more information. Exiting..." ;
log "DEBUG" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release package information." "$log_file"
log "DEBUG" "Fetching Contents-$archi.gz from ${dist_upstream::-4}" "$log_file"
exit_code=$(wget -a "$log_file" -O "$tmp_path/Contents-$archi.gz" "${dist_upstream::-4}/Contents-$archi.gz")
[[ ! $exit_code -eq 0 ]] && { echo "There was an issue retrieving the package contents for the update. Please check $log_file/updater.log, so more information. Exiting..." ;
log "ERROR" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release contents information." "$log_file"
### :@TODO: continue with TODO list. Finish off above code section to ensure wget is successful and logging appropriately.
log "DEBUG" "Uncompressing downloaded gz file using gunzip, $tmp_path/Packages.gz..." "$log_file"
## force gunzip to overwrite decompressed file if it already exists
gunzip -f "$tmp_path/Packages.gz" "$tmp_path/Contents-$archi.gz" >/dev/null 2>&1
log "DEBUG" "Successfully uncompressed content." "$log_file"
## get the most recent package entry from Packages list for Beta version of browser
log "DEBUG" "Identifying the most recent package information from Packages catelogue..." "$log_file"
## find the earliest entry for Edge Beta release
start_point=$(grep -n 'Package:.*-beta' "$tmp_path/Packages" | tr '\n' ' ' | cut -d: -f1)
## make a list of all lines which are blank - used to identify end of package information entry
end_points=( $(grep -n '^\s*$' "$tmp_path/Packages" | sed 's/://g') )
## loop over all potential end points
for (( i=0 ; i<"${#end_points[@]}"; i++)) ; do
## if the end point is greater than start point, set $end_point to the index of i
### :@NOTE: this will more often then not be the first value in the array. However,
### if a dev release comes out before the next beta version, the package entry may be
### much later in the file. We break once the correct end point is found.
[[ "${end_points[$i]}" -gt $start_point ]] && end_point="${end_points[$i]}" && break
done
## adjust the start and end point values
((start_point--)) ; ((end_point++))
## this ensures end_point is set. :@Ethan: I could just test if the variable exists but I like the clarity of this for now
end_point="${end_point:--1}"
## if for some reason $end_point is set to -1, we have an issue with the Packages file and should exit
[[ $end_point -eq -1 ]] && { log "ERROR" "EOF reached and indexing out of bounds value has been set. Exiting...(5)" "$log_file" ; exit 255 ; }
## extrapolate the package information and save to Release
package_entry=$(awk -v start=$start_point -v end=$end_point 'NR>1*start&&NR<1*end' "$tmp_path/Packages" > "$tmp_path/Release")
log "DEBUG" "Extrapolated most recent package information entry from $tmp_path/Release. Package information selected is as below:" "$log_file"
## pretty print each line when appending to make it easier to read in log file
sed 's/^/ (Release Info) /' "$tmp_path/Release" | sed -E 's/(^\s*\(Release Info\)\s*$)/\1(END)/' >> "$log_file"
### :@Ethan: at this point we can start ensuring that a newer release is available, inform the user of the new size,
### check dependences, and just ensure the user wants to go ahead with the update.
## get the current version number and the version in Release
current_version=$(microsoft-edge-beta --version | cut -d' ' -f3)
release_version=$(grep 'Version' "$tmp_path/Release" | sed -E 's/Version:\s*(.*)-.*/\1/')
log "DEBUG" "Checking if there is an update available (release: $release_version) or if most recent version is already installed to the system..." "$log_file"
## compare the versions - using sort -V.
if [[ "$release_version" == "$current_version" ]]; then
upgradeable=1
else
[[ "$current_version" != "$(echo -e "$current_version\n$release_version" | sort -V | head -n2)" ]] && upgradeable=0
fi
## this should never be substituted to 1 - but it's a cover if the release version happens to be behind the current version
##"${upgradeable:=1}"
upgradeable=${upgradeable:-1}
## check if we can upgrade, can exit 1 for passive exit - exit not notifying a failure for another reason
if [[ $upgradeable -eq 1 ]] ; then
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
echo "Most recent version of Microsoft Edge (Beta) [v$current_version] is already installed on this system, no need to update. Finished in $script_time"
log "DEBUG" "Most recent version of Microsoft Edge (Beta) is already installed to the system (v$current_version). Completed in $script_time. Exiting...(1)" "$log_file"
exit 1
fi
log "DEBUG" "There is a more recent release of Microsoft Edge (Beta) available for download (v$release_version). Continuing with update."
echo "Identified a new release of Microsoft Edge (Beta) [Current: v$current_version. New: v$release_version]. Starting the download and installation process..."
## check if msedge process is already running
is_running=$(ps -aux | grep -oc 'msedge')
if [[ $is_running -gt 1 ]] ; then
log "DEBUG" "Identified running processes for msedge. Determining how script should handle process..." "$log_file"
if [[ ! $yes_flag -eq 0 ]] ; then
echo -n "Microsoft Edge (Beta) is already open. To continue update, the browser must be closed. Are you sure you wish to proceed? [(Y)es/No]: " && read -n 1 choice ; echo
[[ $(echo $choice | awk '{print tolower($0)}') == "n" ]] && { log "DEBUG" "User opted against allowing the script to close Microsoft Edge (Beta) by default. Exiting...(1)" "$log_file" ; exit 1 ; }
fi
log "DEBUG" "Confirmation has been given to proceed with killing Microsoft Edge (Beta) processes. Killing msedge..." "$log_file"
exit_code=$(killall msedge)
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "Process is refusing to exit. Sending SIGKILL signal." "$log_file" ;
pkill -9 msedge ; }
fi
log "DEBUG" "Microsoft Edge (Beta) has been closed, either by yes flag enabled or by user decision. Process may not have been running thus never killed." "$log_file"
# Download the newest version of Microsoft Edge (Beta)
## get the end-point for .deb file location and filename
pool=$(grep '\[pool\]' "$source_list" | cut -d' ' -f2)
filename=$(grep 'Filename:.*' "$tmp_path/Release" | cut -d' ' -f2)
url="$pool$filename" ## set URL to be concatenation of pool + filename
## check if the file end-point is actually reachable before trying to download
log "DEBUG" "Checking the following release version file end-point is accessible ($url)..." "$log_file"
### :@Ethan: This is trying to download the file for a response so effectively we will be doing the same work twice
### so is inefficient for testing if the end-point is reachable. ping and telnet are not suitable for this operation.
### An assumption will have to be made for now.
### :@Ethan: The above message has been addressed and wget commands for checking end-points has been changed from
### `wget -qO- [URL] >/dev/null 2>&1` to: `wget --spider [URL] >/dev/null 2>&1`. Check manpage for more about the
### spider argument.
if ! wget --spider "$url" >/dev/null 2>&1 ; then
echo "Cannot reach end-point for latest release. Check your Internet connection and try again."
log "DEBUG" "Pool end-point is cannot be contacted. Potential Internet connection issue or end-point address ($url). Exiting...(5)" "$log_file"
exit 5
fi
log "DEBUG" "Pool is known and reachable. Beginning download..." "$log_file"
echo "Host known and reachable: (download) $url"
## set filename to not be pool address but the name of file
filename=$(echo "$url" | rev | cut -d'/' -f1 | rev)
filesize=$(grep '^Size:.*' "$tmp_path/Release" | cut -d' ' -f2)
log "DEBUG" "Checking if user wishes to proceed with the update installation..." "$log_file"
## inform the user of the new download size before downloading
if [[ $yes_flag -eq 1 ]] ; then
echo -n "The following package will be installed, $filename [$filesize]. Are you sure you wish to continue? [(Y)es/No]: " && read -n 1 choice
[[ "$(echo $choice | awk '{print tolower($0)}')" == "n" ]] && { echo -e "\nThe following update to Microsoft Edge (Beta) v$release_version will not be installed. Exiting updater..." ;
log "DEBUG" "User opted out for updating from $current_version to $release_version. Exiting...(1)" "$log_file" ; exit 1 ; }
echo
fi
log "DEBUG" "Confirmation has been given to proceed with the following update of Microsoft Edge (Beta) [v$release_version]." "$log_file"
# download the debian file
log "DEBUG" "Checking if the file is already downloaded to the system..." "$log_file"
if [[ ! -f "$tmp_path/$filename" ]] ; then
log "DEBUG" "Downloading the latest release version [v$release_version], file: $filename (URL: $url)" "$log_file"
echo "Downloading the following release file: $filename. This may take a moment..."
wget_timed=$(\time --format "%x:%e" wget -a "$tmp_path/wget_dump.log" -O "$tmp_path/$filename" "$url" 2>&1)
exit_code=$(echo $wget_timed | cut -d: -f1)
[[ ! $exit_code -eq 0 ]] && { echo "There was an issue downloading the Debian version of Microsoft Edge (Beta)." \
"Please check $logs_dir/updater.log, for more information. Exiting update..." ;
log "DEBUG" "Encountered an issue with wget. Exiting...(6)" "$log_file" ; exit 6 ; }
awk -v end=$(grep -n '^\s*$' "$tmp_path/wget_dump.log" | tr '\n' ' ' | cut -d: -f1) 'NR>1*0&&NR<1*end+1' "$tmp_path/wget_dump.log" >> "$log_file"
log "DEBUG" "Download completed successfully in $(echo $wget_timed | cut -d' ' -f2)s, wget log below." "$log_file"
printf "Download complete in $(echo $wget_timed | cut -d' ' -f2)s. Validating checksums..."
else
log "DEBUG" "File already downloaded to system. Skipped download and verifying checksum..." "$log_file"
printf "Latest Debian release file is downloaded to the system, skipping download. Validating checksums..."
fi
## verify the downloaded file
if [[ "$(sha256sum "$tmp_path/$filename" | cut -d' ' -f1)" != "$(grep 'SHA256:.*' "$tmp_path/Release" | cut -d' ' -f2)" ]] ; then
## automatically remove the file - :@Ethan: it's either corrupt or hazardous to the health of the system
rm "$tmp_path/$filename"
log "DEBUG" "Checksum (SHA256) failed and integrity of file lost. File has been removed as either corrupt or hazardous/dangerous. Exiting...(7)" "$log_file"
echo -e "failed.\nThe checksum (SHA256) failed for some reason and removed either because it was corrupt or dangerous. Exiting updater...\n"
exit 7
fi
echo "complete."
# unarchive the .deb file and extract data.tar.gz
log "DEBUG" "Unarchiving the downloaded DEB file ($tmp_path/$filename)..." "$log_file"
printf "Unzipping download..."
## use ar to unarchive .deb file
exit_code=$(ar vx "$tmp_path/$filename" --output "$tmp_path" >/dev/null 2>&1)
[[ ! $exit_code -eq 0 ]] && { echo -e "incomplete.\nThere was an issue unarchiving $filename. Exiting updater...\n" ;
log "ERROR" "There was an issue when unarchiving $filename. Exiting...(8)" "$log_file" ; exit 8 ; }
log "DEBUG" "Successfully unarchived $filename, decompressing the data.tar.gz file..." "$log_file"
## extract data from data.tar.gz
exit_code=$(tar --overwrite -xvf "$tmp_path/data.tar.xz" --directory "$tmp_path" >>"$log_file" 2>&1)
[[ ! $exit_code -eq 0 ]] && { echo -e "incomplete.\nThere was an extracting data.tar.gz. Exiting updater...\n" ;
log "ERROR" "There was an issue when decompressing data.tar.gz using tar -xvf. Exiting...(8)" "$tmp_path" ; exit 8 ; }
log "DEBUG" "Successfully extracted files from data.tar.gz." "$log_file"
echo "completed."
## etc/ directory only contains a cron daily directory, remove it
rm -r "$tmp_path/etc/"
# compress archive the currently installed version of Edge (Beta) for restoration on failure
## :@TODO: compress everything on the system for a backup. Remove it if installation of new version was successful
log "DEBUG" "Creating an archive gzip tarball of system /opt/ and /usr/ directories..." "$log_file"
printf "Installing new version to system. This may take a few minutes..."
exit_code=$(archive_system "microsoft/msedge-beta")
if [[ ! $exit_code -eq 0 ]] ; then
### :@Ethan: there was an issue with creating an archive, should probably inform the user to make a decision (unless -y is set)
echo -e "failed.\nThere was an issue creating a backup of the system. Exiting..."
log "ERROR" "There was an issue creating a gzip tarball of the system. Exiting...($exit_code)" "$log_file"
exit $exit_code
fi
log "DEBUG" "Successfully created an archive gzip tarball of the system. Safe to continue with installation." "$log_file"
### :@NOTE: used to terminate the program at a certain point for incremental testing of functionality recently added up to the point of this exit.
#exit 0
# install the new version to system
log "DEBUG" "Copying files to there appropriate location..." "$log_file"
exit_code=$(cp -r "$tmp_path/opt" "/" >>"$log_file" 2>&1)
[[ ! $exit_code -eq 0 ]] && { echo -e "failed.\nThere was an issue installing files to the system. Reverting to previous version..." ;
log "DEBUG" "There was an issue copying $tmp_path/opt/ file to system /opt/. Reverting system files and exiting...(9)" "$log_file" ; restore_files && exit 9 ; }
exit_code=$(cp -r "$tmp_path/usr" "/" >>"$log_file" 2>&1)
[[ ! $exit_code -eq 0 ]] && { echo -e "failed.\nThere was an issue installing files to the system. Reverting to previous version..." ;
log "DEBUG" "There was an issue copying $tmp_path/usr/ file to system /usr/. Reverting system files and exiting...(9)" "$log_file" ; restore_files && exit 9 ; }
log "DEBUG" "Successfully installed files to their appropriate location." "$log_file"
echo "installation complete."
## confirm the update was successful - try to restore system otherwise
## :@TODO: validate new version has successfully installed properly - exit 12
if [[ "$(microsoft-edge-beta --version | cut -d' ' -f3)" != "$release_version" ]] ; then
log "ERROR" "There was an issue with the update and installation. Restoring to previous version..." "$log_file"
printf "Update was unsuccessful. Restoring to previous version..."
## attempt restoration of system
return_code=$(restore_files "microsoft/msedge-beta")
[[ $return_code -eq 12 ]] && { echo -e "failed.\nThere was an error trying to restore system files." \
"Either there no back was made or another issue occurred. Consult $log_file for more information." ; exit $return_code ; }
log "DEBUG" "System restoration was successful, safe to use; however, the update was still failed. Exiting...(11)" "$log_file"
echo -e "completed. However, there was still an issue trying to update Microsoft Edge (Beta) to the latest version." \
"Consult $log_file for more information. Exiting..."
exit 11
fi
elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
log "DEBUG" "Installation and update was successful (completed in: $script_time) and system can be cleaned up to remove any waste." "$log_file"
echo "Microsoft Edge (Beta) has been successfully updated to the latest version: v$release_version, in $script_time."

View File

@ -1,19 +1,21 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# common - Utility file with common functions for updater # # common - Utility file with common functions for msedge-updater #
# # # #
# Dependencies: # # Dependencies: #
# bash #
# coreutils (>=8.32) #
# tar # # tar #
# # # #
# # # #
# Author: Ethan Smith-Coss # # Author: Ethan Smith-Coss #
# Version: 0.1.2 # # Version: 0.1.4 #
# Created: 2021-05-20T16:47+0100 # # Created: 2021-05-20T16:47+0100 #
# Last Modified: 2021-05-23T23:06+0100 # # Last Modified: 2021-06-22T16:57+0100 #
# # # #
# #################################### # # #################################### #
# # # #
# common - Utility file with common functions for updater # # common - Utility file with common functions for msedge-updater #
# Copyright ©️ 2021 Ethan Smith-Coss # # Copyright ©️ 2021 Ethan Smith-Coss #
# # # #
# This program is free software: you can redistribute it and/or modify # # This program is free software: you can redistribute it and/or modify #
@ -31,8 +33,9 @@
# # # #
######################################################################### #########################################################################
# logging function called to log information to a file.
function log { function log {
local log_out=$(realpath "${0%/*}/../.log.1") local log_out=$(realpath "${0%/*}/.log.1")
[[ $# -eq 0 ]] && log "ERROR" "Log function was called without any arguments. Returning 1." "$log_out" && return 1 [[ $# -eq 0 ]] && log "ERROR" "Log function was called without any arguments. Returning 1." "$log_out" && return 1
[[ ! $# -eq 3 ]] && log "ERROR" "Log function expected at least 3 arguments, recieved $#. Returning 1." "$log_out" && return 1 [[ ! $# -eq 3 ]] && log "ERROR" "Log function expected at least 3 arguments, recieved $#. Returning 1." "$log_out" && return 1
$(echo "$(date -Iseconds) ($1): $2" >> "$3") >/dev/null 2>&1 $(echo "$(date -Iseconds) ($1): $2" >> "$3") >/dev/null 2>&1
@ -41,32 +44,77 @@ function log {
return 0 return 0
} }
# archive function used to create an archive compression of Microsoft Edge
function archive_system { function archive_system {
local log_out=$(realpath "${0%/*}/../.log.1") local log_out=$(realpath "${0%/*}/.log.1")
[[ -e $1 ]] && log "ERROR" "Archive function was called without any arguments." "$log_out" [[ -e $1 ]] && log "ERROR" "Archive function was called without any arguments." "$log_out"
local archive_output="$/tmp/microsoft-edge-autoupdater/$(echo $1 | sed 's/\//_/').tar.gz" local archive_output="/tmp/microsoft-edge-autoupdater/$(echo $1 | sed 's/\//_/').tar.gz"
[[ -f "$archive_output" ]] && return 0 [[ -f "$archive_output" ]] && return 0
exit_code=$(grep 'usr/.*' "/tmp/microsoft-edge-autoupdater/Contents-amd64" | tar --overwrite -cvzf "$archive_output" "/opt/$1/" >>"$log_out" 2>&1 ) ## identify the files required for compressing
usr_files="$(grep -E '^usr/.*beta.*$' "/tmp/microsoft-edge-autoupdater/Contents-amd64" | awk '{print "/" $1}')"
opt_files="$(ls -1 "/opt/$1/" | sed -E "s/^(.*)$/\/opt\/"$(echo $1 | sed 's/\//\\\//')"\/\1/g")"
### :@Ethan: we need to identify all the symlinked files and store them in a record. When we decompress we reinstate the symlinks.
## This file is only stored temporarily and any symlinks will be removed from the identified files for compression.
symlink_record="/tmp/microsoft-edge-autoupdater/symlink-record"
ls -l $opt_files $usr_files | grep -Eo ':.*->.*$' | sed 's/\s->\s/:/g' | cut -d' ' -f2- > "$symlink_record"
## remove identified symlink files from lists
while read -r record ; do
record=$(echo "$record" | cut -d: -f1)
[[ "$record" =~ \/usr\/ ]] && record=$(echo $record | sed 's/\//\\\//g') && usr_files=$(echo "$usr_files" | sed "s/^"$record"$//") && continue
[[ "$record" =~ \/opt\/ ]] && record=$(echo $record | sed 's/\//\\\//g') && opt_files=$(echo "$opt_files" | sed "s/^"$record"$//")
done < <(cat $symlink_record)
## use gzip compression to create the tarball archive
tar --overwrite -czf "$archive_output" $opt_files $usr_files > "/tmp/microsoft-edge-autoupdater/tar_dump.log" 2>>"$log_out"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "(Archive) There was an issue creating the archive file of system. Returning...(10)" "$log_out" ; return 10 ; } [[ ! $exit_code -eq 0 ]] && { log "ERROR" "(Archive) There was an issue creating the archive file of system. Returning...(10)" "$log_out" ; return 10 ; }
return 0 return 0
} }
# restoration function called at any point when the update fails during an installation process.
function restore_files { function restore_files {
local log_out=$(realpath "${0%/*}/../.log.1") local log_out=$(realpath "${0%/*}/.log.1")
[[ -e $1 ]] && log "ERROR" "Restore function was called without any arguments." "$log_out" [[ -e $1 ]] && log "ERROR" "Restore function was called without any arguments." "$log_out"
local backup_file="/tmp/microsoft-edge-autoupdater/$(echo $1 | 's/\/_/').tar.gz" backup_file="/tmp/microsoft-edge-autoupdater/$1.tar.gz"
[[ -f "$backup_file" ]] && { log "ERROR" "There is no backup of Microsoft Edge (Beta) identified. Restoration not possible." "$log_out" ; return 12 ; } [[ ! -f "$backup_file" ]] && { log "ERROR" "There is no backup of Microsoft Edge (Beta) identified. Restoration not possible." "$log_out" ; return 12 ; }
exit_code=$( tar -xvzf "$backup_file" "/" >>"$log_out" 2>&1)
## decompress the tarball archive using gzip and overwrite all files in the archive on the system
tar --overwrite -xzf "$backup_file" -C "/" > "/tmp/microsoft-edge-autoupdater/tar_dump.log" 2>>"$log_out"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue restoring pervious files to system." \ [[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue restoring pervious files to system." \
"The backup created will not be removed to allow for manual restoration. Returning...(12)" ; return 12 ; } "The backup created will not be removed to allow for manual restoration. Returning...(12)" ; return 12 ; }
## recreate the symlinks
log "DEBUG" "Re-establishing symlinks..." "$log_out"
symlink_record="/tmp/microsoft-edge-autoupdater/symlink-record"
while read -r record ; do
symlink="$(echo $record | cut -d':' -f1)"
symlink_to="$(echo $record | cut -d':' -f2)"
### :NOTE: symlinks may already exist from new update and theoretically could be different in a newer version. Remove them first
rm "$symlink"
## create new sylinks based on the restored files
ln -s "$symlink_to" "$symlink" >/dev/null 2>>"$log_out"
exit_code=$?
[[ ! $exit_code -eq 0 ]] && { log "ERROR" "There was an issue trying to create a symlink to "$symlink_to"" "$log_out" ; continue ; }
log "DEBUG" "Successfully created symlink: "$symlink" -> "$symlink_to"" "$log_out"
done < <(cat $symlink_record)
log "DEBUG" "Symlinks re-established." "$log_out"
return 0 return 0
} }
# notification function used to send the user a notification via the dbus
function notify { function notify {
## :@TODO: implement notification system. local log_out=$(realpath "${0%/*}/.log.1")
[[ $# -eq 0 ]] && log "ERROR" "Notify function was called without any arguments. Returning 1." "$log_out" && return 1
[[ ! $# -eq 2 ]] && log "ERROR" "Notify function expected at least 2 arguments, recieved $#. Returning 1." "$log_out" && return 1
notify-send "$1" "$2" >>"$log_out" 2>&1 && tput bel
exit_code=$?
[[ ! $exit_code -eq 0 ]] && log "ERROR" "There was an issue send a notification to the system." "$log_out"
return 0 return 0
} }