Compare commits

..

No commits in common. "main" and "0.1.3" have entirely different histories.
main ... 0.1.3

9 changed files with 194 additions and 620 deletions

1
.gitignore vendored
View File

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

View File

@ -1,47 +1,26 @@
![msedge-updater logo](./assets/msedge-updater-logo.svg) # (WIP) Microsoft Edge (Beta) Updater
An updater program which can install the latest available version of Microsoft Edge to non-Debian-based Linux distros.
# Microsoft Edge Updater Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures.
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: msedge-updater [OPTION] Usage: updater [OPTION]
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. Microsoft Edge Updater (0.1.3) - 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 can only update the Beta release of Microsoft Edge for amd64 architectures.
Options: Options:
-nn, --no-notify Prevent notifications from being set after a session. -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.
-h, --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 - `msedge-updater` * Script Name - updater
* Version - 0.2.1 * Version - 0.1.3 (Beta)
* Synopsis - update Microsoft Edge to the latest release. * Synopsis - update Microsoft Edge (Beta) to the latest release.
* Author(s) - Ethan Smith-Coss (ethan.sc@closedless.xyz) * Author(s) - Ethan Smith-Coss (No contact)
* Contributors - Robert Morrison, Documentation
* License - GNU GPLv3+ * 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.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,175 +0,0 @@
<?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>

Before

Width:  |  Height:  |  Size: 20 KiB

View File

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

View File

@ -1,32 +1,28 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# # # #
# msedge-updater - Automatically update Microsoft Edge on Solus # # updater - Automatically update Microsoft Edge on Solus #
# # # #
# Dependencies: # # Dependencies: #
# bash #
# wget # # wget #
# git #
# gunzip # # gunzip #
# tar # # tar #
# coreutils (>= 8.32) # # sort (coreutils >= 8.32) #
# binutils (>=2.35.1) #
# procps (only BusyBox-based systems) #
# notify-send # # notify-send #
# # # #
# # # #
# Disclaimer: This version only works for amd64 architectures. # # Disclaimer: This version only works for MS Edge Beta. #
# 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.1 # # Version: 0.1.3 #
# Created: 2021-12-09T16:51+0000 # # Created: 2021-05-20T16:47+0100 #
# Last Modified: 2021-09-9T15:43+0100 # # Last Modified: 2021-05-28T12:54+0100 #
# # # #
# #################################### # # #################################### #
# # # #
# msedge-updater - Automatically update Microsoft Edge on Solus # # 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,25 +42,18 @@
## program name ## program name
prog_name="Microsoft Edge Updater" prog_name="Microsoft Edge Updater"
## version ## version
version="0.2.1" version="0.1.3"
## 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.
DISCLAIMER: Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures might be possible but not tested. DISCLAIMER: Currently this program can only update the Beta release of Microsoft Edge for amd64 architectures.
Options: Options:
-nn, --no-notify Prevent notifications from being set after a session. -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.
-h, --help Print this help message and exit. -h, --help Print this help message and exit
" "
runtime_dir=$(realpath "${BASH_SOURCE[0]}" | xargs -r dirname) runtime_dir=$(realpath "${BASH_SOURCE[0]}" | xargs -r dirname)
@ -76,15 +65,16 @@ garbage="$tmp_path/garbage.tmp"
## program timer ## program timer
SECONDS=0 SECONDS=0
## create the logs directory and tmp location if they don't already exist
[[ ! -d "$logs_dir" ]] && mkdir "$logs_dir" [[ ! -d "$logs_dir" ]] && mkdir "$logs_dir"
[[ ! -d "$tmp_path" ]] && mkdir "$tmp_path" [[ ! -d "$tmp_path" ]] && mkdir "$tmp_path"
# function responsible for cleaning up after a session execution
function clean_up { function clean_up {
log "DEBUG" "EXIT signal was raised, cleaning up system after session before exiting..." "$log_file" 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..." printf "Cleaning up system after session..."
cp "$log_file" "$logs_dir/updater.log" 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"
while read -r garbage_collection ; do while read -r garbage_collection ; do
[[ -f "$garbage_collection" || -d "$garbage_collection" ]] && rm -r "$garbage_collection" [[ -f "$garbage_collection" || -d "$garbage_collection" ]] && rm -r "$garbage_collection"
@ -93,7 +83,7 @@ function clean_up {
log "CLEANER" "Finished cleaning up system after session. Nice and clean :D Goodbye." "$runtime_dir/logs/updater.log" log "CLEANER" "Finished cleaning up system after session. Nice and clean :D Goodbye." "$runtime_dir/logs/updater.log"
[[ ! $quiet -eq 0 ]] && echo "done. Goodbye." echo "done. Goodbye."
elapsed_time=$SECONDS elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s" script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s"
@ -101,50 +91,10 @@ function clean_up {
echo >> "$runtime_dir/logs/updater.log" echo >> "$runtime_dir/logs/updater.log"
cat "$logs_dir/updater.log" >> "$logs_dir/updater.history" 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 ## iterate over all user inputs
while test $# -gt 0 ; do while test $# -gt 0 ; do
case $1 in 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) -y | --yes-all)
yes_flag=0 ; shift yes_flag=0 ; shift
;; ;;
@ -156,6 +106,9 @@ while test $# -gt 0 ; do
echo "$prog_name ($version)" echo "$prog_name ($version)"
exit 0 exit 0
;; ;;
-nn | --no-notify)
nn_flag=0 ; shift
;;
*) *)
shift shift
;; ;;
@ -163,7 +116,7 @@ while test $# -gt 0 ; do
done done
## check if the script is being ran as root - exit otherwise ## 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 ; } [[ $(id -u) -ne 0 ]] && { echo "Please run script with root privilages." ; exit 1 ; }
# set trap to trigger clean up function on any exit # set trap to trigger clean up function on any exit
trap clean_up EXIT trap clean_up EXIT
@ -172,75 +125,60 @@ source "$runtime_dir/utils/common"
log "PREINIT" "----[New instance of script has been started: $(date -Iseconds)]----" "$log_file" log "PREINIT" "----[New instance of script has been started: $(date -Iseconds)]----" "$log_file"
echo "$log_file" >> "$garbage" echo "$log_file" >> "$garbage"
# initialise all flags which require a value
## setup the yes flag to automatically accept all yes/no inputs ## setup the yes flag to automatically accept all yes/no inputs
yes_flag=${yes_flag:-1} yes_flag=${yes_flag:-1}
log "DEBUG" "The yes flag has been set to: $yes_flag." "$log_file" 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 ## setup the no-notify (nn) flag if notify-send isn't installed
command -v notify-send >/dev/null 2>&1 || nn_flag=0 command -v notify-send >/dev/null 2>&1 || nn_flag=0
nn_flag=${nn_flag:-1} nn_flag=${nn_flag:-1}
## set the debugging flag if not already
debug_run=${debug_run:-1} ## check if Microsoft Edge (Beta) is already installed
[[ $debug_run -eq 0 ]] && log "DEBUG" "The mode flag has been set so script will operate in debug mode." "$log_file" exit_code=$(command -v microsoft-edge-beta &>/dev/null)
## setup the quiet flag to determine if program should be slient [[ ! $exit_code -eq 0 ]] && { echo "Microsoft Edge (Beta) is not installed. Exiting updater..." ;
quiet=${quiet:-1} log "DEBUG" "Microsoft Edge (Beta) not recognised as an installed program. Exiting...(1)" ; exit 1 ; }
log "DEBUG" "The quiet flag has been set to: $quiet." "$log_file" log "DEBUG" "Microsoft Edge (Beta) is installed to system. Proceeding with update..." "$log_file"
## ensure source.list exists ## ensure source.list exists
source_list="$runtime_dir/source.list" source_list="$runtime_dir/source.list"
log "DEBUG" "Checking for a source.list in current runtime directory..." "$log_file" log "DEBUG" "Checking for a source.list in current runtime directory..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Checking for source.list..." printf "Checking for source.list..."
[[ ! -f "$source_list" ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo -e "\nUpdater encountered an issue: source.list not found. Exiting..." ; [[ ! -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 "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" log "DEBUG" "Found a souce.list in $runtime_dir." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "found." 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 ## ensure host is reachable
host=$(grep "\[host\]" "$source_list" | cut -d' ' -f 2) 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" 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..." echo "Checking to see if the host is known and reachable..."
if ! wget --spider "$host" >/dev/null 2>&1 ; then 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..." 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" 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." [[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge (Beta) Update" "There seems to be an issue connecting to the end-point of Microsoft. Check your Internet connection and try again."
exit 3 exit 3
fi fi
log "DEBUG" "Host is known and reachable. Continuing update to fetch data..." "$log_file" log "DEBUG" "Host is known and reachable. Continuing update to fetch data..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "host known and reachable: (host) $host" echo "Host known and reachable: (host) $host"
## identify the end-point URL for distribution information ## identify the end-point URL for distribution information
dist_upstream=$(grep "\[dists.*\]" "$source_list" | cut -d' ' -f 2-4 --output-delimiter '/') 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) archi=$(grep -o "\[dists.*\]" "$source_list" | sed -E 's/\[dists=(.*)\]/\1/')
log "DEBUG" "Fetching Packages file from $dist_upstream for $archi architectures..." "$log_file" 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 ## 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=$(wget -a "$log_file" -O "$tmp_path/Packages.gz" "$dist_upstream/binary-$archi/Packages.gz")
exit_code=$? [[ ! $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..." ;
[[ ! $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" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release package information." "$log_file" log "DEBUG" "Successfully downloaded release package information." "$log_file"
log "DEBUG" "Fetching Contents-$archi.gz from ${dist_upstream::-4}" "$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=$(wget -a "$log_file" -O "$tmp_path/Contents-$archi.gz" "${dist_upstream::-4}/Contents-$archi.gz")
exit_code=$? [[ ! $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..." ;
[[ ! $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 "ERROR" "Encountered an issue with wget. Exiting...(4)" "$log_file" ; exit 4 ; }
log "DEBUG" "Successfully downloaded release contents information." "$log_file" log "DEBUG" "Successfully downloaded release contents information." "$log_file"
## decompress the packages 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" log "DEBUG" "Uncompressing downloaded gz file using gunzip, $tmp_path/Packages.gz..." "$log_file"
## force gunzip to overwrite decompressed file if it already exists ## 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 gunzip -f "$tmp_path/Packages.gz" "$tmp_path/Contents-$archi.gz" >/dev/null 2>&1
@ -249,7 +187,7 @@ log "DEBUG" "Successfully uncompressed content." "$log_file"
## get the most recent package entry from Packages list for Beta version of browser ## 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" log "DEBUG" "Identifying the most recent package information from Packages catelogue..." "$log_file"
## find the earliest entry for Edge Beta release ## find the earliest entry for Edge Beta release
start_point=$(grep -n "Package:.*-$edge_channel" "$tmp_path/Packages" | tr '\n' ' ' | cut -d: -f1) 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 ## 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') ) end_points=( $(grep -n '^\s*$' "$tmp_path/Packages" | sed 's/://g') )
## loop over all potential end points ## loop over all potential end points
@ -276,7 +214,7 @@ sed 's/^/ (Release Info) /' "$tmp_path/Release" | sed -E 's/(^\s*\(Release In
### check dependences, and just ensure the user wants to go ahead with the update. ### check dependences, and just ensure the user wants to go ahead with the update.
## get the current version number and the version in Release ## get the current version number and the version in Release
current_version=$(microsoft-edge-$edge_channel --version | cut -d' ' -f3) current_version=$(microsoft-edge-beta --version | cut -d' ' -f3)
release_version=$(grep 'Version' "$tmp_path/Release" | sed -E 's/Version:\s*(.*)-.*/\1/') 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" 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. ## compare the versions - using sort -V.
@ -292,50 +230,32 @@ upgradeable=${upgradeable:-1}
if [[ $upgradeable -eq 1 ]] ; then if [[ $upgradeable -eq 1 ]] ; then
elapsed_time=$SECONDS elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s" 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" 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 ($edge_channel) is already installed to the system (v$current_version). Completed in $script_time. Exiting...(1)" "$log_file" 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"
[[ ! $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" [[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge (Beta) Update" "There is no newer version of Microsoft Edge (Beta) to install. Newest version is already installed: v$current_version"
exit 0 exit 1
fi 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" log "DEBUG" "There is a more recent release of Microsoft Edge (Beta) available for download (v$release_version). Continuing with update."
[[ ! $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..." 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 ## check if msedge process is already running
is_running="$(pidof msedge | xargs ps -ocmd -p | grep -m1 "msedge-$edge_channel")" is_running=$(ps -aux | grep -oc 'msedge')
if [[ ! -z "$is_running" ]] ; then if [[ $is_running -gt 1 ]] ; 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 (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 ($edge_channel) by default. Exiting...(1)" "$log_file" ; exit 1 ; } [[ $(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 fi
log "DEBUG" "Confirmation has been given to proceed with killing Microsoft Edge ($edge_channel) processes. Killing msedge..." "$log_file" log "DEBUG" "Confirmation has been given to proceed with killing Microsoft Edge (Beta) processes. Killing msedge..." "$log_file"
exit_code=$(killall msedge)
kill_attempts=0 [[ ! $exit_code -eq 0 ]] && { log "ERROR" "Process is refusing to exit. Sending SIGKILL signal." "$log_file" ;
while [[ -n $(pidof msedge) ]] ; do pkill -9 msedge ; }
[[ $? -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 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" 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 ($edge_channel) # Download the newest version of Microsoft Edge (Beta)
## get the end-point for .deb file location and filename ## get the end-point for .deb file location and filename
pool=$(grep '\[pool\]' "$source_list" | cut -d' ' -f2) pool=$(grep '\[pool\]' "$source_list" | cut -d' ' -f2)
filename=$(grep 'Filename:.*' "$tmp_path/Release" | cut -d' ' -f2) filename=$(grep 'Filename:.*' "$tmp_path/Release" | cut -d' ' -f2)
@ -352,13 +272,13 @@ log "DEBUG" "Checking the following release version file end-point is accessible
### spider argument. ### spider argument.
if ! wget --spider "$url" >/dev/null 2>&1 ; then 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." 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" 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." [[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge (Beta) Update" "There seems to be an issue connecting to the end-point of Microsoft. Check your Internet connection and try again."
exit 5 exit 5
fi fi
log "DEBUG" "Pool is known and reachable. Beginning download..." "$log_file" log "DEBUG" "Pool is known and reachable. Beginning download..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "Host known and reachable: (download) $url" echo "Host known and reachable: (download) $url"
## set filename to not be pool address but the name of file ## set filename to not be pool address but the name of file
filename=$(echo "$url" | rev | cut -d'/' -f1 | rev) filename=$(echo "$url" | rev | cut -d'/' -f1 | rev)
@ -366,29 +286,29 @@ filesize=$(grep '^Size:.*' "$tmp_path/Release" | cut -d' ' -f2)
log "DEBUG" "Checking if user wishes to proceed with the update installation..." "$log_file" log "DEBUG" "Checking if user wishes to proceed with the update installation..." "$log_file"
## inform the user of the new download size before downloading ## inform the user of the new download size before downloading
if [[ $yes_flag -eq 1 ]] ; then 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 -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" ]] && { [[ ! $quiet -eq 0 ]] && >&2 echo "The following update to Microsoft Edge ($edge_channel) v$release_version will not be installed. Exiting updater..." ; [[ "$(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 ; } log "DEBUG" "User opted out for updating from $current_version to $release_version. Exiting...(1)" "$log_file" ; exit 1 ; }
echo
fi fi
log "DEBUG" "Confirmation has been given to proceed with the following update of Microsoft Edge ($edge_channel) [v$release_version]." "$log_file" 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 # download the debian file
log "DEBUG" "Checking if the file is already downloaded to the system..." "$log_file" log "DEBUG" "Checking if the file is already downloaded to the system..." "$log_file"
if [[ ! -f "$tmp_path/$filename" ]] ; then if [[ ! -f "$tmp_path/$filename" ]] ; then
log "DEBUG" "Downloading the latest release version [v$release_version], file: $filename (URL: $url)" "$log_file" 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..." 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_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=$? # $(echo $wget_timed | cut -d: -f1) [[ ! $exit_code -eq 0 ]] && { echo "There was an issue downloading the Debian version of Microsoft Edge (Beta)." \
[[ ! $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..." ; "Please check $logs_dir/updater.log, for more information. Exiting update..." ;
log "DEBUG" "Encountered an issue with wget. Exiting...(6)" "$log_file" ; exit 6 ; } 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" 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" log "DEBUG" "Download completed successfully in $(echo $wget_timed | cut -d' ' -f2)s, wget log below." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Download complete. Validating checksums..." printf "Download complete in $(echo $wget_timed | cut -d' ' -f2)s. Validating checksums..."
else else
log "DEBUG" "File already downloaded to system. Skipped download and verifying checksum..." "$log_file" 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..." printf "Latest Debian release file is downloaded to the system, skipping download. Validating checksums..."
fi fi
## add the .deb file to garbage list ## add the .deb file to garbage list
echo "$tmp_path/$filename" >> "$garbage" echo "$tmp_path/$filename" >> "$garbage"
@ -398,113 +318,82 @@ if [[ "$(sha256sum "$tmp_path/$filename" | cut -d' ' -f1)" != "$(grep 'SHA256:.*
## automatically remove the file - :@Ethan: it's either corrupt or hazardous to the health of the system ## automatically remove the file - :@Ethan: it's either corrupt or hazardous to the health of the system
rm "$tmp_path/$filename" 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" 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." && \ echo -e "failed.\nThe checksum (SHA256) failed for some reason and removed either because it was corrupt or dangerous. Exiting updater...\n"
>&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 (Beta) 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."
[[ ! $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 exit 7
fi fi
[[ ! $quiet -eq 0 ]] && echo "complete." echo "complete."
# unarchive the .deb file and extract data.tar.gz # unarchive the .deb file and extract data.tar.gz
log "DEBUG" "Unarchiving the downloaded DEB file ($tmp_path/$filename)..." "$log_file" log "DEBUG" "Unarchiving the downloaded DEB file ($tmp_path/$filename)..." "$log_file"
[[ ! $quiet -eq 0 ]] && echo -n "Unzipping download..." printf "Unzipping download..."
## use ar to unarchive .deb file ## use ar to unarchive .deb file
ar vx "$tmp_path/$filename" --output "$tmp_path" >/dev/null 2>&1 exit_code=$(ar vx "$tmp_path/$filename" --output "$tmp_path" >/dev/null 2>&1)
exit_code=$? [[ ! $exit_code -eq 0 ]] && { echo -e "incomplete.\nThere was an issue unarchiving $filename. Exiting updater...\n" ;
[[ ! $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 "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" log "DEBUG" "Successfully unarchived $filename, decompressing the data.tar.gz file..." "$log_file"
## extract data from data.tar.gz ## 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=$(tar --overwrite -xvf "$tmp_path/data.tar.xz" --directory "$tmp_path" >>"$log_file" 2>&1)
exit_code=$? [[ ! $exit_code -eq 0 ]] && { echo -e "incomplete.\nThere was an extracting data.tar.gz. Exiting updater...\n" ;
[[ ! $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 "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" log "DEBUG" "Successfully extracted files from data.tar.gz." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "completed." echo "completed."
## etc/ directory only contains a cron daily directory, remove it ## etc/ directory only contains a cron daily directory, remove it
[[ ! $quiet -eq 0 ]] && rm -r "$tmp_path/etc/" rm -r "$tmp_path/etc/"
## add data.tar.xz to the garbage list ## add data.tar.xz to the garbage list
echo "$tmp_path/data.tar.xz" >> "$garbage" echo "$tmp_path/data.tar.xz" >> "$garbage"
# compress archive the currently installed version of Edge ($edge_channel) for restoration on failure # 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" 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..." printf "Installing new version to system. This may take a few minutes..."
archive_system "microsoft/msedge-$edge_channel" exit_code=$(archive_system "microsoft/msedge-beta")
exit_code=$?
if [[ ! $exit_code -eq 0 ]] ; then 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) ### :@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..." 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" log "ERROR" "There was an issue creating a gzip tarball of the system. Exiting...($exit_code)" "$log_file"
exit $exit_code exit $exit_code
fi fi
log "DEBUG" "Successfully created an archive gzip tarball of the system. Safe to continue with installation." "$log_file" 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. ### :@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 #exit 0
# install the new version to system # install the new version to system
log "DEBUG" "Copying files to there appropriate location..." "$log_file" log "DEBUG" "Copying files to there appropriate location..." "$log_file"
cp -ar "$tmp_path/opt" "/" >>"$log_file" 2>&1 exit_code=$(cp -r "$tmp_path/opt" "/" >>"$log_file" 2>&1)
exit_code=$? [[ ! $exit_code -eq 0 ]] && { echo -e "failed.\nThere was an issue installing files to the system. Reverting to previous version..." ;
if [[ ! $exit_code -eq 0 ]] ; then 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 ; }
[[ ! $quiet -eq 0 ]] && echo "failed." && \ exit_code=$(cp -r "$tmp_path/usr" "/" >>"$log_file" 2>&1)
>&2 echo -n "There was an issue installing files to the system. Reverting to previous version..." [[ ! $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 "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_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" log "DEBUG" "Successfully installed files to their appropriate location." "$log_file"
[[ ! $quiet -eq 0 ]] && echo "installation complete." echo "installation complete."
## add directories usr/ and opt/ to garbage ## add directories usr/ and opt/ to garbage
echo "$tmp_path/usr" >> "$garbage" echo "$tmp_path/usr" >> "$garbage"
echo "$tmp_path/opt" >> "$garbage" echo "$tmp_path/opt" >> "$garbage"
## confirm the update was successful - try to restore system otherwise ## confirm the update was successful - try to restore system otherwise
if [[ "$(microsoft-edge-$edge_channel --version | cut -d' ' -f3)" != "$release_version" ]] ; then ## :@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" 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..." printf "Update was unsuccessful. Restoring to previous version..."
## attempt restoration of system ## attempt restoration of system
restore_files "microsoft_msedge-$edge_channel" return_code=$(restore_files "microsoft/msedge-beta")
return_code=$? [[ $return_code -eq 12 ]] && { echo -e "failed.\nThere was an error trying to restore system files." \
## check the restoration was successful "Either there no back was made or another issue occurred. Consult $log_file for more information." ; exit $return_code ; }
check_restoration $return_code 11 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..."
[[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge (Beta) Update" "There was an issue installing the update to your system. The previous version, v$current_version, has been restored."
exit 11 exit 11
fi fi
## end of update. Inform user of time taken to complete, notify and log.
elapsed_time=$SECONDS elapsed_time=$SECONDS
script_time="$(($elapsed_time / 60))m $(($elapsed_time % 60))s" 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" 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." echo "Microsoft Edge (Beta) 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" [[ ! $nn_flag -eq 0 ]] && notify "Microsoft Edge (Beta) Update" "Successfully updated Microsoft Edge (Beta) to the latest version: v$release_version"
# exit from script, clean up function is called by default exit of script (EOF)

View File

@ -1,14 +1,13 @@
.\" Automatically generated by Pandoc 2.5 .\" Automatically generated by Pandoc 2.5
.\" .\"
.TH "MSEDGE\-UPDATER" "1" "December 9, 2021" "updater 0.2.1" "User Manual" .TH "UPDATER" "1" "May 24, 2021" "updater 0.1.3" "User Manual"
.hy .hy
.SH NAME .SH NAME
.PP .PP
\f[C]msedge\-updater\f[R] \[em] Automatically update Microsoft Edge on \f[C]updater\f[R] \[em] Automatically update Microsoft Edge on Solus
Solus
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\f[B]\f[CB]msedge\-updater\f[B]\f[R] [ \f[I]option\f[R] ] \f[B]\f[CB]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]
@ -16,59 +15,27 @@ Solus
.P .P
.PD .PD
Prevent notifications from being sent after a session. Prevent notifications from being sent after a session.
.IP \[bu] 2
\f[C]\-c, \-\-set\-channel=\f[R]
.PD 0 .PD 0
.P .P
.PD .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 .IP \[bu] 2
\f[C]\-y, \-\-yes\-all\f[R] \f[C]\-y, \-\-yes\-all\f[R]
.PD 0 .PD 0
.P .P
.PD .PD
Assume yes to all yes/no decisions. Assume yes to all yes/no decisions.
.PD 0
.P
.PD
.IP \[bu] 2 .IP \[bu] 2
\f[C]\-v, \-\-version\f[R] \f[C]\-v, \-\-version\f[R]
.PD 0 .PD 0
.P .P
.PD .PD
Print out the version of the script and exit. Print out the version of the script and exit.
.PD 0
.P
.PD
.IP \[bu] 2 .IP \[bu] 2
\f[C]\-h, \-\-help\f[R] \f[C]\-h, \-\-help\f[R]
.PD 0 .PD 0
@ -79,8 +46,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]msedge\-updater\f[R] and while the system is The main script is \f[C]updater\f[R] and while the system is akin to a
akin to a package manager, it\[cq]s much, much simpler. 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),
@ -91,48 +58,35 @@ 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]msedge\-updater\f[R] uses the Debian (\f[C].deb\f[R]) release \f[C]updater\f[R] uses the Debian (\f[C].deb\f[R]) release versions of
versions of Microsoft Edge and automatically installs them to your Microsoft Edge and automatically installs them to your system so you
system so you don\[cq]t have to again! don\[cq]t have to again!
.SS NOTE .SS NOTE
.PP .PP
\f[C]msedge\-updater\f[R] must be ran with root privileges. \f[C]updater\f[R] must be ran with root privilages.
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!!
.PP .PP
Currently this program has only updated Microsoft Edge for amd64 This version (0.1.3) only works for Microsoft Edge Beta on amd64
architectures, other architectures might be possible but not tested. architecture.
A later release may allow for update of Dev build and potentially both.
.SS Testing Systems .SS Testing Systems
.PP .PP
\f[C]msedge\-updater\f[R] has been known to successfully run, download \f[C]updater\f[R] has been known to successfully run, download and
and update Microsoft Edge (Beta) on Solus 4.2 Fortitude, Kernel version update Microsoft Edge (Beta) on Solus 4.2 Fortitude, Kernel version
5.11.21\-179 and later. 5.11.21\-179.
.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 .SH DEPENDENCIES
.IP \[bu] 2 .IP \[bu] 2
bash bash
.IP \[bu] 2 .IP \[bu] 2
wget wget
.IP \[bu] 2 .IP \[bu] 2
git
.IP \[bu] 2
gunzip gunzip
.IP \[bu] 2 .IP \[bu] 2
tar tar
.IP \[bu] 2 .IP \[bu] 2
coreutils (>=8.32) sort (>= 8.32)
.IP \[bu] 2
binutils (>=2.35.1)
.IP \[bu] 2
procps (only Busybox\-based systems)
.SH FILES .SH FILES
.IP \[bu] 2 .IP \[bu] 2
\f[C]source.list\f[R] \[em] \f[C]source.list\f[R] \[em]
@ -158,30 +112,27 @@ information.
This line can be broken into 4 parts This line can be broken into 4 parts
.RS 2 .RS 2
.IP "1." 3 .IP "1." 3
\f[C][dists=amd64,<beta | dev>]\f[R] \[em] \f[C][dists=amd64]\f[R] \-
.PD 0 .PD 0
.P .P
.PD .PD
This tells the updater which package architecture it should download for This tells the updater which package architecture it should download for
the system. 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 .IP "2." 3
\f[C]<https URL>\f[R] \[em] \f[C]<https URL>\f[R] \-
.PD 0 .PD 0
.P .P
.PD .PD
The URL which points to the distribution repository on the Microsoft The URL which points to the distribution repository on the Microsoft
Packages server. Packages server.
.IP "3." 3 .IP "3." 3
\f[C]main\f[R] \[em] \f[C]main\f[R] \-
.PD 0 .PD 0
.P .P
.PD .PD
The main branch of the distribution repository. The main branch of the distribution repository.
.IP "4." 3 .IP "4." 3
\f[C]stable\f[R] \[em] \f[C]stable\f[R] \-
.PD 0 .PD 0
.P .P
.PD .PD
@ -228,7 +179,7 @@ being executed by a user.
.PD 0 .PD 0
.P .P
.PD .PD
A utility file with common functions for the updater. A utility file with common functions for updater.
.RE .RE
.SH EXIT STATUS .SH EXIT STATUS
.IP \[bu] 2 .IP \[bu] 2
@ -269,21 +220,16 @@ restoration was successful
12 \[em] The restore function failed to restore the files to their 12 \[em] The restore function failed to restore the files to their
original location original location
.IP \[bu] 2 .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 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 the updater may have been Other \[em] an exit code not related to updater may have been raised.
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
Ethan Smith\-Coss Ethan Smith\-Coss
.SH CONTRIBUTORS .SH CONTRIBUTORS
.IP \[bu] 2 .IP \[bu] 2
Robert Morrison \[em] Documentation Robert Morrison \- Documentation
.SS Contacting .SS Contacting
.PP .PP
All contacts should be done through Issues on Gitea. All contacts should be done through Issues on Gitea.

View File

@ -1,31 +1,20 @@
--- ---
title: MSEDGE-UPDATER title: UPDATER
section: 1 section: 1
header: User Manual header: User Manual
footer: updater 0.2.1 footer: updater 0.1.3
date: December 9, 2021 date: May 24, 2021
--- ---
# NAME # NAME
`msedge-updater` — Automatically update Microsoft Edge on Solus `updater` — Automatically update Microsoft Edge on Solus
# SYNOPSIS # SYNOPSIS
**`msedge-updater`** [ _option_ ] **`updater`** [ _option_ ]
# OPTIONS # OPTIONS
* `-nn, --no-notify` * `-nn, --no-notify`
Prevent notifications from being sent after a session. 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` * `-y, --yes-all`
Assume yes to all yes/no decisions. Assume yes to all yes/no decisions.
* `-v, --version` * `-v, --version`
@ -37,7 +26,7 @@ date: December 9, 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 `msedge-updater` and while the system is akin to a package manager, The main script is `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,37 +38,29 @@ 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.
`msedge-updater` uses the Debian (`.deb`) release versions of Microsoft Edge `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
`msedge-updater` must be ran with root privileges. If the script fails to identify its elevation, `updater` must be ran with root privilages. 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!!
Currently this program has only updated Microsoft Edge for amd64 architectures, other architectures This version (0.1.3) only works for Microsoft Edge Beta on amd64 architecture.
might be possible but not tested. A later release may allow for update of Dev build and potentially both.
### Testing Systems ### Testing Systems
`msedge-updater` has been known to successfully run, `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.
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 # DEPENDENCIES
* bash * bash
* wget * wget
* git
* gunzip * gunzip
* tar * tar
* coreutils (>=8.32) * sort (>= 8.32)
* binutils (>=2.35.1)
* procps (only Busybox-based systems)
# FILES # FILES
* `source.list` * `source.list`
@ -94,17 +75,15 @@ and not `glibc`, which Microsoft Edge is built using.
* `[dists]` * `[dists]`
Most iconic line and resembles that of an APT entry for package information. Most iconic line and resembles that of an APT entry for package information.
This line can be broken into 4 parts This line can be broken into 4 parts
1. `[dists=amd64,<beta | dev>]` — 1. `[dists=amd64]` -
This tells the updater which package architecture it This tells the updater which package architecture it
should download for the system. Comma delimited to that, determine which should download for the system.
channel of Microsoft Edge to update by default, and can be changed or override 2. `<https URL>` -
by flag arguments. The default value of `dists` is `amd64,beta`.
2. `<https URL>`
The URL which points to the distribution repository The URL which points to the distribution repository
on the Microsoft Packages server. on the Microsoft Packages server.
3. `main` 3. `main` -
The main branch of the distribution repository. The main branch of the distribution repository.
4. `stable` 4. `stable` -
The type of release that should be installed to the system. The type of release that should be installed to the system.
* `[pool]` * `[pool]`
The prefix URL to the repository end-point that stores the latest releases. The prefix URL to the repository end-point that stores the latest releases.
@ -128,7 +107,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 the updater. A utility file with common functions for updater.
# EXIT STATUS # EXIT STATUS
* 0 — Successful * 0 — Successful
@ -144,15 +123,14 @@ and not `glibc`, which Microsoft Edge is built using.
* 10 — The archive function failed to create an archive of the system * 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 * 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 * 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 * 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. * Other — an exit code not related to updater may have been raised. Consult the logs to identify which command returned the exit code.
# AUTHORS # AUTHORS
* Ethan Smith-Coss * Ethan Smith-Coss
# CONTRIBUTORS # CONTRIBUTORS
* Robert Morrison Documentation * Robert Morrison - Documentation
## Contacting ## Contacting
All contacts should be done through Issues on Gitea. All contacts should be done through Issues on Gitea.

View File

@ -1,21 +1,19 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# common - Utility file with common functions for msedge-updater # # common - Utility file with common functions for updater #
# # # #
# Dependencies: # # Dependencies: #
# bash #
# coreutils (>=8.32) #
# tar # # tar #
# # # #
# # # #
# Author: Ethan Smith-Coss # # Author: Ethan Smith-Coss #
# Version: 0.1.4 # # Version: 0.1.3 #
# Created: 2021-05-20T16:47+0100 # # Created: 2021-05-20T16:47+0100 #
# Last Modified: 2021-06-22T16:57+0100 # # Last Modified: 2021-05-27T15:34+0100 #
# # # #
# #################################### # # #################################### #
# # # #
# common - Utility file with common functions for msedge-updater # # common - Utility file with common functions for 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 #
@ -33,7 +31,6 @@
# # # #
######################################################################### #########################################################################
# 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
@ -44,7 +41,6 @@ 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"
@ -52,68 +48,30 @@ function archive_system {
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
## identify the files required for compressing exit_code=$(grep 'usr/.*' "/tmp/microsoft-edge-autoupdater/Contents-amd64" | tar --overwrite -cvzf "$archive_output" "/opt/$1/" 2>>"$log_out")
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"
backup_file="/tmp/microsoft-edge-autoupdater/$1.tar.gz" local backup_file="/tmp/microsoft-edge-autoupdater/$(echo $1 | 's/\//_/').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" "/" 2>>"$log_out")
## 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") 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 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 [[ ! $# -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=$(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" [[ ! $exit_code -eq 0 ]] && log "ERROR" "There was an issue send a notification to the system." "$log_out"
return 0 return 0