mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-06-06 07:52:46 +00:00
Compare commits
6 Commits
next
...
ref-ssh-pu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a70ae85b7 | ||
|
|
6172fba55f | ||
|
|
24c51bef34 | ||
|
|
fbacd622ee | ||
|
|
345d4fa146 | ||
|
|
fa71ef9002 |
@@ -98,10 +98,9 @@ You just fill in the blanks.
|
|||||||
Just create an empty directory and run the tests until you get a good result.
|
Just create an empty directory and run the tests until you get a good result.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone git@github.com:webinstall/webi-installers.git
|
git clone git@github.com:webinstall/packages.git
|
||||||
pushd ./webi-installers/
|
pushd packages
|
||||||
git submodule update --init
|
npm install
|
||||||
npm clean-install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -1,46 +1,35 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var GitHubish = require('./githubish.js');
|
var ghRelease = require('./github.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists Gitea Releases (w/ uploaded assets)
|
* Gets the releases for 'ripgrep'. This function could be trimmed down and made
|
||||||
|
* for use with any github release.
|
||||||
*
|
*
|
||||||
* @param {any} _request - deprecated
|
* @param request
|
||||||
* @param {String} owner
|
* @param {string} owner
|
||||||
* @param {String} repo
|
* @param {string} repo
|
||||||
* @param {String} baseurl
|
* @returns {PromiseLike<any> | Promise<any>}
|
||||||
* @param {String} [username]
|
|
||||||
* @param {String} [token]
|
|
||||||
*/
|
*/
|
||||||
async function getAllReleases(
|
function getAllReleases(request, owner, repo, baseurl) {
|
||||||
_request,
|
if (!baseurl) {
|
||||||
owner,
|
return Promise.reject('missing baseurl');
|
||||||
repo,
|
}
|
||||||
baseurl,
|
return ghRelease(request, owner, repo, baseurl + '/api/v1').then(
|
||||||
username = '',
|
function (all) {
|
||||||
token = '',
|
return all;
|
||||||
) {
|
},
|
||||||
baseurl = `${baseurl}/api/v1`;
|
);
|
||||||
let all = await GitHubish.getAllReleases({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
baseurl,
|
|
||||||
username,
|
|
||||||
token,
|
|
||||||
});
|
|
||||||
return all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getAllReleases;
|
module.exports = getAllReleases;
|
||||||
|
|
||||||
if (module === require.main) {
|
if (module === require.main) {
|
||||||
getAllReleases(
|
getAllReleases(
|
||||||
null,
|
require('@root/request'),
|
||||||
'root',
|
'coolaj86',
|
||||||
'pathman',
|
'go-pathman',
|
||||||
'https://git.rootprojects.org',
|
'https://git.coolaj86.com',
|
||||||
'',
|
|
||||||
'',
|
|
||||||
).then(
|
).then(
|
||||||
//getAllReleases(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
|
//getAllReleases(require('@root/request'), 'root', 'serviceman', 'https://git.rootprojects.org').then(
|
||||||
function (all) {
|
function (all) {
|
||||||
|
|||||||
@@ -1,41 +1,102 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('dotenv').config({ path: '.env' });
|
require('dotenv').config();
|
||||||
|
|
||||||
let GitHubish = require('./githubish.js');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists GitHub Releases (w/ uploaded assets)
|
* Lists GitHub Releases (w/ uploaded assets)
|
||||||
*
|
*
|
||||||
* @param {any} _request - deprecated
|
* @param request
|
||||||
* @param {String} owner
|
* @param {string} owner
|
||||||
* @param {String} repo
|
* @param {string} repo
|
||||||
* @param {String} [baseurl]
|
* @returns {PromiseLike<any> | Promise<any>}
|
||||||
* @param {String} [username]
|
|
||||||
* @param {String} [token]
|
|
||||||
*/
|
*/
|
||||||
async function getAllReleases(
|
async function getAllReleases(
|
||||||
_request,
|
request,
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
baseurl = 'https://api.github.com',
|
baseurl = 'https://api.github.com',
|
||||||
username = process.env.GITHUB_USERNAME || '',
|
|
||||||
token = process.env.GITHUB_TOKEN || '',
|
|
||||||
) {
|
) {
|
||||||
let all = await GitHubish.getAllReleases({
|
if (!owner) {
|
||||||
owner,
|
throw new Error('missing owner for repo');
|
||||||
repo,
|
}
|
||||||
baseurl,
|
if (!repo) {
|
||||||
username,
|
throw new Error('missing repo name');
|
||||||
token,
|
}
|
||||||
});
|
|
||||||
|
var req = {
|
||||||
|
url: `${baseurl}/repos/${owner}/${repo}/releases`,
|
||||||
|
json: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO I really don't like global config, find a way to do better
|
||||||
|
if (process.env.GITHUB_USERNAME) {
|
||||||
|
req.auth = {
|
||||||
|
user: process.env.GITHUB_USERNAME,
|
||||||
|
pass: process.env.GITHUB_TOKEN,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let resp = await request(req);
|
||||||
|
if (!resp.ok) {
|
||||||
|
console.error('Bad Resp Headers:', resp.headers);
|
||||||
|
console.error('Bad Resp Body:', resp.body);
|
||||||
|
throw new Error('the elusive releases BOOGEYMAN strikes again');
|
||||||
|
}
|
||||||
|
|
||||||
|
let gHubResp = resp.body;
|
||||||
|
let all = {
|
||||||
|
releases: [],
|
||||||
|
// todo make this ':baseurl' + ':releasename'
|
||||||
|
download: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
gHubResp.forEach(transformReleases);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e.message);
|
||||||
|
console.error('Error Headers:', resp.headers);
|
||||||
|
console.error('Error Body:', resp.body);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformReleases(release) {
|
||||||
|
for (let asset of release['assets']) {
|
||||||
|
let name = asset['name'];
|
||||||
|
let date = release['published_at']?.replace(/T.*/, '');
|
||||||
|
let download = asset['browser_download_url'];
|
||||||
|
|
||||||
|
// TODO tags aren't always semver / sensical
|
||||||
|
let version = release['tag_name'];
|
||||||
|
let channel;
|
||||||
|
if (release['prerelease']) {
|
||||||
|
// -rcX, -preview, -beta, etc will be checked in _webi/normalize.js
|
||||||
|
channel = 'beta';
|
||||||
|
}
|
||||||
|
let lts = /(\b|_)(lts)(\b|_)/.test(release['tag_name']);
|
||||||
|
|
||||||
|
all.releases.push({
|
||||||
|
name: name,
|
||||||
|
version: version,
|
||||||
|
lts: lts,
|
||||||
|
channel: channel,
|
||||||
|
date: date,
|
||||||
|
os: '', // will be guessed by download filename
|
||||||
|
arch: '', // will be guessed by download filename
|
||||||
|
ext: '', // will be normalized
|
||||||
|
download: download,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getAllReleases;
|
module.exports = getAllReleases;
|
||||||
|
|
||||||
if (module === require.main) {
|
if (module === require.main) {
|
||||||
getAllReleases(null, 'BurntSushi', 'ripgrep').then(function (all) {
|
getAllReleases(require('@root/request'), 'BurntSushi', 'ripgrep').then(
|
||||||
console.info(JSON.stringify(all, null, 2));
|
function (all) {
|
||||||
});
|
console.info(JSON.stringify(all, null, 2));
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,124 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
let GitHubish = module.exports;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists GitHub-Like Releases (w/ uploaded assets)
|
|
||||||
*
|
|
||||||
* @param {Object} opts
|
|
||||||
* @param {String} opts.owner
|
|
||||||
* @param {String} opts.repo
|
|
||||||
* @param {String} opts.baseurl
|
|
||||||
* @param {String} [opts.username]
|
|
||||||
* @param {String} [opts.token]
|
|
||||||
*/
|
|
||||||
GitHubish.getAllReleases = async function ({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
baseurl,
|
|
||||||
username = '',
|
|
||||||
token = '',
|
|
||||||
}) {
|
|
||||||
if (!owner) {
|
|
||||||
throw new Error('missing owner for repo');
|
|
||||||
}
|
|
||||||
if (!repo) {
|
|
||||||
throw new Error('missing repo name');
|
|
||||||
}
|
|
||||||
if (!baseurl) {
|
|
||||||
throw new Error('missing baseurl');
|
|
||||||
}
|
|
||||||
|
|
||||||
let url = `${baseurl}/repos/${owner}/${repo}/releases`;
|
|
||||||
let opts = {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'appplication/json',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (token) {
|
|
||||||
let userpass = `${username}:${token}`;
|
|
||||||
let basicAuth = btoa(userpass);
|
|
||||||
Object.assign(opts.headers, {
|
|
||||||
Authentication: `Basic ${basicAuth}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let resp = await fetch(url, opts);
|
|
||||||
if (!resp.ok) {
|
|
||||||
let headers = Array.from(resp.headers);
|
|
||||||
console.error('Bad Resp Headers:', headers);
|
|
||||||
let text = await resp.text();
|
|
||||||
console.error('Bad Resp Body:', text);
|
|
||||||
let msg = `failed to fetch releases from '${baseurl}' with user '${username}'`;
|
|
||||||
throw new Error(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
let respText = await resp.text();
|
|
||||||
let gHubResp;
|
|
||||||
try {
|
|
||||||
gHubResp = JSON.parse(respText);
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Bad Resp JSON:', respText);
|
|
||||||
console.error(e.message);
|
|
||||||
let msg = `failed to parse releases from '${baseurl}' with user '${username}'`;
|
|
||||||
throw new Error(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
let all = {
|
|
||||||
releases: [],
|
|
||||||
// todo make this ':baseurl' + ':releasename'
|
|
||||||
download: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
gHubResp.forEach(transformReleases);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e.message);
|
|
||||||
console.error('Error Headers:', resp.headers);
|
|
||||||
console.error('Error Body:', resp.body);
|
|
||||||
let msg = `failed to transform releases from '${baseurl}' with user '${username}'`;
|
|
||||||
throw new Error(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function transformReleases(release) {
|
|
||||||
for (let asset of release['assets']) {
|
|
||||||
let name = asset['name'];
|
|
||||||
let date = release['published_at']?.replace(/T.*/, '');
|
|
||||||
let download = asset['browser_download_url'];
|
|
||||||
|
|
||||||
// TODO tags aren't always semver / sensical
|
|
||||||
let version = release['tag_name'];
|
|
||||||
let channel;
|
|
||||||
if (release['prerelease']) {
|
|
||||||
// -rcX, -preview, -beta, etc will be checked in _webi/normalize.js
|
|
||||||
channel = 'beta';
|
|
||||||
}
|
|
||||||
let lts = /(\b|_)(lts)(\b|_)/.test(release['tag_name']);
|
|
||||||
|
|
||||||
all.releases.push({
|
|
||||||
name: name,
|
|
||||||
version: version,
|
|
||||||
lts: lts,
|
|
||||||
channel: channel,
|
|
||||||
date: date,
|
|
||||||
os: '', // will be guessed by download filename
|
|
||||||
arch: '', // will be guessed by download filename
|
|
||||||
ext: '', // will be normalized
|
|
||||||
download: download,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return all;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (module === require.main) {
|
|
||||||
GitHubish.getAllReleases({
|
|
||||||
owner: 'BurntSushi',
|
|
||||||
repo: 'ripgrep',
|
|
||||||
baseurl: 'https://api.github.com',
|
|
||||||
}).then(function (all) {
|
|
||||||
console.info(JSON.stringify(all, null, 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -202,7 +202,7 @@ __bootstrap_webi() {
|
|||||||
unzstd -c --keep "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" | tar xf -
|
unzstd -c --keep "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" | tar xf -
|
||||||
elif test "$WEBI_EXT" = "tar.xz"; then
|
elif test "$WEBI_EXT" = "tar.xz"; then
|
||||||
echo " Extracting $(t_path "${my_dl_rel}")"
|
echo " Extracting $(t_path "${my_dl_rel}")"
|
||||||
unxz -c -k "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" | tar xf -
|
unxz -c --keep "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" | tar xf -
|
||||||
elif test "$WEBI_EXT" = "tar.gz"; then
|
elif test "$WEBI_EXT" = "tar.gz"; then
|
||||||
echo " Extracting $(t_path "${my_dl_rel}")"
|
echo " Extracting $(t_path "${my_dl_rel}")"
|
||||||
tar xzf "${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
|
tar xzf "${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
var github = require('../_common/github.js');
|
|
||||||
var owner = 'eugeneware';
|
|
||||||
var repo = 'ffmpeg-static';
|
|
||||||
|
|
||||||
module.exports = function (request) {
|
|
||||||
return github(request, owner, repo).then(function (all) {
|
|
||||||
all.releases = all.releases
|
|
||||||
.filter(function (rel) {
|
|
||||||
let isFfmpeg = rel.name.includes('ffmpeg');
|
|
||||||
if (!isFfmpeg) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove README and LICENSE
|
|
||||||
return !['.README', '.LICENSE'].includes(path.extname(rel.name));
|
|
||||||
})
|
|
||||||
.map(function (rel) {
|
|
||||||
rel.version = rel.version.replace(/^b/, '');
|
|
||||||
|
|
||||||
if (/win32/.test(rel.name)) {
|
|
||||||
rel.os = 'windows';
|
|
||||||
rel.ext = 'exe';
|
|
||||||
}
|
|
||||||
if (/ia32/.test(rel.name)) {
|
|
||||||
rel.arch = '386';
|
|
||||||
} else if (/x64/.test(rel.name)) {
|
|
||||||
rel.arch = 'amd64';
|
|
||||||
}
|
|
||||||
|
|
||||||
return rel;
|
|
||||||
});
|
|
||||||
return all;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (module === require.main) {
|
|
||||||
module.exports(require('@root/request')).then(function (all) {
|
|
||||||
all = require('../_webi/normalize.js')(all);
|
|
||||||
console.info(JSON.stringify(all));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -3,51 +3,17 @@ set -e
|
|||||||
set -u
|
set -u
|
||||||
|
|
||||||
if command -v fish > /dev/null; then
|
if command -v fish > /dev/null; then
|
||||||
if ! test -r ~/.config/fish/config.fish; then
|
if [ ! -e ~/.config/fish/config.fish ]; then
|
||||||
mkdir -p ~/.config/fish
|
mkdir -p ~/.config/fish
|
||||||
touch ~/.config/fish/config.fish
|
touch ~/.config/fish/config.fish
|
||||||
chmod 0600 ~/.config/fish/config.fish
|
chmod 0600 ~/.config/fish/config.fish
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
if command -v sudo > /dev/null; then
|
|
||||||
my_answer='n'
|
|
||||||
if command -v apt > /dev/null; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR"
|
|
||||||
echo " No Webi installer for fish on Linux yet."
|
|
||||||
echo ""
|
|
||||||
echo "SOLUTION"
|
|
||||||
echo " Would you like to install with apt?"
|
|
||||||
echo " sudo apt install -y fish"
|
|
||||||
echo ""
|
|
||||||
printf "Install with sudo and apt [Y/n]? "
|
|
||||||
elif command -v apk > /dev/null; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR"
|
|
||||||
echo " No Webi installer for fish on Alpine yet."
|
|
||||||
echo ""
|
|
||||||
echo "SOLUTION"
|
|
||||||
echo " Would you like to install with apk?"
|
|
||||||
echo " sudo apk add --no-cache fish"
|
|
||||||
echo ""
|
|
||||||
printf "Install with sudo and apk [Y/n]? "
|
|
||||||
elif test "Darwin" != "$(uname -s)"; then
|
|
||||||
echo "No fish installer for Linux yet."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r my_answer < /dev/tty
|
if [ "Darwin" != "$(uname -s)" ]; then
|
||||||
if test -z "${my_answer}" ||
|
echo "No fish installer for Linux yet. Try this instead:"
|
||||||
test "${my_answer}" = "Y" ||
|
echo " sudo apt install -y fish"
|
||||||
test "${my_answer}" = "y"; then
|
exit 1
|
||||||
sudo apt install -y fish
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif test "Darwin" != "$(uname -s)"; then
|
|
||||||
echo "No fish installer for Linux yet."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
@@ -71,10 +37,6 @@ pkg_src="$pkg_src_cmd"
|
|||||||
# pkg_install must be defined by every package
|
# pkg_install must be defined by every package
|
||||||
|
|
||||||
_macos_post_install() {
|
_macos_post_install() {
|
||||||
if test "Darwin" != "$(uname -s)"; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ -e "$HOME/.local/bin/fish" ]; then
|
if ! [ -e "$HOME/.local/bin/fish" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -109,10 +71,8 @@ _macos_post_install() {
|
|||||||
killall cfprefsd
|
killall cfprefsd
|
||||||
}
|
}
|
||||||
|
|
||||||
if test "Darwin" = "$(uname -s)"; then
|
# always try to reset the default shells
|
||||||
# always try to reset the default shells
|
_macos_post_install
|
||||||
_macos_post_install
|
|
||||||
fi
|
|
||||||
|
|
||||||
pkg_install() {
|
pkg_install() {
|
||||||
mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
|
mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
|
||||||
@@ -124,10 +84,7 @@ pkg_post_install() {
|
|||||||
webi_post_install
|
webi_post_install
|
||||||
|
|
||||||
# try again to update default shells, now that all files should exist
|
# try again to update default shells, now that all files should exist
|
||||||
if test "Darwin" = "$(uname -s)"; then
|
_macos_post_install
|
||||||
# always try to reset the default shells
|
|
||||||
_macos_post_install
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e ~/.config/fish/config.fish ]; then
|
if [ ! -e ~/.config/fish/config.fish ]; then
|
||||||
mkdir -p ~/.config/fish
|
mkdir -p ~/.config/fish
|
||||||
|
|||||||
@@ -14,57 +14,11 @@ __init_git() {
|
|||||||
echo >&2 " for example, try: xcode-select --install"
|
echo >&2 " for example, try: xcode-select --install"
|
||||||
# sudo xcodebuild -license accept
|
# sudo xcodebuild -license accept
|
||||||
else
|
else
|
||||||
fn_prompt_sudo_install git
|
echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
|
||||||
|
echo >&2 " for example, try: sudo apt install -y git"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_prompt_sudo_install() {
|
|
||||||
a_pkg="${1}"
|
|
||||||
|
|
||||||
if command -v sudo > /dev/null; then
|
|
||||||
my_answer='n'
|
|
||||||
cmd_pkg_add=''
|
|
||||||
if command -v apt > /dev/null; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR"
|
|
||||||
echo " No Webi installer for ${a_pkg} on Linux yet."
|
|
||||||
echo ""
|
|
||||||
echo "SOLUTION"
|
|
||||||
echo " Would you like to install with apt?"
|
|
||||||
echo " sudo apt install -y ${a_pkg}"
|
|
||||||
echo ""
|
|
||||||
printf "Install with sudo and apt [Y/n]? "
|
|
||||||
cmd_pkg_add='sudo apt install -y'
|
|
||||||
elif command -v apk > /dev/null; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR"
|
|
||||||
echo " No Webi installer for ${a_pkg} on Alpine yet."
|
|
||||||
echo ""
|
|
||||||
echo "SOLUTION"
|
|
||||||
echo " Would you like to install with apk?"
|
|
||||||
echo " sudo apk add --no-cache ${a_pkg}"
|
|
||||||
echo ""
|
|
||||||
printf "Install with sudo and apk [Y/n]? "
|
|
||||||
cmd_pkg_add='sudo apk add --no-cache'
|
|
||||||
elif test "Darwin" != "$(uname -s)"; then
|
|
||||||
echo "No ${a_pkg} installer for Linux yet."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r my_answer < /dev/tty
|
|
||||||
if test -z "${my_answer}" ||
|
|
||||||
test "${my_answer}" = "Y" ||
|
|
||||||
test "${my_answer}" = "y"; then
|
|
||||||
$cmd_pkg_add "${a_pkg}"
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif test "Darwin" != "$(uname -s)"; then
|
|
||||||
echo "No ${a_pkg} installer for Linux yet."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
__init_git
|
__init_git
|
||||||
|
|||||||
@@ -45,10 +45,8 @@ __init_pwsh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_done_message() {
|
pkg_done_message() {
|
||||||
# We print the version here to ensure the install completed without
|
echo "Installed 'pwsh' at $pkg_dst"
|
||||||
# errors - no missing libraries, not incompatible arch, etc
|
pwsh -V
|
||||||
echo ""
|
|
||||||
"$pkg_dst_cmd" -V
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,24 +74,26 @@ main() {
|
|||||||
else
|
else
|
||||||
my_keytype='rsa'
|
my_keytype='rsa'
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
echo >&2 "Generating public/private rsa key pair."
|
|
||||||
ssh-keygen -b 4096 -t rsa -f ~/.ssh/id_rsa -q -N ""
|
ssh-keygen -b 4096 -t rsa -f ~/.ssh/id_rsa -q -N ""
|
||||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO use the comment (if any) for the name of the file
|
my_comment="$(tr '[:space:]' '\n' < "$HOME/.ssh/id_${my_keytype}.pub" | grep '\w' | tail -n 1)"
|
||||||
|
if test -z "${my_comment}" || test "${my_comment#}" -gt 100; then
|
||||||
|
my_comment="$(id -u -n)"
|
||||||
|
fi
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
#shellcheck disable=SC2088
|
#shellcheck disable=SC2088
|
||||||
echo >&2 "~/Downloads/id_${my_keytype}.$(whoami).pub":
|
echo >&2 "~/Downloads/id_${my_keytype}.${my_comment}.pub":
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
rm -f "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
rm -f "$HOME/Downloads/id_${my_keytype}.${my_comment}.pub"
|
||||||
cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.${my_comment}.pub"
|
||||||
cat "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
cat "$HOME/Downloads/id_${my_keytype}.${my_comment}.pub"
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
|
|
||||||
if test -f ~/.ssh/id_rsa; then
|
if test -f ~/.ssh/id_rsa; then
|
||||||
my_rsa_chars="$(cat ~/.ssh/id_rsa)"
|
my_rsa_size="$(wc < ~/.ssh/id_rsa | rev | cut -d' ' -f1 | rev)"
|
||||||
if test "${#my_rsa_chars}" -lt 2500; then
|
if test "${my_rsa_size}" -lt 2500; then
|
||||||
fn_warn_rsa >&2
|
fn_warn_rsa >&2
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: vim-devicons
|
title: vim-devicons
|
||||||
homepage: https://github.com/ryanoasis/vim-devicons
|
homepage: https://github.com/ryanoasis/devicons
|
||||||
tagline: |
|
tagline: |
|
||||||
VimDevIcons: Adds Icons to Your Plugins.
|
VimDevIcons: Adds Icons to Your Plugins.
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user