Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

update the file/dir permissions upon creation #13

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions subcommands/upgrade_sc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (ic *UpgradeCommand) Name() string {
//Init - Parses and Populates values of the Upgrade subcommand
func (ic *UpgradeCommand) Init(args []string) error {
if len(args) <= 0 {
fmt.Println("No package specified, upgrading all currently Upgradeed packages.")
fmt.Println("No package specified, upgrading all currently installed packages.")
} else {
ic.name = args[0]
}
Expand Down Expand Up @@ -86,15 +86,15 @@ func (ic *UpgradeCommand) Run() error {
return errors.New("Could not find package " + ic.name + " in the package list")
}

//Check if the corresponding package image is already Upgradeed
//Check if the corresponding package image is already installed
imgExist, err := utils.ImageExists(pack.Image)

//Check for errors
if err != nil {
return err
}

//If the image exists the package is already Upgradeed
//If the image exists the package is already installed
if !imgExist {
return errors.New("Package: " + pack.Name + " is not installed. It must be installed before it can be upgraded.")
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func (ic *UpgradeCommand) Run() error {
if vol.Path != "" {
if _, err := os.Stat(ed + vol.Path); err != nil {
if os.IsNotExist(err) {
err = os.MkdirAll(ed+vol.Path, 0755)
err = os.MkdirAll(ed+vol.Path, 0765)

if err != nil {
return err
Expand All @@ -222,7 +222,7 @@ func (ic *UpgradeCommand) Run() error {
}

//Recreate the directory
err = os.MkdirAll(ed+vol.Path, 0755)
err = os.MkdirAll(ed+vol.Path, 0765)

if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions utils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ func CopyFromContainer(source string, dest string, containerID string) error {
if _, err = os.Stat(path); err != nil {
if os.IsNotExist(err) {
//Make the directory
err = os.MkdirAll(path, info.Mode())
err = os.MkdirAll(path, 0765)
} else {
return err
}
}

} else {
//Create the file and open it in the destination path on the host
file, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, info.Mode())
file, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0765)

//Check for errors
if err != nil {
Expand Down