program-rename (LTS) #1

Merged
TheOnePath merged 6 commits from program-rename into main 2022-02-20 14:37:21 +00:00
5 changed files with 56 additions and 53 deletions

View File

@ -1,14 +1,14 @@
<img src="msedge-updater-logo.png" width="150px" /> <img src="msedge-updater-logo.png" width="150px" />
# Microsoft Edge Updater # Microsoft Edge Updater
An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros. An updater program which can install the latest available version of Microsoft Edge to non-APT-based Linux distros.
Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures. Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures.
## Usage ## Usage
``` ```
Usage: updater [OPTION] Usage: msedge-updater [OPTION]
Microsoft Edge Updater (0.2.0) - 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 has only updated Microsoft Edge for amd64 architectures, other architectures might be possible but not tested. DISCLAIMER: Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures might be possible but not tested.
@ -20,7 +20,7 @@ Options:
-q, --quiet Operate strictly with no output on STDOUT or STDERR, prompts will NOT assume yes however. Logging still occurs in background. -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. --mode= Set the mode of the program to be ran in. Default mode occurs without this flag.
* debug - run program in debug mode. (WIP) * debug - run program in debug mode. (WIP)
--full-clean Remove all content generated by updater after a session, this includes all logs. --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.
-h, --help Print this help message and exit. -h, --help Print this help message and exit.
@ -28,19 +28,20 @@ Options:
## Information ## Information
* Program Name - Microsoft Edge Updater * Program Name - Microsoft Edge Updater
* Script Name - `updater` * Script Name - `msedge-updater`
* Version - 0.2.0 * Version - 0.2.1
* Synopsis - update Microsoft Edge 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)
* Contributors - Robert Morrison, Documentation * Contributors - Robert Morrison, Documentation
* License - GNU GPLv3+ * License - GNU GPLv3+
## Documentation ## Documentation
For more in-depth documentation on `updater`, view the manpage in markdown form [here](https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/src/branch/main/updater.1.md). 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. Alternatively you can view the manpage from your terminal by downloading the project.
```bash ```bash
$ git clone https://robmc.duckdns.org/git/TheOnePath/Microsoft-Edge-Updater/src/branch/main $ git clone https://git.closedless.xyz/ClosedLess/Microsoft-Edge-Updater/src/branch/main
$ cd Microsoft-Edge-Updater/ $ cd Microsoft-Edge-Updater/
$ man ./updater.1 $ man ./msedge-updater.1
``` ```

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# # # #
# updater - Automatically update Microsoft Edge on Solus # # msedge-updater - Automatically update Microsoft Edge on Solus #
# # # #
# Dependencies: # # Dependencies: #
# bash # # bash #
@ -15,18 +15,18 @@
# notify-send # # notify-send #
# # # #
# # # #
# Disclaimer: This version only works for MS Edge Beta. # # Disclaimer: This version only works for amd64 architectures. #
# A later release may allow for update of Dev builds # # A later release may allow for update of Dev builds #
# and potentially both. # # and potentially both. #
# # # #
# Author: Ethan Smith-Coss # # Author: Ethan Smith-Coss #
# Version: 0.2.0 # # Version: 0.2.1 #
# Created: 2021-05-20T16:47+0100 # # Created: 2021-12-09T16:51+0000 #
# Last Modified: 2021-06-24T15:49+0100 # # Last Modified: 2021-09-9T15:43+0100 #
# # # #
# #################################### # # #################################### #
# # # #
# updater - Automatically update Microsoft Edge on Solus # # msedge-updater - Automatically update Microsoft Edge on Solus #
# 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 #
@ -46,7 +46,7 @@
## program name ## program name
prog_name="Microsoft Edge Updater" prog_name="Microsoft Edge Updater"
## version ## version
version="0.2.0" version="0.2.1"
## usage statement ## usage statement
usage="Usage: $(basename $0) [OPTION] 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. $prog_name ($version) - An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
@ -61,7 +61,7 @@ Options:
-q, --quiet Operate strictly with no output on STDOUT or STDERR, prompts will NOT assume yes however. Logging still occurs in background. -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. --mode= Set the mode of the program to be ran in. Default mode occurs without this flag.
* debug - run program in debug mode. (WIP) * debug - run program in debug mode. (WIP)
--full-clean Remove all content generated by updater after a session, this includes all logs. --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.
-h, --help Print this help message and exit. -h, --help Print this help message and exit.
@ -302,8 +302,8 @@ log "DEBUG" "There is a more recent release of Microsoft Edge ($edge_channel) av
[[ ! $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..." [[ ! $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 ## check if msedge process is already running
is_running=$(ps -aux | grep -oc 'msedge') is_running="$(pidof msedge | xargs ps -ocmd -p | grep -m1 "msedge-$edge_channel")"

This check works, However I can see a false positive scenario occuring.
If a long running command contains msedge-$edge_channel then it will be included in the ouput of the check.

For example

watch pidof msedge-dev &
ps -aux | grep -oc "msedge-dev" # assume dev channel

Would give an output of 1 Even though msedge is not actually running.

I would suggest the use of a longer and slightly more verbose check.

pidof msedge | xargs ps -ocmd -p | grep -m1 "msedge-$edge_channel"

In this check we:

  • Use pidof msedge to return the PID(s) of any/all running msedge process(es)
  • Pipe the PID(s) to xargs, which uses ps to get the cmdline
    • We need xargs to position the PID(s)
    • The ps flag -ocmddefines the output as just the cmdline
    • The ps flag -p tells ps to just look for the given PID(s)
  • Grep for a maximum of one match for the given edge channel

It's also uneccesary to use the count flag in grep since no matches returns an empty result which is easy to test for.
EDIT: fix minortypo

This check works, However I can see a false positive scenario occuring. If a long running command contains `msedge-$edge_channel` then it will be included in the ouput of the check. For example ```bash watch pidof msedge-dev & ps -aux | grep -oc "msedge-dev" # assume dev channel ``` Would give an output of 1 Even though msedge is not actually running. I would suggest the use of a longer and slightly more verbose check. ```bash pidof msedge | xargs ps -ocmd -p | grep -m1 "msedge-$edge_channel" ``` In this check we: - Use `pidof msedge` to return the PID(s) of any/all running msedge process(es) - Pipe the PID(s) to xargs, which uses ps to get the cmdline - We need xargs to position the PID(s) - The ps flag `-ocmd`defines the output as just the cmdline - The ps flag `-p` tells ps to just look for the given PID(s) - Grep for a maximum of one match for the given edge channel It's also uneccesary to use the count flag in grep since no matches returns an empty result which is easy to test for. EDIT: fix minortypo
if [[ $is_running -gt 1 ]] ; then if [[ ! -z "$is_running" ]] ; then
log "DEBUG" "Identified running processes for msedge. Determining how script should handle process..." "$log_file" log "DEBUG" "Identified running processes for msedge. Determining how script should handle process..." "$log_file"
if [[ ! $yes_flag -eq 0 ]] ; then 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 -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

View File

@ -1,13 +1,14 @@
.\" Automatically generated by Pandoc 2.5 .\" Automatically generated by Pandoc 2.5
.\" .\"
.TH "UPDATER" "1" "June 30, 2021" "updater 0.2.0" "User Manual" .TH "MSEDGE\-UPDATER" "1" "December 9, 2021" "updater 0.2.1" "User Manual"
.hy .hy
.SH NAME .SH NAME
.PP .PP
\f[C]updater\f[R] \[em] Automatically update Microsoft Edge on Solus \f[C]msedge\-updater\f[R] \[em] Automatically update Microsoft Edge on
Solus
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\f[B]\f[CB]updater\f[B]\f[R] [ \f[I]option\f[R] ] \f[B]\f[CB]msedge\-updater\f[B]\f[R] [ \f[I]option\f[R] ]
.SH OPTIONS .SH OPTIONS
.IP \[bu] 2 .IP \[bu] 2
\f[C]\-nn, \-\-no\-notify\f[R] \f[C]\-nn, \-\-no\-notify\f[R]
@ -54,8 +55,8 @@ Default mode occurs without this flag.
.PD 0 .PD 0
.P .P
.PD .PD
Remove all content generated by updater after a session, this includes Remove all content generated by the updater after a session, this
all logs. includes all logs.
.IP \[bu] 2 .IP \[bu] 2
\f[C]\-y, \-\-yes\-all\f[R] \f[C]\-y, \-\-yes\-all\f[R]
.PD 0 .PD 0
@ -78,8 +79,8 @@ Print this help message and exit
.PP .PP
Microsoft Edge Updater is a program which will download and update your Microsoft Edge Updater is a program which will download and update your
installation of Microsoft Edge to the latest release version identified. installation of Microsoft Edge to the latest release version identified.
The main script is \f[C]updater\f[R] and while the system is akin to a The main script is \f[C]msedge\-updater\f[R] and while the system is
package manager, it\[cq]s much, much simpler. akin to a package manager, it\[cq]s much, much simpler.
.PP .PP
Systems that run Debian\-based distros (using the \f[C]apt\f[R] package 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), manager) or Fedora/openSUSE (using the \f[C]dnf\f[R] package manager),
@ -90,12 +91,12 @@ installation (https://www.microsoftedgeinsider.com/en-us/download/).
For those systems that use the amd64 architecture but not the perviously For those systems that use the amd64 architecture but not the perviously
mentioned bases/distros, or package managers, may benefit from this mentioned bases/distros, or package managers, may benefit from this
program. program.
\f[C]updater\f[R] uses the Debian (\f[C].deb\f[R]) release versions of \f[C]msedge\-updater\f[R] uses the Debian (\f[C].deb\f[R]) release
Microsoft Edge and automatically installs them to your system so you versions of Microsoft Edge and automatically installs them to your
don\[cq]t have to again! system so you don\[cq]t have to again!
.SS NOTE .SS NOTE
.PP .PP
\f[C]updater\f[R] must be ran with root privileges. \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 If the script fails to identify its elevation, it will exit and display
a message to STDOUT. a message to STDOUT.
.SS DISCLAIMER!! .SS DISCLAIMER!!
@ -104,15 +105,15 @@ Currently this program has only updated Microsoft Edge for amd64
architectures, other architectures might be possible but not tested. architectures, other architectures might be possible but not tested.
.SS Testing Systems .SS Testing Systems
.PP .PP
\f[C]updater\f[R] has been known to successfully run, download and \f[C]msedge\-updater\f[R] has been known to successfully run, download
update Microsoft Edge (Beta) on Solus 4.2 Fortitude, Kernel version and update Microsoft Edge (Beta) on Solus 4.2 Fortitude, Kernel version
5.11.21\-179 and later. 5.11.21\-179 and later.
.PP .PP
The test environment is a custom Docker image built from the Alpine The test environment is a custom Docker image built from the Alpine
base. base.
Due to certain dependencies of Microsoft Edge, \f[C]updater\f[R] will Due to certain dependencies of Microsoft Edge, \f[C]msedge\-updater\f[R]
currently finish with exit code 11 on a successful session due to the will currently finish with exit code 11 on a successful session due to
binary, \f[C]msedge\f[R], not being able to run. 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 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. not \f[C]glibc\f[R], which Microsoft Edge is built using.
.SH DEPENDENCIES .SH DEPENDENCIES
@ -227,7 +228,7 @@ being executed by a user.
.PD 0 .PD 0
.P .P
.PD .PD
A utility file with common functions for updater. A utility file with common functions for the updater.
.RE .RE
.SH EXIT STATUS .SH EXIT STATUS
.IP \[bu] 2 .IP \[bu] 2
@ -274,7 +275,8 @@ was not passed.
.IP \[bu] 2 .IP \[bu] 2
255 \[em] EOF flag was set when reading the Packages information file 255 \[em] EOF flag was set when reading the Packages information file
.IP \[bu] 2 .IP \[bu] 2
Other \[em] an exit code not related to updater may have been raised. 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. Consult the logs to identify which command returned the exit code.
.SH AUTHORS .SH AUTHORS
.IP \[bu] 2 .IP \[bu] 2

View File

@ -1,16 +1,16 @@
--- ---
title: UPDATER title: MSEDGE-UPDATER
section: 1 section: 1
header: User Manual header: User Manual
footer: updater 0.2.0 footer: updater 0.2.1
date: June 30, 2021 date: December 9, 2021
--- ---
# NAME # NAME
`updater` — Automatically update Microsoft Edge on Solus `msedge-updater` — Automatically update Microsoft Edge on Solus
# SYNOPSIS # SYNOPSIS
**`updater`** [ _option_ ] **`msedge-updater`** [ _option_ ]
# OPTIONS # OPTIONS
* `-nn, --no-notify` * `-nn, --no-notify`
@ -25,7 +25,7 @@ date: June 30, 2021
Set the mode of the program to be ran in. Default mode occurs without this flag. Set the mode of the program to be ran in. Default mode occurs without this flag.
* ___debug___ - run program in debug mode. (__WIP__) * ___debug___ - run program in debug mode. (__WIP__)
* `--full-clean` * `--full-clean`
Remove all content generated by updater after a session, this includes all logs. Remove all content generated by the updater after a session, this includes all logs.
* `-y, --yes-all` * `-y, --yes-all`
Assume yes to all yes/no decisions. Assume yes to all yes/no decisions.
* `-v, --version` * `-v, --version`
@ -37,7 +37,7 @@ date: June 30, 2021
Microsoft Edge Updater is a program which will download Microsoft Edge Updater is a program which will download
and update your installation of Microsoft Edge to the latest release version identified. and update your installation of Microsoft Edge to the latest release version identified.
The main script is `updater` and while the system is akin to a package manager, The main script is `msedge-updater` and while the system is akin to a package manager,
it's much, much simpler. it's much, much simpler.
Systems that run Debian-based distros (using the `apt` package manager) Systems that run Debian-based distros (using the `apt` package manager)
@ -49,12 +49,12 @@ according to the official guide over at
For those systems that use the amd64 architecture For those systems that use the amd64 architecture
but not the perviously mentioned bases/distros, but not the perviously mentioned bases/distros,
or package managers, may benefit from this program. or package managers, may benefit from this program.
`updater` uses the Debian (`.deb`) release versions of Microsoft Edge `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! and automatically installs them to your system so you don't have to again!
## NOTE ## NOTE
`updater` must be ran with root privileges. If the script fails to identify its elevation, `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. it will exit and display a message to STDOUT.
### DISCLAIMER!! ### DISCLAIMER!!
@ -62,12 +62,12 @@ Currently this program has only updated Microsoft Edge for amd64 architectures,
might be possible but not tested. might be possible but not tested.
### Testing Systems ### Testing Systems
`updater` has been known to successfully run, `msedge-updater` has been known to successfully run,
download and update Microsoft Edge (Beta) on Solus 4.2 Fortitude, download and update Microsoft Edge (Beta) on Solus 4.2 Fortitude,
Kernel version 5.11.21-179 and later. 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 The test environment is a custom Docker image built from the Alpine base. Due to certain dependencies
of Microsoft Edge, `updater` will currently finish with exit code 11 on a successful session due to 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`, 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. and not `glibc`, which Microsoft Edge is built using.
@ -128,7 +128,7 @@ and not `glibc`, which Microsoft Edge is built using.
however, don't have any specific purpose being executed by a user. however, don't have any specific purpose being executed by a user.
* `utils/common` * `utils/common`
A utility file with common functions for updater. A utility file with common functions for the updater.
# EXIT STATUS # EXIT STATUS
* 0 — Successful * 0 — Successful
@ -146,7 +146,7 @@ and not `glibc`, which Microsoft Edge is built using.
* 12 — The restore function failed to restore the files to their original location * 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. * 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 * 255 — EOF flag was set when reading the Packages information file
* Other — an exit code not related to updater may have been raised. Consult the logs to identify which command returned the exit code. * 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 # AUTHORS
* Ethan Smith-Coss * Ethan Smith-Coss

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# common - Utility file with common functions for updater # # common - Utility file with common functions for msedge-updater #
# # # #
# Dependencies: # # Dependencies: #
# bash # # bash #
@ -15,7 +15,7 @@
# # # #
# #################################### # # #################################### #
# # # #
# 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 #