From 7940bad4a974a155e13e70f148e0231e21b9f6ea Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 23 Jan 2015 05:51:13 +0100 Subject: [PATCH] gluon-lock-password: convert to invariant script and remove legacy script --- .../upgrade/lock-password/legacy/010-lock-password | 13 ------------- .../upgrade/lock-password/initial/010-lock-password | 3 --- .../lock-password/invariant/010-lock-password | 13 +++++++++++++ 3 files changed, 13 insertions(+), 16 deletions(-) delete mode 100755 package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password delete mode 100755 package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password create mode 100755 package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/invariant/010-lock-password diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password b/package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password deleted file mode 100755 index ce6d59ac..00000000 --- a/package/gluon-legacy/files/lib/gluon/upgrade/lock-password/legacy/010-lock-password +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - - -has_root_pwd() { - local pwd=$([ -f "$1" ] && cat "$1") - pwd="${pwd#*root:}" - pwd="${pwd%%:*}" - - test -n "${pwd#[\!x]}" -} - - -has_root_pwd /etc/passwd || has_root_pwd /etc/shadow || passwd -l root diff --git a/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password b/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password deleted file mode 100755 index 6e67fc4c..00000000 --- a/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/initial/010-lock-password +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -passwd -l root diff --git a/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/invariant/010-lock-password b/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/invariant/010-lock-password new file mode 100755 index 00000000..3204f638 --- /dev/null +++ b/package/gluon-lock-password/files/lib/gluon/upgrade/lock-password/invariant/010-lock-password @@ -0,0 +1,13 @@ +#!/bin/sh + +has_root_pwd() { + local pwd + + pwd=$([ -f "$1" ] && cat "$1") + pwd="${pwd#*root:}" + pwd="${pwd%%:*}" + + test -n "${pwd}" +} + +has_root_pwd /etc/shadow || passwd -l root