forked from artix/calamares-extensions
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f01b4ed2f8 | ||
|
|
ea762b0945 | ||
|
|
cae8acb4a4 | ||
|
|
ae204d0108 | ||
|
|
a2fae600c4 |
@@ -29,15 +29,12 @@ rules of decent behavior in both communities are pretty much the same).
|
||||
|
||||
GitHub Issues are **one** place for discussing Calamares and its extensions if there are concrete
|
||||
problems or a new feature to discuss.
|
||||
Issues are not a help channel.
|
||||
Visit Matrix for help with configuration or compilation.
|
||||
|
||||
Regular Calamares development chit-chat happens in a [Matrix](https://matrix.org/)
|
||||
room, `#calamares:kde.org`. The conversation is bridged with IRC
|
||||
on [Libera.Chat](https://libera.chat/).
|
||||
Responsiveness is best during the day
|
||||
in Europe, but feel free to idle. If you use IRC, **DO NOT** ask-and-leave. Keep
|
||||
that chat window open because it can easily take a few hours for
|
||||
someone to notice a message.
|
||||
room, `#calamares:kde.org`. Responsiveness is best during the day
|
||||
in Europe, but feel free to idle.
|
||||
Matrix is persistent, and we'll see your message eventually.
|
||||
|
||||
* [](https://webchat.kde.org/#/room/%23calamares:kde.org)
|
||||
* [](https://kiwiirc.com/client/irc.libera.chat/#calamares)
|
||||
|
||||
11
README.md
11
README.md
@@ -220,15 +220,12 @@ The API is loosely documented in the
|
||||
GitHub Issues are **one** place for discussing Calamares (and Calamares Extensions)
|
||||
if there are concrete
|
||||
problems or a new feature to discuss.
|
||||
Issues are not a help channel.
|
||||
Visit Matrix for help with configuration or compilation.
|
||||
|
||||
Regular Calamares development chit-chat happens in a [Matrix](https://matrix.org/)
|
||||
room, `#calamares:kde.org`. The conversation is bridged with IRC
|
||||
on [Libera.Chat](https://libera.chat/).
|
||||
Responsiveness is best during the day
|
||||
in Europe, but feel free to idle. If you use IRC, **DO NOT** ask-and-leave. Keep
|
||||
that chat window open because it can easily take a few hours for
|
||||
someone to notice a message.
|
||||
room, `#calamares:kde.org`. Responsiveness is best during the day
|
||||
in Europe, but feel free to idle.
|
||||
Matrix is persistent, and we'll see your message eventually.
|
||||
|
||||
* [](https://webchat.kde.org/#/room/%23calamares:kde.org)
|
||||
* [](https://kiwiirc.com/client/irc.libera.chat/#calamares)
|
||||
|
||||
@@ -36,6 +36,7 @@ Config::setConfigurationMap( const QVariantMap& cfgMap )
|
||||
"messagebus", "news", "nobody", "ntp", "operator", "polkitd", "postmaster", "pulse", "root", "shutdown",
|
||||
"smmsp", "squid", "sshd", "sync", "uucp", "vpopmail", "xfs" } );
|
||||
|
||||
// ensure m_cmdUsermod matches m_username
|
||||
m_username = getString( cfgMap, "username", "user" );
|
||||
m_userPasswordNumeric = getBool( cfgMap, "userPasswordNumeric", true );
|
||||
|
||||
@@ -60,6 +61,8 @@ Config::setConfigurationMap( const QVariantMap& cfgMap )
|
||||
|
||||
m_cmdInternalStoragePrepare = getString( cfgMap, "cmdInternalStoragePrepare", "ondev-internal-storage-prepare" );
|
||||
m_cmdPasswd = getString( cfgMap, "cmdPasswd", "passwd" );
|
||||
m_cmdUsermod = getString( cfgMap, "cmdUsermod", "xargs -I{} -n1 usermod -m -d /home/{} -l {} -c {} user");
|
||||
|
||||
m_cmdSshdEnable = getString( cfgMap, "cmdSshdEnable", "systemctl enable sshd.service" );
|
||||
m_cmdSshdDisable = getString( cfgMap, "cmdSshdDisable", "systemctl disable sshd.service" );
|
||||
m_cmdSshdUseradd = getString( cfgMap, "cmdSshdUseradd", "useradd -G wheel -m" );
|
||||
@@ -74,6 +77,7 @@ Config::createJobs()
|
||||
/* Put users job in queue (should run after unpackfs) */
|
||||
Calamares::Job* j = new UsersJob( m_featureSshd,
|
||||
m_cmdPasswd,
|
||||
m_cmdUsermod,
|
||||
cmdSshd,
|
||||
m_cmdSshdUseradd,
|
||||
m_isSshEnabled,
|
||||
@@ -138,6 +142,13 @@ Config::runPartitionJobThenLeave( bool b )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Config::setUsername( const QString& username )
|
||||
{
|
||||
m_username = username;
|
||||
emit usernameChanged( m_username );
|
||||
}
|
||||
|
||||
void
|
||||
Config::setUserPassword( const QString& userPassword )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class Config : public QObject
|
||||
Q_PROPERTY( QStringList reservedUsernames READ reservedUsernames CONSTANT FINAL )
|
||||
|
||||
/* default user */
|
||||
Q_PROPERTY( QString username READ username CONSTANT FINAL )
|
||||
Q_PROPERTY( QString username READ username WRITE setUsername NOTIFY usernameChanged )
|
||||
Q_PROPERTY( QString userPassword READ userPassword WRITE setUserPassword NOTIFY userPasswordChanged )
|
||||
Q_PROPERTY( bool userPasswordNumeric READ userPasswordNumeric CONSTANT FINAL )
|
||||
|
||||
@@ -78,9 +78,10 @@ public:
|
||||
/* reserved usernames (user_pass, ssh_credentials) */
|
||||
QStringList reservedUsernames() const { return m_reservedUsernames; };
|
||||
|
||||
/* default user */
|
||||
/* user */
|
||||
QString username() const { return m_username; }
|
||||
QString userPassword() const { return m_userPassword; }
|
||||
void setUsername( const QString& username );
|
||||
void setUserPassword( const QString& userPassword );
|
||||
bool userPasswordNumeric() const { return m_userPasswordNumeric; }
|
||||
|
||||
@@ -126,6 +127,7 @@ public:
|
||||
|
||||
/* users job */
|
||||
QString cmdPasswd() const { return m_cmdPasswd; }
|
||||
QString cmdUsermod() const { return m_cmdUsermod; }
|
||||
QString cmdSshdEnable() const { return m_cmdSshdEnable; }
|
||||
QString cmdSshdDisable() const { return m_cmdSshdDisable; }
|
||||
QString cmdSshdUseradd() const { return m_cmdSshdUseradd; }
|
||||
@@ -181,6 +183,7 @@ private:
|
||||
|
||||
/* users job */
|
||||
QString m_cmdPasswd;
|
||||
QString m_cmdUsermod;
|
||||
QString m_cmdSshdEnable;
|
||||
QString m_cmdSshdDisable;
|
||||
QString m_cmdSshdUseradd;
|
||||
@@ -190,6 +193,7 @@ signals:
|
||||
|
||||
/* default user */
|
||||
void userPasswordChanged( QString userPassword );
|
||||
void usernameChanged( QString username );
|
||||
|
||||
/* ssh server + credentials */
|
||||
void sshdUsernameChanged( QString sshdUsername );
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
UsersJob::UsersJob( bool featureSshd,
|
||||
const QString& cmdPasswd,
|
||||
const QString& cmdUsermod,
|
||||
const QString& cmdSshd,
|
||||
const QString& cmdSshdUseradd,
|
||||
bool isSshEnabled,
|
||||
@@ -24,6 +25,7 @@ UsersJob::UsersJob( bool featureSshd,
|
||||
: Calamares::Job()
|
||||
, m_featureSshd( featureSshd )
|
||||
, m_cmdPasswd( cmdPasswd )
|
||||
, m_cmdUsermod( cmdUsermod )
|
||||
, m_cmdSshd( cmdSshd )
|
||||
, m_cmdSshdUseradd( cmdSshdUseradd )
|
||||
, m_isSshEnabled( isSshEnabled )
|
||||
@@ -49,9 +51,11 @@ UsersJob::exec()
|
||||
using namespace std;
|
||||
|
||||
QList< QPair< QStringList, QString > > commands = {
|
||||
{ { "sh", "-c", m_cmdPasswd + " " + m_username }, m_password + "\n" + m_password + "\n" },
|
||||
{ { "sh", "-c", m_cmdUsermod }, m_username + "\n" }
|
||||
};
|
||||
|
||||
commands.append( { { "sh", "-c", m_cmdPasswd + " " + m_username }, m_password + "\n" + m_password + "\n" } );
|
||||
|
||||
if ( m_featureSshd )
|
||||
{
|
||||
commands.append( { { "sh", "-c", m_cmdSshd }, QString() } );
|
||||
|
||||
@@ -10,6 +10,7 @@ class UsersJob : public Calamares::Job
|
||||
public:
|
||||
UsersJob( bool featureSshd,
|
||||
const QString& cmdPasswd,
|
||||
const QString& cmdUsermod,
|
||||
const QString& cmdSshd,
|
||||
const QString& cmdSshdUseradd,
|
||||
bool isSshEnabled,
|
||||
@@ -26,6 +27,7 @@ public:
|
||||
private:
|
||||
bool m_featureSshd;
|
||||
QString m_cmdPasswd;
|
||||
QString m_cmdUsermod;
|
||||
QString m_cmdSshd;
|
||||
QString m_cmdSshdUseradd;
|
||||
bool m_isSshEnabled;
|
||||
|
||||
@@ -26,6 +26,7 @@ bogus: true
|
||||
# version: "(unknown)"
|
||||
|
||||
## Default username (for which the password will be set)
|
||||
## Ensure also cmdUsermod command matches the default user, so it can be changed if desired.
|
||||
# username: "user"
|
||||
|
||||
## reserved usernames (for user_pass username prompt and ssh_credentials)
|
||||
@@ -154,6 +155,10 @@ bogus: true
|
||||
### Commands running in the target OS (chroot)
|
||||
#######
|
||||
|
||||
## Change the username for the default user
|
||||
## Stdin: username with \n
|
||||
# cmdUsermod: "xargs -I{} -n1 usermod -m -d /home/{} -l {} -c {} user"
|
||||
|
||||
## Set the password for default user and sshd user
|
||||
## Arguments: <username>
|
||||
## Stdin: password twice, each time with \n
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<file>install_target.qml</file> <!-- install from external to internal? -->
|
||||
<file>install_target_confirm.qml</file> <!-- overwrite internal storage? -->
|
||||
|
||||
<file>user_pass.qml</file> <!-- default user: password -->
|
||||
<file>user_pass.qml</file> <!-- default user: username, password -->
|
||||
<file>ssh_confirm.qml</file> <!-- sshd: enable or not? -->
|
||||
<file>ssh_credentials.qml</file> <!-- sshd user: username, password -->
|
||||
<file>fs_selection.qml</file> <!-- filesystem selection -->
|
||||
|
||||
Reference in New Issue
Block a user