mirror of
https://github.com/vhaudiquet/mymachine.git
synced 2025-12-19 04:26:05 +00:00
Update user information order for non-root infos
This commit is contained in:
24
mymachine.sh
24
mymachine.sh
@@ -40,16 +40,6 @@ handle_int() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure we are running as root
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
# If we are not running as root, try to relaunch ourselves as root
|
|
||||||
echo -e "${BNC}Testing root access...${NC}"
|
|
||||||
sudo bash -c "USERNAME=${USERNAME} GIT_USER=${GIT_USER} EMAIL=${EMAIL} USER_COMMENT=${USER_COMMENT} USER_PICTURE_URL=${USER_PICTURE_URL} PASSWORD=${PASSWORD} ${script_dir}/${script_name}"
|
|
||||||
exit $?
|
|
||||||
else
|
|
||||||
echo -e "${BNC}Root access obtained.${NC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ask the user to input PASSWORD if not set
|
# Ask the user to input PASSWORD if not set
|
||||||
if [ -z "${USERNAME}" ] || [ ${USERNAME} = "root" ]; then
|
if [ -z "${USERNAME}" ] || [ ${USERNAME} = "root" ]; then
|
||||||
read -p "Username: " USERNAME
|
read -p "Username: " USERNAME
|
||||||
@@ -70,9 +60,9 @@ if ! id "${USERNAME}" >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ -z ${EMAIL} ]; then
|
if [ -z "${EMAIL}" ]; then
|
||||||
EMAIL=$(git config --global user.email)
|
EMAIL=$(git config --global user.email)
|
||||||
if [ -z ${EMAIL} ]; then
|
if [ -z "${EMAIL}" ]; then
|
||||||
read -p "Email: " EMAIL
|
read -p "Email: " EMAIL
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -80,6 +70,16 @@ if [ -z "${USER_PICTURE_URL}" ] && [ ! -f "/var/lib/AccountsService/icons/${USER
|
|||||||
read -p "User profile picture URL (leave blank for none): " USER_PICTURE_URL
|
read -p "User profile picture URL (leave blank for none): " USER_PICTURE_URL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure we are running as root
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
# If we are not running as root, try to relaunch ourselves as root
|
||||||
|
echo -e "${BNC}Testing root access...${NC}"
|
||||||
|
sudo bash -c "USERNAME=${USERNAME} GIT_USER=${GIT_USER} EMAIL=${EMAIL} USER_COMMENT=${USER_COMMENT} USER_PICTURE_URL=${USER_PICTURE_URL} PASSWORD=${PASSWORD} ${script_dir}/${script_name}"
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
echo -e "${BNC}Root access obtained.${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Detect distribution
|
# Detect distribution
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
if ! [[ -d ${current_dir}/distribution/${ID} ]]; then
|
if ! [[ -d ${current_dir}/distribution/${ID} ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user