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
05c2443a
Commit
05c2443a
authored
14 years ago
by
Natanael Copa
Browse files
Options
Downloads
Patches
Plain Diff
abuild-keygen: implement -q for quiet mode
parent
18fa4231
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
abuild-keygen.in
+24
-15
24 additions, 15 deletions
abuild-keygen.in
with
24 additions
and
15 deletions
abuild-keygen.in
+
24
−
15
View file @
05c2443a
...
...
@@ -15,6 +15,12 @@ abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
abuild_home
=
${
ABUILD_USERDIR
:-
"
$HOME
/.abuild"
}
abuild_userconf
=
${
ABUILD_USERCONF
:-
"
$abuild_home
/abuild.conf"
}
# echo message unless quite mode
msg
()
{
[
-n
"
$quiet
"
]
&&
return
0
echo
"
$@
"
}
# ask for privkey unless non-interactive mode
# returns value in global $privkey
get_privkey_file
()
{
...
...
@@ -29,6 +35,7 @@ get_privkey_file() {
fi
}
# print usage and exit
usage
()
{
echo
"abuild-keygen
$abuild_ver
"
echo
"usage: abuild-keygen [-ih]"
...
...
@@ -37,6 +44,7 @@ usage() {
echo
" -i Install public key into /etc/apk/keys using sudo"
echo
" -h Show this help"
echo
" -n Non-interactive. Use defaults"
echo
" -q Quiet mode"
echo
""
exit
1
}
...
...
@@ -61,12 +69,13 @@ else
default_name
=
"
$USER
-
$(
printf
"%x"
$(
date
+%s
))
"
fi
while
getopts
"ahin"
opt
;
do
while
getopts
"ahin
q
"
opt
;
do
case
$opt
in
a
)
append_config
=
yes
;;
h
)
usage
;;
i
)
install_pubkey
=
yes
;;
n
)
non_interactive
=
yes
;;
q
)
quiet
=
-quiet
;;
esac
done
shift
$((
$OPTIND
-
1
))
...
...
@@ -85,15 +94,15 @@ openssl rsa -in "$privkey" -pubout -out "$pubkey"
if
[
-n
"
$install_pubkey
"
]
;
then
echo
"Installing
$pubkey
to /etc/apk/keys..."
msg
"Installing
$pubkey
to /etc/apk/keys..."
sudo mkdir
-p
/etc/apk/keys
sudo cp
-i
"
$pubkey
"
/etc/apk/keys/
else
echo
""
echo
"You'll need to install
$pubkey
into "
echo
"/etc/apk/keys to be able to install packages and repositories signed with"
echo
"
$privkey
"
msg
""
msg
"You'll need to install
$pubkey
into "
msg
"/etc/apk/keys to be able to install packages and repositories signed with"
msg
"
$privkey
"
fi
if
[
-n
"
$append_config
"
]
;
then
...
...
@@ -103,15 +112,15 @@ if [ -n "$append_config" ]; then
fi
echo
"PACKAGER_PRIVKEY=
\"
$privkey
\"
"
>>
"
$abuild_userconf
"
else
echo
""
echo
"You might want add following line to
$abuild_userconf
:"
echo
""
echo
"PACKAGER_PRIVKEY=
\"
$privkey
\"
"
echo
""
msg
""
msg
"You might want add following line to
$abuild_userconf
:"
msg
""
msg
"PACKAGER_PRIVKEY=
\"
$privkey
\"
"
msg
""
fi
echo
""
echo
"Please remember to make a safe backup of your private key:"
echo
"
$privkey
"
echo
""
msg
""
msg
"Please remember to make a safe backup of your private key:"
msg
"
$privkey
"
msg
""
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