-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ietf-factory-default: Implement factory reset
- Loading branch information
1 parent
d667402
commit 6452198
Showing
6 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
Q=$@ | ||
|
||
echo "$Q, are you sure? (y/N)" | ||
read -n1 yorn | ||
|
||
if [ x$yorn != "xy" ]; then | ||
echo "Ok, aborting" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause */ | ||
|
||
#include "core.h" | ||
|
||
static int factory_reset(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, | ||
const sr_val_t *input, const size_t input_cnt, sr_event_t event, | ||
unsigned request_id, sr_val_t **output, size_t *output_cnt, void *priv) | ||
{ | ||
DEBUG("%s", xpath); | ||
return systemf("factory -y"); | ||
} | ||
|
||
int ietf_factory_default_init(struct confd *confd) | ||
{ | ||
int rc; | ||
|
||
REGISTER_RPC(confd->session, "/ietf-factory-default:factory-reset", factory_reset, NULL, &confd->fsub); | ||
return SR_ERR_OK; | ||
fail: | ||
ERROR("failed: %s", sr_strerror(rc)); | ||
return rc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters