Skip to content

Commit

Permalink
Fix accidental commit of rndssucli, add force option for update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernd Wachter committed Mar 11, 2013
1 parent a392521 commit e794d8c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
20 changes: 9 additions & 11 deletions rndssucli/rndssucli.cpp
Expand Up @@ -33,12 +33,7 @@ void RndSsuCli::run(){

QStringList arguments = QCoreApplication::arguments();

if (arguments.count() >= 2){
usage();
return;
}

if (arguments.at(1) == "register"){
if (arguments.at(1) == "register" && arguments.count() == 2){
QString username, password;
QTextStream qin(stdin);

Expand All @@ -48,12 +43,16 @@ void RndSsuCli::run(){
password = qin.readLine();

ssu.sendRegistration(username, password);
} else if (arguments.at(1) == "update"){
} else if (arguments.at(1) == "update" &&
(arguments.count() == 2 || arguments.count() == 3)){
if (!ssu.isRegistered()){
qout << "Device is not registered, can't update credentials" << endl;
QCoreApplication::exit(1);
} else {
ssu.updateCredentials();
bool force = false;
if (arguments.count() == 3 && arguments.at(2) == "-f")
force = true;
ssu.updateCredentials(force);
}
} else if (arguments.at(1) == "resolve"){
QString repo;
Expand All @@ -67,12 +66,11 @@ void RndSsuCli::run(){
if (arguments.count() >= 3){
//qout << (arguments.at(3).compare("false")||arguments.at(3).compare("0"));
qout << (arguments.at(3).compare("false"));

}

qout << ssu.repoUrl(arguments.at(2));
QCoreApplication::exit(1);
} else if (arguments.at(1) == "status"){
} else if (arguments.at(1) == "status" && arguments.count() == 2){
qout << "Device registration status: "
<< (ssu.isRegistered() ? "registered" : "not registered") << endl;
qout << "Device family: " << ssu.deviceFamily() << endl;
Expand All @@ -86,6 +84,6 @@ void RndSsuCli::run(){

void RndSsuCli::usage(){
QTextStream qout(stdout);
qout << "Usage: rndssu register|update|status" << endl;
qout << "Usage: rndssu register|update [-f]|status" << endl;
QCoreApplication::exit(1);
}
3 changes: 3 additions & 0 deletions rpm/ssu.changes
@@ -1,3 +1,6 @@
* Mon Mar 11 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.23
- Add force option to rndssu update

* Mon Mar 11 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.22
- Add systemd logging to core library
- Move zypper plugin logging to core library
Expand Down
2 changes: 1 addition & 1 deletion rpm/ssu.spec
@@ -1,5 +1,5 @@
Name: ssu
Version: 0.22
Version: 0.23
Release: 1
Summary: SSU enabler for RND
Group: System/Base
Expand Down

0 comments on commit e794d8c

Please sign in to comment.