Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakub Panek
aports
Commits
18fa4231
Commit
18fa4231
authored
14 years ago
by
Natanael Copa
Browse files
Options
Downloads
Patches
Plain Diff
abuild-keygen: implement -n for non-interactive mode
parent
e524bc68
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
abuild-keygen.in
+18
-11
18 additions, 11 deletions
abuild-keygen.in
with
18 additions
and
11 deletions
abuild-keygen.in
+
18
−
11
View file @
18fa4231
...
@@ -15,6 +15,19 @@ abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
...
@@ -15,6 +15,19 @@ abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
abuild_home
=
${
ABUILD_USERDIR
:-
"
$HOME
/.abuild"
}
abuild_home
=
${
ABUILD_USERDIR
:-
"
$HOME
/.abuild"
}
abuild_userconf
=
${
ABUILD_USERCONF
:-
"
$abuild_home
/abuild.conf"
}
abuild_userconf
=
${
ABUILD_USERCONF
:-
"
$abuild_home
/abuild.conf"
}
# ask for privkey unless non-interactive mode
# returns value in global $privkey
get_privkey_file
()
{
privkey
=
"
$abuild_home
/
$default_name
.rsa"
[
"
$non_interactive
"
=
"yes"
]
&&
return
0
echo
"Generating public/private rsa key pair for abuild"
echo
-n
"Enter file in which to save the key (
$abuild_home
/
$default_name
.rsa): "
read
line
if
[
-n
"
$line
"
]
;
then
privkey
=
"
$line
"
fi
}
usage
()
{
usage
()
{
echo
"abuild-keygen
$abuild_ver
"
echo
"abuild-keygen
$abuild_ver
"
...
@@ -23,6 +36,7 @@ usage() {
...
@@ -23,6 +36,7 @@ usage() {
echo
" -a Set PACKAGER_PRIVKEY=<generated key> in
$abuild_userconf
"
echo
" -a Set PACKAGER_PRIVKEY=<generated key> in
$abuild_userconf
"
echo
" -i Install public key into /etc/apk/keys using sudo"
echo
" -i Install public key into /etc/apk/keys using sudo"
echo
" -h Show this help"
echo
" -h Show this help"
echo
" -n Non-interactive. Use defaults"
echo
""
echo
""
exit
1
exit
1
}
}
...
@@ -47,26 +61,19 @@ else
...
@@ -47,26 +61,19 @@ else
default_name
=
"
$USER
-
$(
printf
"%x"
$(
date
+%s
))
"
default_name
=
"
$USER
-
$(
printf
"%x"
$(
date
+%s
))
"
fi
fi
while
getopts
"ahi"
opt
;
do
while
getopts
"ahi
n
"
opt
;
do
case
$opt
in
case
$opt
in
a
)
append_config
=
yes
;;
a
)
append_config
=
yes
;;
h
)
usage
;;
h
)
usage
;;
i
)
install_pubkey
=
yes
;
i
)
install_pubkey
=
yes
;;
n
)
non_interactive
=
yes
;;
esac
esac
done
done
shift
$((
$OPTIND
-
1
))
shift
$((
$OPTIND
-
1
))
mkdir
-p
"
$abuild_home
"
mkdir
-p
"
$abuild_home
"
echo
"Generating public/private rsa key pair for abuild"
get_privkey_file
echo
-n
"Enter file in which to save the key (
$abuild_home
/
$default_name
.rsa): "
read
line
if
[
-z
"
$line
"
]
;
then
privkey
=
"
$abuild_home
/
$default_name
.rsa"
else
privkey
=
"
$line
"
fi
pubkey
=
"
$privkey
.pub"
pubkey
=
"
$privkey
.pub"
# generate the private key in a subshell with stricter umask
# generate the private key in a subshell with stricter umask
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment